Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39346
| References | <4abbe91f-a57e-47de-9cf3-5b9574201c83@googlegroups.com> <mailman.2018.1361277272.2939.python-list@python.org> <aojm6oFu09lU1@mid.individual.net> <5124ad18$0$29975$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2013-02-20 22:16 +1100 |
| Subject | Re: Data Tree urgent help!!!!!! |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2105.1361359003.2939.python-list@python.org> (permalink) |
On Wed, Feb 20, 2013 at 10:01 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Leo Breebaart wrote: > >> Peter Otten <__peter__@web.de> writes: >> >>> >>> class Name(str): >>> ... def __repr__(self): >>> ... return self >>> ... >>> >>> apple, pear, dog, cat, fork, spoon = map(Name, "apple pear dog cat >>> >>> fork spoon".split()) >> >> Is there any reason why you introduced the Name class? In Python >> 2.7 this works equally well if I just do: >> >>>>> apple, pear, dog, cat, fork, spoon = map(str, "apple pear dog cat fork >>>>> spoon".split()) >> >> So I was wondering why you used Name. > > I'm wondering why you used map. > > > apple, pear, dog, cat, fork, spoon = "apple pear dog cat fork spoon".split() Why, in case someone monkeypatched split() to return something other than strings, of course! Sorry, I've been learning Ruby this week, and I fear it may be damaging to my mind... ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Data Tree urgent help!!!!!! anadionisio257@gmail.com - 2013-02-19 04:14 -0800
Re: Data Tree urgent help!!!!!! Peter Otten <__peter__@web.de> - 2013-02-19 13:34 +0100
Re: Data Tree urgent help!!!!!! Ana Dionísio <anadionisio257@gmail.com> - 2013-02-19 04:50 -0800
Re: Data Tree urgent help!!!!!! Ana Dionísio <anadionisio257@gmail.com> - 2013-02-19 04:50 -0800
Re: Data Tree urgent help!!!!!! Leo Breebaart <leo@lspace.org> - 2013-02-20 10:18 +0000
Re: Data Tree urgent help!!!!!! Peter Otten <__peter__@web.de> - 2013-02-20 11:46 +0100
Re: Data Tree urgent help!!!!!! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-20 22:01 +1100
Re: Data Tree urgent help!!!!!! Chris Angelico <rosuav@gmail.com> - 2013-02-20 22:16 +1100
Re: Data Tree urgent help!!!!!! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-20 22:47 +1100
csiph-web