Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Am I the only one who would love these extentions? - Python 3.0 proposals (long)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Alexander Schmolck, post: 1737107"] True, but I'd still prefer this one (+ editor macro) in most cases to (ab)using numbers as symbols (this was my main point; I'm sure I could also think of various hacks to avoid the duplication and do the the stuffing in the global namespace implicitly/separately -- if it must go there at all costs). The main advantage the above has over custom enum types is that it's immediately obvious. Maybe the standard library should grow a canonical enum module that adresses most needs. Yep, this would also be my preference. I'd presumably use something like DAYS = enum('MON TUE WED [...]'.split()) maybe even without the split. Doesn't have to be, strings are just the simplest choice for something with a sensible 'repr' (since you might want some total order of your enums a class might be better -- if one goes through the trouble of creating one's own enum mechanism). Yuck! A nice metaclass demo but far too "clever" and misleading for such a simple task, IMO. If that prevents people from using the above, I'd consider it a good thing ;) Indeed, as I noted in my previous post, iterators and such extensions would go very well together. 'as [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Am I the only one who would love these extentions? - Python 3.0 proposals (long)
Top