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/2004-March/043686.html below:

[Python-Dev] PEP 318: Set attribs with .name = value

[Python-Dev] PEP 318: Set attribs with .name = value [Python-Dev] PEP 318: Set attribs with .name = valueKa-Ping Yee python-dev at zesty.ca
Tue Mar 30 06:17:31 EST 2004
Someone suggested the following syntax for setting function attributes:

    def func(arg, arg):
        .author = 'Guido van Rossum'
        .version = 42

Guido replied that he wanted to reserve ".name = value" for use in
"with" blocks.

These two uses are not in conflict at all -- in fact, they are
perfectly compatible and i find the syntactic consistency elegant.

I think the above syntax for function metadata is by far the cleanest
and simplest method i have seen, and its meaning is the most obvious
of all the proposed syntaxes.  After "def func...: .version = 42" it
makes sense that func.version should equal 42.

I am also happy with the idea of "with":

    with some[long].expression:
        .attrib = .something + something

It all fits together beautifully.

    def func(arg, arg) [optimized, classmethod]:
        .author = 'Sir Galahad'
        .version = 42
        """Description."""
        code
        more code


-- ?!ng

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