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
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
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
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
I know, I was just referring to making this a standard python function with
*args, **kwargs. This PEP only solves one specific problem (keyword arguments),
while it seems like it would be worth while solving all of them (no arguments,
tuple vs. list, and having to learn a special one-off syntax
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
-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
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
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
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.)
Hi, My name is Jonatan and i am programming in Python for about 4 years,
I have a great idea, there are iX` methods, such as __ior__, __iadd__,
__iand__ etc.., which implements the |=, +=, &= behavior,
it would be nice if you could implement also __igetattr__ or something,
which means:
instead of
I'm pleased to announce v0.0.2 of my kwkeys package.
https://pypi.org/project/kwkey/
The main new feature is items-key duality. Based on that, it emulates the
semantics proposed by D'Aprano and van Rossum. It also emulates the
semantics proposed by myself.
What does this mean? Here, by duality I
Would it help if ‘__abstractmethods__’ was documented, overruling whatever
the PEP says?
On Wed, Sep 30, 2020 at 00:01 Ben Avrahami wrote:
> I encountered this problem when I needed to implement a class that defined
> all 4 of the comparison operators, once with `dataclass` (for one
>
On Wed, Sep 30, 2020 at 2:44 AM Steven D'Aprano wrote:
> On Sun, Sep 27, 2020 at 07:59:18AM -0300, Sebastian Kreft wrote:
>
> > Hi Steven, could you share some examples of what you have in mind.
> Having a
> > more concrete example of an API that would benefit from
> mixed-subscripting
> > would
On Tue, 29 Sep 2020 at 22:31, wrote:
> Furthermore, you currently can't tell the difference between `x[(a, b)]` and
> `x[a, b]`; with the new function, libraries could differentiate, and maybe
> eventually make them behave reasonably (you can always use x[*c] if you
> already have a tuple,
On Wed, 30 Sep 2020 at 06:44, Steven D'Aprano wrote:
> matrix[3, 4] # unambiguously a cell reference
> matrix[3] # ambiguous, forbidden
> matrix[3, axis='row'] # unambiguously a row
> matrix[3, axis='col'] # unambiguously a column
I guess everybody
I encountered this problem when I needed to implement a class that defined
all 4 of the comparison operators, once with `dataclass` (for one
implementation) and once with `total_order` (for another).Also, 3rd party
libs are expected to fall down this rabbit hole, and unless they're
expected to
On Mon, Sep 28, 2020 at 08:19:01PM -0700, Ben Rudiak-Gould wrote:
> Maybe a singleton that supported no useful operations, not even __eq__ or
> __bool__, would be sufficiently inconvenient that it would only be used for
> defaults and "is" tests for said defaults.
NotImplemented is halfway
21 matches
Mail list logo