On Thu, Oct 14, 2021 at 8:04 AM Oscar Benjamin
wrote:
>
> On Wed, 13 Oct 2021 at 18:30, Chris Angelico wrote:
> >
> > On Thu, Oct 14, 2021 at 1:36 AM Oscar Benjamin
> > wrote:
> > > Your suggestion is that this is a bug in map() which is a fair
> > > alternative view. Following through to its co
13.10.21 22:03, Marc-Andre Lemburg пише:
> Some examples:
> - removal of file extensions
> - removal of end tags
> - removal of units
> - removal of currencies
> - removal of standard suffixes
> - removal of wildcard patterns
> etc.
>
> I find lots of such uses in the code bases I work with.
I di
On Wed, 13 Oct 2021 at 18:30, Chris Angelico wrote:
>
> On Thu, Oct 14, 2021 at 1:36 AM Oscar Benjamin
> wrote:
> > Your suggestion is that this is a bug in map() which is a fair
> > alternative view. Following through to its conclusion your suggestion
> > is that every possible function like map
I find myself using exactly that "picture of the data" approach informally
for code I don't plan on formally type checking (but want to show intent).
E.g.
def myfun(data: {str: [CustomType]}) -> [(int, OtherType)]: ...
Maybe it's a bad habit, but it feels easier to parse visually than the real
`
13.10.21 22:53, Peter Ludemann пише:
> [*] Floating point x+y isn't always y+x, but floating point is its own
> problematic world.
AFAIK floating point x+y is always y+x, but (x+y)+z is not always x+(y+z).
___
Python-ideas mailing list -- python-ideas@
Hello,
Today I found myself write a function that returns a tuple of list of list of
strings (tuple[list[list[str]], list[list[str]]]). Wouldn’t it easier to read
to write it like the following:
([[str]], [[str]])?
Similarly for TypedDict, replace the following..
class Movie(TypedDict):
na
MRAB wrote:
> From a mathematical point of view, x-y is equivalent to x+(-y).
>From a mathematical point of view, x+y is equivalent to y+x, but I suppose
>that ship has sailed a long long time ago. ("++", "--", etc. would have been
>better choices for operators)[*]
Anyway, if you're going to a
On 13.10.2021 20:47, Paul Moore wrote:
> On Wed, 13 Oct 2021 at 19:02, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
>> So aside from filename extensions, what are the real use cases for
>> suffix removal? Plurals? No, too locale-dependent and too many
>> exceptions. Whitespace left over from e
On Wed, 13 Oct 2021 at 19:02, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> So aside from filename extensions, what are the real use cases for
> suffix removal? Plurals? No, too locale-dependent and too many
> exceptions. Whitespace left over from external data? No, there's
> already other fun
Greetings list,
Looking at the examples, I'm not sure how well this would play out
in the context of just using variables, though:
s = a - s
s = a / c
s = a ~ p
By adding such operators we could potentially make math functions
compatible with strings by the way of duck typing, giving some
really
On 2021-10-14 at 04:34:24 +1100,
Chris Angelico wrote:
> On Thu, Oct 14, 2021 at 2:21 AM <2qdxy4rzwzuui...@potatochowder.com> wrote:
> >
> > On 2021-10-14 at 00:00:25 +0900,
> > "Stephen J. Turnbull" wrote:
> >
> > > Chris Angelico writes:
> > >
> > > > +1, although it's debatable whether it sh
On Thu, Oct 14, 2021 at 2:21 AM <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2021-10-14 at 00:00:25 +0900,
> "Stephen J. Turnbull" wrote:
>
> > Chris Angelico writes:
> >
> > > +1, although it's debatable whether it should be remove suffix or
> > > remove all. I'd be happy with either.
> >
On Thu, Oct 14, 2021 at 1:36 AM Oscar Benjamin
wrote:
> Your suggestion is that this is a bug in map() which is a fair
> alternative view. Following through to its conclusion your suggestion
> is that every possible function like map, filter, and all the iterator
> implementations in itertools and
On 2021-10-13 16:26, Marc-Andre Lemburg wrote:
On 13.10.2021 17:11, Guido van Rossum wrote:
Maybe we should only accept operators as aliases for existing methods.
x-y could mean x.removesuffix(y)
That was the idea, yes, in particular to make it similar to "+",
which adds to the end of the str
On 13.10.2021 17:11, Guido van Rossum wrote:
> Maybe we should only accept operators as aliases for existing methods.
>
> x-y could mean x.removesuffix(y)
That was the idea, yes, in particular to make it similar to "+",
which adds to the end of the string, so that:
s = x - oldend + newend
works
On 2021-10-14 at 00:00:25 +0900,
"Stephen J. Turnbull" wrote:
> Chris Angelico writes:
>
> > +1, although it's debatable whether it should be remove suffix or
> > remove all. I'd be happy with either.
>
> If by "remove all" you mean "efefef" - "ef" == "", I think that's a
> footgun. Similarl
On Wed, Oct 13, 2021, 11:01 AM Stephen J. Turnbull <
stephenjturnb...@gmail.com> wrote:
Chris Angelico writes:
> +1, although it's debatable whether it should be remove suffix or
> remove all. I'd be happy with either.
If by "remove all" you mean "efefef" - "ef" == "", I think that's a
footgun
Maybe we should only accept operators as aliases for existing methods.
x-y could mean x.removesuffix(y)
I don't think x~y is intuitive enough to use.
On Wed, Oct 13, 2021 at 8:03 AM Stephen J. Turnbull <
stephenjturnb...@gmail.com> wrote:
> Chris Angelico writes:
>
> > +1, although it's debata
Chris Angelico writes:
> +1, although it's debatable whether it should be remove suffix or
> remove all. I'd be happy with either.
If by "remove all" you mean "efefef" - "ef" == "", I think that's a
footgun. Similarly for "efabcd" - "ef" == "abcdef" - "ef".
Steve
___
On Tue, 12 Oct 2021 at 12:50, Chris Angelico wrote:
>
> On Tue, Oct 12, 2021 at 10:24 PM Oscar Benjamin
> wrote:
> >
> > On Tue, 12 Oct 2021 at 11:48, Chris Angelico wrote:
> >>
> >> ValueError is no safer. The first() function would have, as its API,
> >> "returns the first element or raises Va
On Wed, Oct 13, 2021 at 7:57 PM Marc-Andre Lemburg wrote:
>
> The idea to use "-" in the context of strings may have some
> merrit. Not as unary minus, but as sequence operation and
> shorthand for str.removesuffix(x):
>
> s = 'abc' + 'def' - 'ef' + 'gh'
>
> giving
>
> s == 'abcdgh'
>
> Removing s
The idea to use "-" in the context of strings may have some
merrit. Not as unary minus, but as sequence operation and
shorthand for str.removesuffix(x):
s = 'abc' + 'def' - 'ef' + 'gh'
giving
s == 'abcdgh'
Removing suffixes from strings is a rather common operation.
Removing prefixes is common
13.10.21 03:10, Jelle Zijlstra пише:
> To get a new operator on a builtin type, you'll have to show that:
> - It's a common operation;
> - There's no convenient way to do it already; and
> - The meaning of the operator is reasonably clear to a reader of the code.
>
> Recent examples of new feature
13.10.21 03:05, MarylandBall Productions пише:
> I would think `~string` could be good for a shorthand way to convert a string
> to an integer, considering you’re “inverting” the string to another type,
> though a downside to this would be that explicit is always better than
> implicit and ~stri
24 matches
Mail list logo