On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: > On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote:
> The problem with using lists is that its impossible for non-decorator > annotation consumers to know which element "belongs" to them. The ones whose type they own -- which is why I see at least some parallel to exceptions, and its inheritance based semantics. def f(a:[mytype("asdfljasdf"), zope.mypackage.something(b,d,e), "a string", mytype([47]), 15): """Example of long compound annotations Maybe annotations this size should just be restricted to Signature modification instead of allowing them in the actual declaration? At least by style guides? """ By the defined meaning of list, these are 5 independent annotations. Whoever defined mytype controls the meaning of the mytype annotations; anyone not familiar with that package should ignore them (and hope there were no side effects in the expressions that generated them). zope.mypackage controls that annotation; anyone not familiar with that product should ignore it (and hope there were no side effects ...) "a string" and 15 are builtin types -- so their semantics are defined by core python, which says that they are documentation only -- stripping them off or changing them wouldn't break a properly written program. > Here, multiple_annotations assumes that the annotation dicts are keyed > on consumer.__name__; Too many consumers will call themselves "wrapper" or some such. You should key on the actual type object -- in which case you probably want isinstance to support subtypes. -jJ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com