[Python-ideas] Re: Fwd: [Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread David Mertz, Ph.D.
This is indeed largely the same motivation as PEP 661, which I supported when raised, but got no clear consensus. "Missing" is definitely a family of related sentinels, although sentinels are more general. On Thu, Oct 21, 2021, 10:15 PM Doug Swarin wrote: > I think this is a really good and int

[Python-ideas] Re: Fwd: [Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread Thomas Mc Kay
Sorry I posted a bit fast, my two example above should read: class Foo: def __init__(self, bar=42, baz=None): self.bar = bar self.baz = baz # def do_something(self, bar_override=None, baz_override=None) ... And the second one: class Missing: pass MISSING =

[Python-ideas] Re: Fwd: [Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread Doug Swarin
I think this is a really good and interesting idea. I do have one question - how would you envision this interacting with the sentinel values from PEP 661 (https://www.python.org/dev/peps/pep-0661/) ? Could 'Tagged None' and sentinel values be the same thing? Thanks, Doug __

[Python-ideas] Re: Fwd: [Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread Thomas Mc Kay
+1 for me on the usefulness of having a way to express "Missing Data". One common use-case I encounter is in function signatures when one wants arguments that are meant as overrides: class Foo: def __init__(self, bar=42, baz=None): self.bar = bar self.baz = baz d

[Python-ideas] Re: Making imports callable

2021-10-21 Thread Abdur-Rahmaan Janhangeer
Just amazing!!! Noted it down https://www.pythonkitchen.com/python-making-imports-callable/ Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius __

[Python-ideas] Re: Making imports callable

2021-10-21 Thread Chris Angelico
On Fri, Oct 22, 2021 at 3:49 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings list, > > Let's say i import module1 > > > import module1 > > can we do > > > module1() > > straight out of the box? > Yes! It takes a (very) little bit of work though. You have to replace your module's class with a sub

[Python-ideas] Fwd: [Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread David Mertz, Ph.D.
I actually thought this thread was on pyhon-ideas where it is now appropriate. Chris quotes everything I wrote, and his comments are all useful, so let me move starting with that. -- Forwarded message - From: Chris Angelico Date: Thu, Oct 21, 2021, 8:42 PM Subject: [Python-Dev] Re

[Python-ideas] Re: Making imports callable

2021-10-21 Thread Abdur-Rahmaan Janhangeer
Sorry not if name == main, basically if module is being imported: __file__.callable = True Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius ___

[Python-ideas] Making imports callable

2021-10-21 Thread Abdur-Rahmaan Janhangeer
Greetings list, Let's say i import module1 import module1 can we do module1() straight out of the box? If not i propose something like if __name__ == '__main__': __file__.callable = True Kind Regards, Abdur-Rahmaan Janhangeer about | blog

[Python-ideas] PEP able? : Request new 'fn' format specifier to specify relationship between positional arguments

2021-10-21 Thread Shash Srinivasa
Hi, Draft PEP attached: Proposal: def is_between(n1,n2,n3): fn"is number {n1} between {n2} and {n3}" fn"{n2}<{n1}<{n3}?" # the token "fn" immediately following the def statement, speficy the descriptive text # multipe "fn" specifiers describes multiple ways the funtion can be invoked # the "fn"

[Python-ideas] Re: Unpacking in tuple/list/set/dict comprehensions

2021-10-21 Thread Piotr Waszkiewicz
+1 from me, I've actually had several situations where I was in need of such notation. I also think that the proposed syntax in intuitive enough so that it should not cause any confusion. On Wed, Oct 20, 2021 at 2:08 AM Steven D'Aprano wrote: > On Sun, Oct 17, 2021 at 05:02:23PM -0700, Guido van