Implicit lists
Dale Strickland-Clark
dale at riverhall.NOTHANKS.co.uk
Thu Jan 30 10:48:58 EST 2003
More information about the Python-list mailing list
Thu Jan 30 10:48:58 EST 2003
- Previous message (by thread): Implicit lists
- Next message (by thread): Implicit lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Hansen <peter at engcorp.com> wrote: >This is probably a better approach in several ways: > >def ensureList(thing): > try: > return list(thing) > except TypeError: > return [thing] > > >-Peter Except it doesn't work :-) >>> list('abc') ['a', 'b', 'c'] >>> -- Dale Strickland-Clark Riverhall Systems Ltd
- 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