On 5/3/2010 12:37 AM, Alf P. Steinbach wrote:
* Terry Reedy:
* Alf P. Steinbach:
* Aahz:
and sometimes
they rebind the original target to the same object.
At the Python level that seems to be an undetectable null-operation.
If you try t=(1,2,3); t[1]+=3, if very much matters that a rebin
Alf P. Steinbach wrote:
>
> >>> t = ([], [], [])
> >>> t
> ([], [], [])
> >>> t[0] += ["blah"]
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: 'tuple' object does not support item assignment
> >>> t
> (['blah'], [], [])
> >>> _
>
>
> Yep, it matters.
>
> Is this change
On Mon, 03 May 2010 06:37:49 +0200, Alf P. Steinbach wrote:
> * Terry Reedy:
>> * Alf P. Steinbach:
>>> * Aahz:
>>
and sometimes
they rebind the original target to the same object.
>>>
>>> At the Python level that seems to be an undetectable null-operation.
>>
>> If you try t=(1,2,3); t[
* Terry Reedy:
* Alf P. Steinbach:
* Aahz:
and sometimes
they rebind the original target to the same object.
At the Python level that seems to be an undetectable null-operation.
If you try t=(1,2,3); t[1]+=3, if very much matters that a rebind occurs.
Testing:
>>> t = ([], [], [])
>>>
In article ,
Jean-Michel Pichavant wrote:
>Jabapyth wrote:
>> At least a few times a day I wish python had the following shortcut
>> syntax:
>>
>> vbl.=func(args)
>>
>> this would be equivalent to
>>
>> vbl = vbl.func(args)
>>
>> example:
>>
>> foo = "Hello world"
>> foo.=split(" ")
>> print foo
On Sun, 02 May 2010 04:04:11 -0400, Terry Reedy wrote:
> On 5/2/2010 1:05 AM, Alf P. Steinbach wrote:
>> On 02.05.2010 06:06, * Aahz:
>
>>> and sometimes
>>> they rebind the original target to the same object.
>>
>> At the Python level that seems to be an undetectable null-operation.
>
> If you
On Sun, 02 May 2010 17:09:36 +1000, Lie Ryan wrote:
> On 05/02/10 10:58, Steven D'Aprano wrote:
>> On Sun, 02 May 2010 05:08:53 +1000, Lie Ryan wrote:
>>
>>> > On 05/01/10 11:16, Steven D'Aprano wrote:
>> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
>>
>> In practic
On Sun, 02 May 2010 16:28:28 +1000, Lie Ryan wrote:
> On 05/02/10 10:58, Steven D'Aprano wrote:
>>> > And Python's object system
>>> > makes it that the argument to __getattr__ is always a string even
>>> > though there might be a valid variable that corresponds to it:
>> That is nothing to do wit
On 5/2/2010 1:05 AM, Alf P. Steinbach wrote:
On 02.05.2010 06:06, * Aahz:
and sometimes
they rebind the original target to the same object.
At the Python level that seems to be an undetectable null-operation.
If you try t=(1,2,3); t[1]+=3, if very much matters that a rebind occurs.
Grant
On 05/02/10 10:58, Steven D'Aprano wrote:
> On Sun, 02 May 2010 05:08:53 +1000, Lie Ryan wrote:
>
>> > On 05/01/10 11:16, Steven D'Aprano wrote:
>>> >> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
>>> >>
>>> >> In practice though, I think that's a difference that makes no
>>> >> di
On 05/02/10 10:58, Steven D'Aprano wrote:
>> > And Python's object system
>> > makes it that the argument to __getattr__ is always a string even though
>> > there might be a valid variable that corresponds to it:
> That is nothing to do with the object system, it is related to the
> semantics of P
On Sat, May 1, 2010 at 10:05 PM, Alf P. Steinbach wrote:
> On 02.05.2010 06:06, * Aahz:
>> In article<4bdcd631$0$27782$c3e8...@news.astraweb.com>,
>> Steven D'Aprano wrote:
>>>
>>> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
The += family of operators really do rebind the symbo
On 02.05.2010 06:06, * Aahz:
In article<4bdcd631$0$27782$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
The += family of operators really do rebind the symbol, not modify the
object.
They potentially do both, depending on the object,
In article <4bdcd631$0$27782$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
>>
>> The += family of operators really do rebind the symbol, not modify the
>> object.
>
>They potentially do both, depending on the object, even for built-ins.
On May 1, 9:03 pm, Chris Rebert wrote:
> In both cases, __iOP__ operator methods are being used, not vanilla
> __OP__ methods, so neither of your examples are relevant to Mr.
> Chase's point.
Well, Tim's main assertion was: "The += family of operators really do
rebind the symbol, not modify the o
On Sat, 01 May 2010 19:03:04 -0700, Chris Rebert wrote:
> On Sat, May 1, 2010 at 6:32 PM, Steven D'Aprano
> wrote:
>> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
>>> This doesn't preclude you from implementing a self-mutating += style
>>> __add__ method and returning "self", but it's usu
On Sat, May 1, 2010 at 6:32 PM, Steven D'Aprano
wrote:
> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
>> This doesn't preclude you from implementing a self-mutating += style
>> __add__ method and returning "self", but it's usually a bad idea
>
> Obviously the Python dev team don't agree wi
On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote:
> On 05/01/2010 12:08 AM, Patrick Maupin wrote:
>> +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-
>> place operator methods, actually) *modify* the lhs object.
>>
>> Your proposed .= syntax conceptually *replaces* the lhs ob
On Sun, 02 May 2010 05:08:53 +1000, Lie Ryan wrote:
> On 05/01/10 11:16, Steven D'Aprano wrote:
>> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
>>
>> In practice though, I think that's a difference that makes no
>> difference. It walks like an operator, it swims like an operator, a
On Sun, 02 May 2010 05:08:53 +1000
Lie Ryan wrote:
> On 05/01/10 11:16, Steven D'Aprano wrote:
> > On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
> >
> > In practice though, I think that's a difference that makes no difference.
> > It walks like an operator, it swims like an operato
On May 1, 7:13 am, Tim Chase wrote:
> On 05/01/2010 12:08 AM, Patrick Maupin wrote:
>
> > +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-
> > place operator methods, actually) *modify* the lhs object.
>
> > Your proposed .= syntax conceptually *replaces* the lhs object
> > (act
On 05/01/10 11:16, Steven D'Aprano wrote:
> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
>
> In practice though, I think that's a difference that makes no difference.
> It walks like an operator, it swims like an operator, and it quacks like
> an operator.
>
Nope it's not. A ful
On 01.05.2010 14:13, * Tim Chase:
On 05/01/2010 12:08 AM, Patrick Maupin wrote:
+=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-
place operator methods, actually) *modify* the lhs object.
Your proposed .= syntax conceptually *replaces* the lhs object
(actually, rebinds the lhs
Tim Chase, 01.05.2010 14:13:
On 05/01/2010 12:08 AM, Patrick Maupin wrote:
+=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-
place operator methods, actually) *modify* the lhs object.
Your proposed .= syntax conceptually *replaces* the lhs object
(actually, rebinds the lhs symb
On 05/01/2010 12:08 AM, Patrick Maupin wrote:
+=, -=, /=, *=, etc. conceptually (and, if lhs object supports in-
place operator methods, actually) *modify* the lhs object.
Your proposed .= syntax conceptually *replaces* the lhs object
(actually, rebinds the lhs symbol to the new object).
The
Hay I got a better idea. If you put two dots (..) on a line by itself it
means
execute the previous line again!
On 1 May 2010 07:08, Patrick Maupin wrote:
> On Apr 30, 11:04 am, Jabapyth wrote:
> > At least a few times a day I wish python had the following shortcut
> > syntax:
> >
> > vbl.=func
On Apr 30, 11:04 am, Jabapyth wrote:
> At least a few times a day I wish python had the following shortcut
> syntax:
>
> vbl.=func(args)
>
> this would be equivalent to
>
> vbl = vbl.func(args)
>
> example:
>
> foo = "Hello world"
> foo.=split(" ")
> print foo
> # ['Hello', 'world']
>
> and I gues
On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote:
> I assume you mean the former to be analagous to "+=" and friends but I
> am not sure since "." isn't an operator.
It's a de facto operator. If you google on "python dot operator" you will
find many people who refer to it as such, and
On Fri, 30 Apr 2010 18:50:46 +0200, Jean-Michel Pichavant wrote:
> Jabapyth wrote:
>> At least a few times a day I wish python had the following shortcut
>> syntax:
>>
>> vbl.=func(args)
>>
>> this would be equivalent to
>>
>> vbl = vbl.func(args)
[...]
> Useless if you use meaningful names for yo
On Apr 30, 9:04 am, Jabapyth wrote:
> At least a few times a day I wish python had the following shortcut
> syntax:
>
> vbl.=func(args)
>
> this would be equivalent to
>
> vbl = vbl.func(args)
>
> example:
>
> foo = "Hello world"
> foo.=split(" ")
> print foo
> # ['Hello', 'world']
>
> and I guess
In article <87zl0klvki@castleamber.com>,
John Bokma wrote:
>
>Why I am asking this is that most "Oh, like Perl" statements I've seen
>the past months were made by people who either haven't used Perl
>themselves or have very little skill in the language.
What evidence do you have for your as
Chris Rebert writes:
> On Fri, Apr 30, 2010 at 10:05 AM, John Bokma wrote:
[..]
>> On top of that, it's not possible in Perl (heh, no surprise there). The
>> only thing that comes close is:
>
> Actually/ironically, it does appear to be in Perl 6:
> """
> Mutating method call
> $obj.=meth
>
On 05/01/10 02:50, Jean-Michel Pichavant wrote:
> Jabapyth wrote:
>> At least a few times a day I wish python had the following shortcut
>> syntax:
> currentCar = Car()
> currentCar = currentCar.nextCar
>
> The syntax you prose will be applicable on very little assignements (use
> case 3). I'm no
On Fri, 30 Apr 2010 12:05:49 -0500
John Bokma wrote:
> "D'Arcy J.M. Cain" writes:
> > so much clearer? Do you really want to see Python turn into Perl?
>
> Oh, boy, there we go again. Can you and your buddies please refrain from
> using Perl as a kind of uber-argument? Just write why you think
On Fri, Apr 30, 2010 at 10:05 AM, John Bokma wrote:
> "D'Arcy J.M. Cain" writes:
>> On Fri, 30 Apr 2010 09:04:59 -0700 (PDT)
>> Jabapyth wrote:
>>> foo = "Hello world"
>>> foo.=split(" ")
>>
>> Isn't;
>>
>> foo = "Hello world"
>> bar = foo.split() # side note - split() splits on whitespace by de
"D'Arcy J.M. Cain" writes:
> On Fri, 30 Apr 2010 09:04:59 -0700 (PDT)
> Jabapyth wrote:
>> foo = "Hello world"
>> foo.=split(" ")
>
> Isn't;
>
> foo = "Hello world"
> bar = foo.split() # side note - split() splits on whitespace by default
>
> so much clearer? Do you really want to see Python tu
Jabapyth wrote:
At least a few times a day I wish python had the following shortcut
syntax:
vbl.=func(args)
this would be equivalent to
vbl = vbl.func(args)
example:
foo = "Hello world"
foo.=split(" ")
print foo
# ['Hello', 'world']
and I guess you could generalize this to
vbl.=[some text]
Jabapyth wrote:
> At least a few times a day I wish python had the following shortcut
> syntax:
>
> vbl.=func(args)
>
> this would be equivalent to
>
> vbl = vbl.func(args)
>
> example:
>
> foo = "Hello world"
> foo.=split(" ")
> print foo
> # ['Hello', 'world']
Extending a language comes at
On Fri, 30 Apr 2010 09:04:59 -0700 (PDT)
Jabapyth wrote:
> foo = "Hello world"
> foo.=split(" ")
Isn't;
foo = "Hello world"
bar = foo.split() # side note - split() splits on whitespace by default
so much clearer? Do you really want to see Python turn into Perl?
However, if you really want to
J. Cliff Dyer, 30.04.2010 18:20:
On Fri, 2010-04-30 at 09:04 -0700, Jabapyth wrote:
At least a few times a day I wish python had the following shortcut
syntax:
vbl.=func(args)
this would be equivalent to
vbl = vbl.func(args)
example:
foo = "Hello world"
foo.=split(" ")
print foo
# ['Hello',
That's kind of a nifty idea. However, python is currently under a
syntax moratorium. No syntax changes will be accepted for at least 24
months starting from the release date of Python 3.1. See more details
here: http://www.python.org/dev/peps/pep-3003/
Cheers,
Cliff
On Fri, 2010-04-30 at 09:0
41 matches
Mail list logo