On 03/28/2015 11:43 AM, Steven D'Aprano wrote:
> On Sat, 28 Mar 2015 08:53 pm, Steven D'Aprano wrote:
>
>
>> It saves typing. It might even allow a micro-optimization in the generated
>> bytecode (see below).
> Oops, I forgot to include the "see below" bit.
>
> Comparing
>
> a = a.spam()
>
> a .=
On 2015-03-28, Rustom Mody wrote:
> Dunno if related...
> One thing that is a bit laborious in python are object initializers:
>
> self.attr1 = field1
> self.attr2 = field2
Vim's "visual block" feature is your friend in such cases... Pretty sure
that other editors have something equivalent, t
On Sunday, March 29, 2015 at 9:47:00 AM UTC+5:30, Ian wrote:
> On Sat, Mar 28, 2015 at 9:05 AM, Mario Figueiredo wrote:
> > Neiter the language. The dot symbol is a delimiter in the python
> > grammar. Not an operator. And also defined as a delimiter in the
> > official documentation, right after o
On Sat, Mar 28, 2015 at 9:05 AM, Mario Figueiredo wrote:
> Neiter the language. The dot symbol is a delimiter in the python
> grammar. Not an operator. And also defined as a delimiter in the
> official documentation, right after operators.
What does it matter? How '.' is lexed when it appears on
Sounds like you want to implement nim special dot syntax in python.
http://nim-lang.org/manual.html#special-operators
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, March 28, 2015 at 9:51:50 PM UTC+5:30, Rustom Mody wrote:
> So if the VB model is followed, it is purely a syntactic (ie not type-related)
> question whether an identifier is an adorned variable or an attribute of
> something else. The preceding dot is the disambiguator.
Uh... UN-ado
On Saturday, March 28, 2015 at 11:56:39 AM UTC+5:30, Steven D'Aprano wrote:
> On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote:
>
> > One thing that is a bit laborious in python are object initializers:
> >
> > self.attr1 = field1
> > self.attr2 = field2
> >
> > In VB one can do:
> >
> > with se
On Sat, 28 Mar 2015 13:38:20 +, BartC wrote:
>
>(I'm not sure how this all applies to the loop_node.next example, but
>even here I don't count the "." as an operator, but syntax.
Neiter the language. The dot symbol is a delimiter in the python
grammar. Not an operator. And also defined as a
On 28/03/2015 12:58, Steven D'Aprano wrote:
On Sat, 28 Mar 2015 11:26 pm, Mark Lawrence wrote:
On 28/03/2015 06:26, Steven D'Aprano wrote:
Pascal is another language with a construct like that, and there's a FAQ
for it:
https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-w
On 28/03/2015 09:53, Steven D'Aprano wrote:
On Sat, 28 Mar 2015 10:08 am, BartC wrote:
An alternate syntax might be:
hello = .string()
That should have been .strip()
loop_node =. next
Why propose that?
Every other augmented assignment has the operator on the left hand side of
the
On Sat, 28 Mar 2015 11:26 pm, Mark Lawrence wrote:
> On 28/03/2015 06:26, Steven D'Aprano wrote:
>>Pascal is another language with a construct like that, and there's a FAQ
>>for it:
>>
>>
https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments
On 28/03/2015 06:26, Steven D'Aprano wrote:
On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote:
One thing that is a bit laborious in python are object initializers:
self.attr1 = field1
self.attr2 = field2
In VB one can do:
with self
.attr1 = field1
.attr2 = field2
(or something like that -- do
On Sat, 28 Mar 2015 08:53 pm, Steven D'Aprano wrote:
> It saves typing. It might even allow a micro-optimization in the generated
> bytecode (see below).
Oops, I forgot to include the "see below" bit.
Comparing
a = a.spam()
a .= spam()
the Python compiler could perhaps optimize the second
On Sat, 28 Mar 2015 07:48 am, Ian Kelly wrote:
> On Fri, Mar 27, 2015 at 2:24 PM, Jamie Willis
> wrote:
>> I would like to propose a new piece of syntax for the python language; .=
>>
>> In short, the operator is form of syntactic sugar, for instance consider
>> the following code:
>>
>> hello =
On Sat, 28 Mar 2015 10:08 am, BartC wrote:
> An alternate syntax might be:
>
> hello = .string()
> loop_node =. next
Why propose that?
Every other augmented assignment has the operator on the left hand side of
the equals. Greater-than, less-than, and not-equal all have the symbol on
the lef
On Sat, Mar 28, 2015 at 5:26 PM, Steven D'Aprano
wrote:
> On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote:
>
>> One thing that is a bit laborious in python are object initializers:
>>
>> self.attr1 = field1
>> self.attr2 = field2
>>
>> In VB one can do:
>>
>> with self
>> .attr1 = field1
>> .attr2
On Sat, 28 Mar 2015 03:18 pm, Rustom Mody wrote:
> One thing that is a bit laborious in python are object initializers:
>
> self.attr1 = field1
> self.attr2 = field2
>
> In VB one can do:
>
> with self
> .attr1 = field1
> .attr2 = field2
>
> (or something like that -- dont exactly remember the
On Saturday, March 28, 2015 at 6:26:26 AM UTC+5:30, Ian wrote:
> On Fri, Mar 27, 2015 at 6:33 PM, Mario Figueiredo wrote:
> > On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney wrote:
> >
> >>Jamie Willis writes:
> >>
> >>> This could be written as:
> >>>
> >>> hello = "hello world "
> >>
On Fri, Mar 27, 2015 at 6:33 PM, Mario Figueiredo wrote:
> On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney
> wrote:
>
>>Jamie Willis writes:
>>
>>> This could be written as:
>>>
>>> hello = "hello world "
>>> hello .= strip()
>>
>>?1, “.=” is visually too similar to “=”.
>
> can't be
On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney
wrote:
>Jamie Willis writes:
>
>> This could be written as:
>>
>> hello = "hello world "
>> hello .= strip()
>
>?1, .= is visually too similar to =.
can't be much worse than
hello = "hello world",
I think the dot next to
Jamie Willis writes:
> This could be written as:
>
> hello = "hello world "
> hello .= strip()
−1, “.=” is visually too similar to “=”.
Syntax that is ambiguous at a glance is a cost when reading, and here I
think the cost is great.
> In this slightly contrived example, the progra
On 27/03/2015 20:48, Ian Kelly wrote:
On Fri, Mar 27, 2015 at 2:24 PM, Jamie Willis
wrote:
I would like to propose a new piece of syntax for the python language; .=
In short, the operator is form of syntactic sugar, for instance consider the
following code:
hello = "hello world "
Interesting concept. I suppose it offers some small optimization
opportunities, and clearly saves some possibly error-prone typing. You
construct the object on the left-hand side, then just DUP_TOP to get its
use on the RHS.
A couple comments though:
* "dot" is pretty invisible unless surrounded
On Fri, Mar 27, 2015 at 2:24 PM, Jamie Willis
wrote:
> I would like to propose a new piece of syntax for the python language; .=
>
> In short, the operator is form of syntactic sugar, for instance consider the
> following code:
>
> hello = "hello world "
> hello = hello.strip()
>
> Th
I would like to propose a new piece of syntax for the python language; .=
In short, the operator is form of syntactic sugar, for instance consider
the following code:
hello = "hello world "
hello = hello.strip()
This could be written as:
hello = "hello world "
hello .=
25 matches
Mail list logo