Steven D'Aprano writes:
> I'm not sure that I understand your example here. Or rather, I
> understand your example, I don't understand why you think it disputes my
> comment above. Your example uses the list repetition operator, which
> returns a list; it is neither something that returns a
On 30/09/2020 19:02, Steven D'Aprano wrote:
But more importantly, unless the right hand side is severely limited, it
is going to be very hard to be unambiguous. The standard augmented
assignments take *any expression at all* for the right hand side:
value += 2*x - y
but this could not:
On Fri, Oct 02, 2020 at 11:49:02AM +0900, Stephen J. Turnbull wrote:
> -1 for various reasons expressed by several authors. But I'm not sure
> I agree with this:
>
> Steven D'Aprano writes:
>
> > I think this might make good sense for string methods:
> >
> > mystring = mystring.upper()
>
-1 for various reasons expressed by several authors. But I'm not sure
I agree with this:
Steven D'Aprano writes:
> I think this might make good sense for string methods:
>
> mystring = mystring.upper()
> mystring .= upper()
>
> but less so for arbitrary objects with methods retur
On Wed, Sep 30, 2020 at 7:30 PM Greg Ewing
wrote:
> On 1/10/20 4:25 pm, David Mertz wrote:
> > In all the years I've used and taught namedtuples, I think I've never
> > used the ._replace() method. The leading underscore is a hint that the
> > method is "private"
>
> Usually that would be true,
On 1/10/20 4:25 pm, David Mertz wrote:
In all the years I've used and taught namedtuples, I think I've never
used the ._replace() method. The leading underscore is a hint that the
method is "private"
Usually that would be true, but namedtuple is a special case. The
docs make it clear that the
On 2020-09-30 13:42, David Mertz wrote:
-1.
Fluent programming is uncommon in Python, and hence few methods return a
call of the same or similar type. Methods on strings are an exception
here, but they are unusual (partly because strings are immutable).
This argument is mentioned a lot on her
On Wed, Sep 30, 2020 at 4:24 PM Ben Rudiak-Gould
wrote:
> On Wed, Sep 30, 2020 at 1:43 PM David Mertz wrote:
>
>> Fluent programming is uncommon in Python, and hence few methods return a
>> call of the same or similar type.
>>
>
> I think that if you include built-in operators as (shorthand for)
On Wed, Sep 30, 2020 at 1:43 PM David Mertz wrote:
> Fluent programming is uncommon in Python, and hence few methods return a
> call of the same or similar type.
>
I think that if you include built-in operators as (shorthand for) method
calls, and you count the number of occurrences in typical P
If I can, I want to back up the conversation a bit. Instead of starting
with a solution, what's the problem?
I believe the issue that this is trying to solve is that some functions
that operate on an object return a new object, and we would like to use
them to modify an object. Setting aside the f
-1.
Fluent programming is uncommon in Python, and hence few methods return a
call of the same or similar type. Methods on strings are an exception here,
but they are unusual (partly because strings are immutable).
Methods in Python tend to do one of two things:
1. Mutate in place, returning None
The dot has recently been used a lot
kotlin:
for loop 0..9
Js:
...array
.= seems cool enough
Btw i saw this on Kotlin's doc, the first time i see a direct reference
from one 'recent' language concerning another.
Kotlin's loops are similar to Python's. for iterates over anything that is
*iter
On Wed, 30 Sep 2020 at 20:02, Steven D'Aprano wrote:
> There's also the factor that the dot operator is not very visually
> distinctive.
I completely agree.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-
On Thu, Oct 01, 2020 at 04:02:20AM +1000, Steven D'Aprano wrote:
> Hi Konatan, welcome! Comments below.
Oh I'm very sorry, that was a typo, I meant Jonatan.
--
Steve
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email
Hi Konatan, welcome! Comments below.
On Wed, Sep 30, 2020 at 06:41:04PM +0300, Jonatan wrote:
[...]
> it would be nice if you could implement also __igetattr__ or something,
> which means:
>
> instead of
> con = "some text here"
> con = con.replace("here", "there")
>
> we could do
>
> con = "
On 2020-09-30 08:41, Jonatan wrote:
instead of
con = "some text here"
con = con.replace("here", "there")
we could do
con = "some text here"
con .= replace("here", "there")
(Your message had some odd formatting but thankfully there was a plain-text
version included without the issue.)
I
16 matches
Mail list logo