A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052161.html below:

[Python-Dev] (no subject)

[Python-Dev] (no subject)Michael Chermside mcherm at mcherm.com
Mon Mar 14 14:34:57 CET 2005
Nick Coghlan writes:

> Patch against current CVS added to SF with the behaviour:
>
>    def update_meta(self, other):
>      self.__name__ = other.__name__
>      self.__doc__ = other.__doc__
>      self.__dict__.update(other.__dict__)

Nice... thanks. But I have to ask: is this really the right set of metadata to
be updating? Here are a few things that perhaps ought be copied by update_meta:

    f.__name__     (already included)
    f.__doc__      (already included)
    f.__dict__     (already included)
    f.__module__   (probably should include)
    f.func_code.co_filename     (to match f.__name__, but I'd leave it alone)

there's also the annoying fact that in IDLE (and in some other python-aware
IDEs) one can see the argument signature for a function as a "tool tip"
or other hint. Very handy that, but if a decorator is applied then all
you will see is "func(*args, **kwargs)" which is less than helpful. I'm
not sure whether this CAN be duplicated... I believe it is generated by
examining the following:

    f.func_code.co_argcount
    f.func_code.co_varnames
    f.func_code.co_flags & 0x4
    f.func_code.co_flags & 0x8

...and I suspect (experimentation seems to confirm this) that if you mangle
these then the code object won't work correctly. If anyone's got a
suggestion for fixing this, I'd love to hear it.

-- Michael Chermside

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4