>
> And now Lisp bites me, because '::a' means ...
>

And a single colon also means something else in Lisp.
Does it matter much what that notation means in a different language?
Python will struggle to evolve if it can't conflict with other languages.

I myself am rarely annoyed by this issue, with
> the single exception of "self.foo = foo" in __init__() defs (which
> can't be handled by these notations).
>

It can be handled:

```
self.__dict__.update(**, foo, bar, spam)
```

or

```
self.__dict__.update({::foo, ::bar, ::spam})
```

Alternatively, this is a utility function that I use sometimes:

```
def setattrs(obj, **kwargs):
    """
    >>> data = SimpleNamespace()
    >>> setattrs(data, a=1, b=2)  # doctest:+ELLIPSIS
    namespace(a=1, b=2)
    """
    for key, value in kwargs.items():
        setattr(obj, key, value)
    return obj
```

And here is some actual code of mine using it:

```
    setattrs(cls,
             text=text,
             program=program,
             messages=messages,
             hints=hints)
```

which could instead be written

```
setattrs(cls, **, text, program, messages, hints)
```
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/Q4GF53QE4TFAVNODGS77UN6C5SWXIS6I/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to