Implicit lists
Mike Meyer
mwm at mired.org
Thu Jan 30 11:30:32 EST 2003
More information about the Python-list mailing list
Thu Jan 30 11:30:32 EST 2003
- Previous message (by thread): Implicit lists
- Next message (by thread): Implicit lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alex Martelli <aleax at aleax.it> writes: > def iteron(something): > # string-like objects: treat as non-sequences > try: something+'' > except TypeError: pass > else: > yield something > return > # other sequences > try: > for x in something: yield x > except TypeError: > yield something I always thought that exceptions were expensive. Which makes me wonder why you aren't using "isinstance(something, str)" for that first test. Thanks, <mike -- Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
- Previous message (by thread): Implicit lists
- Next message (by thread): Implicit lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list