[Python-ideas] Object grabbing

Robert van Geel robert at bign.nl
Tue May 3 03:21:24 EDT 2016

   1- the with statement should not be used for this
   2- I overrated the code optimization of this change, optimization is 
not sufficiently large and nothing that can't be done without this syntax
   3- picking a keyword would be non-trivial, 'using' has drawbacks, 
'in' might be a candidate (frankly I like it)
   4- the benefits of .dotted shorthand syntax are disputed, some think 
it's pythonic and readable, others don't think it is
   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. 
That would lead to two ways to do the same thing but on the same level 
as the type of decision as to whether to use a lambda or a full function.

In the end implementation of this proposal would offer syntactical sugar 
without added functionality, especially given point 2 above. That would 
make the feature as desirable as the number of happy eyebrows when 
looking at code like this:

in disussion:
   .arguments = [a, b, c]
   x = .eastheticfactor
.decision = .calculate(x)

On 5/3/2016 4:50 AM, python-ideas-request at python.org wrote:
> Send Python-ideas mailing list submissions to
> 	python-ideas at python.org
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://mail.python.org/mailman/listinfo/python-ideas
> or, via email, send a message with subject or body 'help' to
> 	python-ideas-request at python.org
> You can reach the person managing the list at
> 	python-ideas-owner at python.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-ideas digest..."
> Today's Topics:
>     1. Re: Object grabbing (Guido van Rossum)
>     2. Re: Object grabbing (Steven D'Aprano)
>     3. Re: Object grabbing (Jonathan Goble)
>     4. Re: Object grabbing (Bruce Leban)
> ----------------------------------------------------------------------
> Message: 1
> Date: Mon, 2 May 2016 18:47:00 -0700
> From: Guido van Rossum <guido at python.org>
> To: Joshua Morton <joshua.morton13 at gmail.com>
> Cc: "python-ideas at python.org" <python-ideas at python.org>
> Subject: Re: [Python-ideas] Object grabbing
> Message-ID:
> 	<CAP7+vJJ+P5N3ZLdRgZ3DEBkAGju9qHLjfMs3WmoXfQfpHkrpgQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> On Mon, May 2, 2016 at 6:43 PM, Joshua Morton <joshua.morton13 at gmail.com>
> wrote:
>> Which actually makes the specific syntax of a bare `with` a strong -1 now,
>> since mixing it with normal context managers is incredibly ambiguous.
> I'm glad you eventually reached this conclusion.

More information about the Python-ideas mailing list