accessing an object instance by only having one of its attribute values

mshiltonj mshiltonj at gmail.com
Mon Jul 9 03:29:36 CEST 2007


On Jul 8, 8:29 pm, Paul McGuire <p... at austin.rr.com> wrote:
> On Jul 8, 2:11 pm, mshiltonj <mshilt... at gmail.com> wrote:

> I have some comments on the Pythonicity of your suggestions.  Same
> assumption, object attr is a unique key of some sort.  How to create
> the dict of objects, and how to retrieve an object by key.
>
> -- Paul

I was probably being overly helpful, in a bad way. I'm new to python,
I'm not very pythonic yet, and still learning the python idioms.

Not sure why I slipped into the habit of testing for None, though. :-(

Probably a perl thing, where I'm regularly testing for defined-ness.
"if ($foo)" is different than "if (defined $foo)"

Still, I'm really like python so far.




More information about the Python-list mailing list