Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104652
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: hasattr() or "x in y"? |
| Date | 2016-03-11 22:05 +0000 |
| Message-ID | <mailman.12.1457733974.12893.python-list@python.org> (permalink) |
| References | <nbve7c$nbo$1@dont-email.me> <nbvep7$pb3$1@dont-email.me> |
On 11/03/2016 21:53, Charles T. Smith wrote: > On Fri, 11 Mar 2016 21:44:27 +0000, Charles T. Smith wrote: > >> From the performance point of view, which is better: - hasattr() >> - x in y >> >> TIA >> cts > > > I just realized that "in" won't look back through the class hierarchy... > that clearly makes them not interchangable, but given we're only > interested in the current dict... > Dict, don't you mean collection? Or, to put it another way, what exactly were you originally asking? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
hasattr() or "x in y"? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-03-11 21:44 +0000
Re: hasattr() or "x in y"? Chris Angelico <rosuav@gmail.com> - 2016-03-12 08:55 +1100
Re: hasattr() or "x in y"? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-03-11 21:53 +0000
Re: hasattr() or "x in y"? Chris Angelico <rosuav@gmail.com> - 2016-03-12 09:04 +1100
Re: hasattr() or "x in y"? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-11 22:05 +0000
Re: hasattr() or "x in y"? Grant Edwards <invalid@invalid.invalid> - 2016-03-11 22:00 +0000
Re: hasattr() or "x in y"? "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2016-03-11 22:18 +0000
Re: hasattr() or "x in y"? Grant Edwards <invalid@invalid.invalid> - 2016-03-11 22:30 +0000
csiph-web