A curious bit of code...
Ethan Furman
ethan at stoneleaf.us
Thu Feb 13 17:26:12 EST 2014
More information about the Python-list mailing list
Thu Feb 13 17:26:12 EST 2014
- Previous message (by thread): A curious bit of code...
- Next message (by thread): A curious bit of code...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/13/2014 02:13 PM, Chris Angelico wrote: > On Fri, Feb 14, 2014 at 8:33 AM, Ethan Furman <ethan at stoneleaf.us> wrote: >> Oh, it's not that bad! All you have to do is handle the edge case of an >> empty string: >> >> s[::len(s)-1 if s else True] > > And the edge case of the one-character string. Oops, my description should have said "edge case of a one-character string". The empty string needs no extra handling. -- ~Ethan~
- Previous message (by thread): A curious bit of code...
- Next message (by thread): A curious bit of code...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list