[Python-ideas] Indicate if an iterable is ordered or not
Mark Janssen
dreamingforward at gmail.com
Wed Sep 25 03:50:44 CEST 2013
More information about the Python-ideas mailing list
Wed Sep 25 03:50:44 CEST 2013
- Previous message: [Python-ideas] Indicate if an iterable is ordered or not
- Next message: [Python-ideas] Have os.unlink remove junction points on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Iterables are not necessarily ordered (e.g. dict vs. OrderedDict). > Sequences are but Sets aren't. I'm not aware of any good way > currently to know if an arbitrary iterable is ordered. Without an > explicit indicator of ordered-ness, you must know in advance for each > specific type. > > One possible solution is an __isordered__ attribute (on the class), > set to a boolean. The absence of the attribute would imply False. Isn't the traditional way to do this via "inheritance"? Then you call issubclass(list, OrderedContainer), etc. But, then, no Python hasn't completely ordered its data structures yet. Mark
- Previous message: [Python-ideas] Indicate if an iterable is ordered or not
- Next message: [Python-ideas] Have os.unlink remove junction points on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list