On 02/23/2013 09:15 AM, Eli Bendersky wrote: > Hmm, constants such as os.SEEK_* which serve as *inputs* to stdlib rather than outputs can actually be a good > candidate for enum without worrying about backwards compatibility. > > The reason I make the *input* vs. *output* distinction, is that for stdlib code that returns values, the user may rely > on their numeric values and if we switch to enum code will break. However, for os.SEEK_* this is not the case. Thee can > be aliases for enums: > > class SeekKind(Enum): > SEEK_SET = 0 > SEEK_CUR = 1 > SEEK_END = 2 > > SEEK_SET = SeekKind.SEEK_SET > ... > > lseek() can be changed to call 'int' on its input, and now os.SEEK_* gain useful string representations when printed. > > Thoughts? If that particular enum is int based, you don't have to a) make the distinction between input/output b) call 'int' on its input and you /still/ get the useful string repr. ;) -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4