Hi,
Is there some reason why the Page class does not have a getSize function, except the fact that it's trivial to obtain it from .get() ?
Thanks, Strainu
Hi Strainu,
On 13 June 2013 17:07, Strainu strainu10@gmail.com wrote:
Is there some reason why the Page class does not have a getSize function, except the fact that it's trivial to obtain it from .get() ?
I don't think there was a specific design decision not to implement it, other than 'no-one ever needed it'. It's also not entirely clear what 'size' means in this context: the number of characters, the number of bytes in a given encoding.
What is the use case where you think it would be useful?
Best, Merlijn
I think that's an interesting question, if you see it from this point of view: "As soon as a Page object has been created, is it possible to get its length without getting it? Page.get() is much slower than creating a Page obiect, and there's a lot of attributes/methods that can be read immediately, while other attributes need one Page.get(). Could be a Page.getSize() a "first class method", that a user can read immediately?
Alex
2013/6/13 Merlijn van Deen valhallasw@arctus.nl
Hi Strainu,
On 13 June 2013 17:07, Strainu strainu10@gmail.com wrote:
Is there some reason why the Page class does not have a getSize function, except the fact that it's trivial to obtain it from .get() ?
I don't think there was a specific design decision not to implement it, other than 'no-one ever needed it'. It's also not entirely clear what 'size' means in this context: the number of characters, the number of bytes in a given encoding.
What is the use case where you think it would be useful?
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
2013/6/13 Merlijn van Deen valhallasw@arctus.nl:
Hi Strainu,
On 13 June 2013 17:07, Strainu strainu10@gmail.com wrote:
Is there some reason why the Page class does not have a getSize function, except the fact that it's trivial to obtain it from .get() ?
I don't think there was a specific design decision not to implement it, other than 'no-one ever needed it'. It's also not entirely clear what 'size' means in this context: the number of characters, the number of bytes in a given encoding.
What is the use case where you think it would be useful?
Hi,
I needed it today in order to compute some quick and simple statistics about a series of pages (e.g. "which were the largest deletion discussions in a given period"). Now that I think of it, I could probably use it to decide when I am likely to hit https://bugzilla.wikimedia.org/show_bug.cgi?id=43046
Alex's usecase is also interesting, but I'm not sure it's possible - I believe size would require an API call, which is almost as expensive as a get() for most pages.
I think the meaning of "size" can be only one: the number of bytes, in order to make it simple to compare with what MediaWiki is showing in the history pages.
Strainu
pywikipedia-l@lists.wikimedia.org