Friday, 21 June 2019
... and some dislikes in Python itself :) ... #1: file seek offset
"A from_what value of 0 measures from the beginning of the file, 1 uses the current file position, and 2 uses the end of the file as the reference point. from_what can be omitted and defaults to 0, using the beginning of the file as the reference point."
(source)
Hopefully one day this changes.
Magic numbers in a framework are not really the best practice I'd diplomatically say - although this one is apparently just a relic from those old/new days of Python when the foundations were laid down. Yet, a glitch yielding poorly readable code and causing potential repetitive googling syndrome - plus I guess a negative offset would be more idiomatic than a separate constant (update: just realized that the negative offset is supposed to be used in conjunction with the "2" constant - isn't that a bit odd? Raises the question - so does it work with the "0" - from beginning - case?), which could then retire to be a more often ignored optional parameter.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment