[Python-ideas] Object grabbing

Guido van Rossum guido at python.org
Tue May 3 10:44:37 EDT 2016

Thanks Robert for a crisp summary of the most reasonable proposal and its
ins and outs; I think the 'in' keyword and requiring leading dots are the
best version of all versions considered.

Thanks Stephen for concisely formulating the strongest argument against: it
gains too little over the alternative using existing syntax, and in fact
the alternative may be considered more readable (because more explicit).

I would now like to close the discussion with a rejection. This email can
be framed to celebrate that.


On Tue, May 3, 2016 at 1:11 AM, Stephen Hansen <me+python at ixokai.io> wrote:

> On Tue, May 3, 2016, at 12:21 AM, Robert van Geel wrote:
> > summarizing:
> >    1- the with statement should not be used for this
> with means something now. It shouldn't have two confusing meanings. All
> this discussion keeps using with when I hope that's a nonstarter.
> If people can get behind 'using' or 'in', I don't know, but 'with'
> should be absolutely out. With has a meaning in Python, a meaning which
> doesn't map readily into this space (where 'import x as y' and 'except
> Ex as y' do map readily, as its about renaming/aliasing)
> >    4- the benefits of .dotted shorthand syntax are disputed, some think
> > it's pythonic and readable, others don't think it is
> To call it disputed undersells the claim. I'd call it horribly
> unreadable. A dot is just shy of invisible on its own, a leading dot
> evaporates besides the tabbed whitespace. No, no, no.
> >    5 - Pascal style has been discussed in the past and has its own faq
> > explaining rejection. So anyway a dot would be needed, this would also
> > take away possible ambiguity between locals and object properties
> >
> > About 4, the argument that full variable writing is more explicit, hence
> > Pythonic: I think clinging to 20 same-indentation level references to
> > 'obj.' is explicit to the point of sillyness. We also dont use
> > locals.obj.x because the localness of a variable is also present without
> > explicity so a bit of pragmatism could have a voice. People who think
> > .dotted syntax is less readable could still use the familiar syntax.
> Again: no, no, no. Readability is more important then writability.
> "People who think .dotted syntax is less readable" need to be answered
> with a *serious* gain to override their objections. What does:
> using thing["this"]:
>     .that = "okay"
>     .other = "right"
> gain over
> t = thing["this"]
> t.that = "okay"
> t.other = "right"
> This feature is pure syntax sugar over local variables which are just
> fine as they are.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160503/ee82287b/attachment.html>

More information about the Python-ideas mailing list