[Python-ideas] Re: @lazy decorator an alternative to functools.partial ?

2023-05-13 Thread Lucas Wiman
Seems fine, but a pypi library seems better than the standard library. Separately, I think this is usually called "currying", and there are already libraries which implement this functionality, eg toolz: https://toolz.readthedocs.io/en/latest/curry.html Best wishes, L

[Python-ideas] Re: Auto dedent -c arguments.

2023-04-05 Thread Lucas Wiman
On Tue, Apr 4, 2023 at 7:19 AM Jonathan Crall wrote: > Would there be any downside to the Python CLI automatically dedenting the > input string given to -c? I can't think of any case off the top of my head > where it would make a previously valid program invalid. Unless I'm missing > something

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-03-01 Thread Lucas Wiman
ithub.com/Snaipe/BoxFort) Presumably web browsers like Chrome have some prior art as well. Best wishes, Lucas Wiman ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.or

[Python-ideas] Call functools.update_wrapper on Mock(wraps=func)

2022-12-30 Thread Lucas Wiman
ython/blob/f4fcfdf8c593611f98b9358cc0c5604c15306465/Lib/unittest/mock.py#L1107 Does anyone see any problems with implementing this? Thanks & best wishes, Lucas Wiman ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-20 Thread Lucas Wiman
On Tue, Dec 20, 2022 at 5:38 PM Christopher Barker wrote: > But collections.UserString does exist -- so if you want to subclass, and > performance isn't critical, then use that. Steven A pointed out that > UserStrings are not instances of str though. I think THAT is a bug. And > it's probably

[Python-ideas] Re: PEP Idea: native f-string support as a match pattern

2022-08-23 Thread Lucas Wiman
atements much easier: see https://www.dropbox.com/s/w1bs8ckekki9ype/PyITPatternMatchingTalk.pdf?dl=0 and https://twitter.com/i/web/status/1533369943764488192 Best wishes, Lucas Wiman ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Void type

2022-07-27 Thread Lucas Wiman
On Wed, Jul 27, 2022 at 1:07 PM Chris Angelico wrote: > with all the variants of keyword and positional args. Being able to > say "this function has the same signature as that one, plus it accepts > consumed_arg" or "same, but without added_arg" would be extremely > useful, and short of some

[Python-ideas] Re: Void type

2022-07-27 Thread Lucas Wiman
Михаил Крупенков: > Yes, I want that when Void is received in a function parameter it is not processed: > > func(Void) == func() == "default" Mathew Elman: > I believe this is a rebirth of a request that has come up many times before, which is to have something like javascript's `undefined` where

[Python-ideas] Re: Bare wildcard in de-structuring to ignore remainder and stop iterating (restart)

