[Python-ideas] Was: Annotations (and static typing), Now:Sharing __annotations__

Chris Angelico rosuav at gmail.com
Mon Aug 25 04:19:44 CEST 2014


On Mon, Aug 25, 2014 at 12:04 PM, Cem Karan <cfkaran2 at gmail.com> wrote:
> On Aug 24, 2014, at 9:22 PM, Chris Angelico <rosuav at gmail.com> wrote:
>
>> On Mon, Aug 25, 2014 at 11:15 AM, Cem Karan <cfkaran2 at gmail.com> wrote:
>>> Because of this, using 'annotizer' as a key is meaningless; there could be many instances live at the same time.
>>
>> But that's exactly my point! You don't use "annotizer" as the key, you
>> use annotizer. You use the object itself, not the string.
>
> And now I feel dumb...

Ehh, don't feel dumb, my explanation wasn't all that clear - it's hard
to be clear in email. It's like when Rapunzel says, "I like Eugene
Fitzherbert better than Flynn Rider", and the scriptwriters are
(presumably deliberately) ambiguous as to whether she's putting quotes
around those names ("I prefer to call you Eugene than Flynn") or not
("I prefer the persona of Eugene to that of Flynn").

As long as the objects have useful reprs, you can get most of the
benefit of strings anyway - you can print them out and get an idea of
what they're all about, which UUIDs wouldn't give you. You might have
a collision of representation (if you have multiple annotizer
instances), or you might fall back on incorporating the id() in the
repr, but either way can't be worse than nothing.

ChrisA


More information about the Python-ideas mailing list