2022-06-20 Thread Lucas Wiman
Some background. PEP 3132 (https://peps.python.org/pep-3132/) lists the following: > > Possible changes discussed were: > > >- Only allow a starred expression as the last item in the exprlist. >This would simplify the unpacking code a bit and allow for the starred >expression to be

[Python-ideas] Add tz argument to date.today()

2022-06-19 Thread Lucas Wiman
Since "today" depends on the time zone, it should be an optional argument to date.today(). The interface should be the same as datetime.now(tz=None), with date.today() returning the date in the system time zone. Rationale: It is common for processes to run in different timezones than the relevant

[Python-ideas] Re: Bare wildcard in de-structuring to ignore remainder and stop iterating (restart)

2022-06-19 Thread Lucas Wiman
> > "Self-explanatory". This is how we got Perl and APL o_O What I mean is that if you already know the destructuring syntax, then it’s pretty clear what it means. If you already know existing syntax, / isn’t suggesting of anything. The only related syntax is for declaring positional-only

[Python-ideas] Re: Bare wildcard in de-structuring to ignore remainder and stop iterating (restart)

2022-06-19 Thread Lucas Wiman
Using either * or / could lead to some odd inconsistencies where a missing space is very consequential, eg: x, / = foo # fine x, /= foo # syntax error? x / = foo # syntax error x /= foo # fine, but totally different from the first example. That said, the * syntax feels intuitive in a way that

[Python-ideas] Re: Add a line_offsets() method to str

2022-06-18 Thread Lucas Wiman
ion. Best wishes, Lucas Wiman On Fri, Jun 17, 2022 at 1:12 PM Jonathan Slenders wrote: > Hi everyone, > > Today was the 3rd time I came across a situation where it was needed to > retrieve all the positions of the line endings (or beginnings) in a very > long python string as effic

Re: [Python-ideas] Add MutableSet.update?

2018-03-10 Thread Lucas Wiman
On Fri, Mar 9, 2018 at 6:24 PM, MRAB wrote: > On 2018-03-10 01:15, Guido van Rossum wrote: > >> Yes, you can use the |= operator instead. >> >> |= is not quite the same as .update because it rebinds, so if the name on > the LHS isn't local it'll raise NameError. > >

[Python-ideas] Add MutableSet.update?

2018-03-09 Thread Lucas Wiman
shes, Lucas Wiman ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Add a module itertools.recipes

2017-10-13 Thread Lucas Wiman
On Fri, Oct 13, 2017 at 11:35 AM, Chris Angelico wrote: > On Sat, Oct 14, 2017 at 5:16 AM, Antoine Rozo > wrote: > [...] > Can we consider making itertools a package and adding a module > > itertools.recipes that implements all these utilility

Re: [Python-ideas] Hexadecimal floating literals

2017-09-21 Thread Lucas Wiman
On Thu, Sep 21, 2017 at 8:23 AM, Victor Stinner wrote: > While I was first in favor of extending the Python syntax, I changed > my mind. Float constants written in hexadecimal is a (very?) rare use > case, and there is already float.fromhex() available. > > A new syntax

Re: [Python-ideas] LOAD_NAME/LOAD_GLOBAL should be use getattr()

2017-09-13 Thread Lucas Wiman
On Wed, Sep 13, 2017 at 11:55 AM, Serhiy Storchaka wrote: > [...] Calling __getattr__() will slow down the access to builtins. And > there is a recursion problem if module's __getattr__() uses builtins. > The first point is totally valid, but the recursion problem doesn't

Re: [Python-ideas] "any" and "all" support multiple arguments

2017-08-01 Thread Lucas Wiman
On Tue, Aug 1, 2017 at 6:01 AM, Louie Lu wrote: > [...] > I'm not sure if this is discuss before, but can "any" and "all" > support like min_max "arg1, arg2, *args" style? > Can this be done consistently? For example consider x=[[]]. Then all(x) where x is interpreted as an

Re: [Python-ideas] namedtuple literals [Was: RE a new namedtuple]

2017-07-20 Thread Lucas Wiman
On Thu, Jul 20, 2017 at 5:19 AM, Victor Stinner wrote: > For me, namedtuple was first used to upgrade an old API from returning a > tuple to a "named" tuple. There was a hard requirement on backward > compatibility: namedtuple API is a superset of the tuple API. > > For

Re: [Python-ideas] Runtime types vs static types

2017-07-02 Thread Lucas Wiman
On Sun, Jul 2, 2017 at 4:54 AM, Steven D'Aprano wrote: > I think that the current status is that the MyPy folks, including Guido, > consider that it *is* reasonable to ask these questions for the purpose > of introspection, but issubclass and isinstance are not the way to do

Re: [Python-ideas] Runtime types vs static types

2017-06-25 Thread Lucas Wiman
e typing repo itself. Apologies for the digression. - Lucas On Sun, Jun 25, 2017 at 11:13 AM, Koos Zevenhoven <k7ho...@gmail.com> wrote: > On Sun, Jun 25, 2017 at 8:47 PM, Lucas Wiman <lucas.wi...@gmail.com> > wrote: > >> > ​Yes, but then `isinstance(tuple(range(100

Re: [Python-ideas] Runtime types vs static types

2017-06-25 Thread Lucas Wiman
ing to do with speed. - Lucas On Sun, Jun 25, 2017 at 10:11 AM, Koos Zevenhoven <k7ho...@gmail.com> wrote: > On Sun, Jun 25, 2017 at 7:13 PM, Lucas Wiman <lucas.wi...@gmail.com> > wrote: > [...] > >> >>> from typing import * >> >>> isinstance(

Re: [Python-ideas] Runtime types vs static types

2017-06-25 Thread Lucas Wiman
momura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone > elsehttp://refi64.com > > On Jun 25, 2017 at 8:11 AM, > wrote: > > On Sat, Jun 24, 2017 at 11:30 PM, Lucas Wiman <lucas.wi...@gmail.com> > wrote: > >> ​ >> On Sat, Jun 24, 2017 at 1

Re: [Python-ideas] Dictionary destructing and unpacking.

2017-06-08 Thread Lucas Wiman
> > Maps with a known, fixed set of keys are relatively uncommon > in Python, though. This is false in interacting with HTTP services, where frequently you're working with deserialized JSON dictionaries you expect to be in a precise format (and fail if not). On Wed, Jun 7, 2017 at 11:32 PM,

Re: [Python-ideas] Defer Statement

2017-06-04 Thread Lucas Wiman
I agree that the stated use cases are better handled with ExitStack. One area where `defer` might be useful is in lazy-evaluating global constants. For example in a genomics library used at my work, one module involves compiling a large number of regular expressions, and setting them as global

Re: [Python-ideas] π = math.pi

2017-06-01 Thread Lucas Wiman
I like the aesthetic of the idea, but it seems like this would be a better fit in a library namespace like sympy or jupyter. On Thu, Jun 1, 2017 at 12:19 AM, Sven R. Kunze wrote: > On 01.06.2017 08:47, Serhiy Storchaka wrote: > > What you are think about adding Unicode aliases