[Python-ideas] Deprecate PEP 249 (DB-API 2.0)

2024-02-27 Thread Stephen J. Turnbull
do > easier, more secure things. > _______ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.py

[Python-ideas] Deprecate PEP 249 (DB-API 2.0)

2024-02-27 Thread Soni L.
. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread Greg Ewing
On 23/12/23 9:12 am, DL Neil via Python-ideas wrote: On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: You're better off discussing this on discuss.python.org as this mailing list is basically dead. It can't be dead - you're here! It's just resting! -- Greg

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
On 12/23/23 09:51, Chris Angelico wrote: On Sat, 23 Dec 2023 at 07:13, DL Neil via Python-ideas wrote: On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: On 12/21/2023 4:38 PM, Steve Jorgensen wrote: I am finding that it would be useful to be able to define a dataclass

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread Chris Angelico
On Sat, 23 Dec 2023 at 07:13, DL Neil via Python-ideas wrote: > > On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: > > On 12/21/2023 4:38 PM, Steve Jorgensen wrote: > >> I am finding that it would be useful to be able to define a dataclass that > >> is an

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
thon Let's also state, and discard, the idea that there is no need (from Python's perspective) for an ABC at all, creating a super-(data)class, and inheriting from there 'works' - but doesn't help comprehension. -- Regards =dn _______ Python-ideas

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread DL Neil via Python-ideas
On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote: On 12/21/2023 4:38 PM, Steve Jorgensen wrote: I am finding that it would be useful to be able to define a dataclass that is an abstract base class and define some of its field as abstract. As I am typing this, I realize that I could

[Python-ideas] Re: Abstract dataclasses and dataclass fields

2023-12-22 Thread Eric V. Smith via Python-ideas
dead. And when you do post over there, please provide an example. It's not clear what would happen in the generated code if abstract=True. Eric ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le

[Python-ideas] Abstract dataclasses and dataclass fields

2023-12-21 Thread Steve Jorgensen
of the standard API in any case though? I'm thinking that a field would be made abstract by passing `abstract=True` as an argument to `dataclasses.field()`. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python

[Python-ideas] Re: Extract variable name from itself

2023-11-08 Thread anthony.flury via Python-ideas
variable will only have the name 'person_name', but not user_name, as the field objects need to know their names on the model (and their names on the views/forms). -- Original Message -- From: "Rene Nejsum" To: python-ideas@python.org Sent: Saturday, 4 Nov, 23 At 08:13 Subjec

[Python-ideas] Re: Extract variable name from itself

2023-11-08 Thread Rene Nejsum
it can name the row in the database the same. On startup Django runs through the Model class searching for instances of Field and gets the name that way _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-id

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread David Mertz, Ph.D.
it's the result of invalid > user input, but that's the fault of the user, not the programmer. > > -- > Greg > ___________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@pyt

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Greg Ewing
of invalid user input, but that's the fault of the user, not the programmer. -- Greg ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Eric V. Smith via Python-ideas
___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Chris Angelico
ry must have come from Perth, as it is nothing but black swans. ChrisA ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Juancarlo Añez
I > believe Guido has specifically advised against such a hierarchy. I'm > against this change. > > Steve > _______ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/m

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Paul Moore
> On the cost side, there are so many cases where a more finely divided > Exception hierarchy would help novices quite a bit but experts very > little that this case (easy to learn) would open the floodgates. I > believe Guido has specifically advised against such a hierarchy. I'm > a

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Stephen J. Turnbull
quite a bit but experts very little that this case (easy to learn) would open the floodgates. I believe Guido has specifically advised against such a hierarchy. I'm against this change. Steve _______ Python-ideas mailing list -- python-ideas@python.org To unsubscr

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Chris Angelico
andate that you use it everywhere, just to achieve what's already happening? ChrisA ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread MRAB
I think what the OP wants is to have re.match either return a match or raise an exception. _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/pytho

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Chris Angelico
tly well. If it's NOT a bug when the regex doesn't match, you have the standard conditional form available. I'm not seeing a problem here. ChrisA ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https:/

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Ram Rachum
g string was. I propose to skip that entire exercise and go straight to: re.NoMatchError: 'foobar' does not match pattern '^[0-9]+' That would be so much nicer both for beginners and experienced developers. What do you think about that? Thanks, Ram. _______ Pyt

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Chris Angelico
s what we should do with that match", and when that > "absolutely sure" fails, the proper way to deal with that is by raising an > exception. > Oh, you mean like AttributeError? ChrisA _______ Python-ideas mailing list -- python-ide

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Ram Rachum
e proper way to deal with that is by raising an exception. ___________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Chris Angelico
inters to enforce a rule that the `require` argument must always be > specified. (Example.) > What about an if with the match inside it? if m := re.match(...): ... That's one of the motivating examples behind the walrus after all. ChrisA _______ Pytho

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Ram Rachum
uld either return a match or >> raise an exception with an actually useful message? >> >> >> Thanks, >> Ram. >> _______ >> Python-ideas mailing list -- python-ideas@python.org >> To unsubscribe send an email to python-ideas-le...@python.org >>

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread David Mertz, Ph.D.
eed. What do you think about a flag `require` such that > `re.match(pattern, string, require=True)` would either return a match or > raise an exception with an actually useful message? > > > Thanks, > Ram. > _______ > Python-ideas ma

[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-21 Thread Paul Moore
ation that fails while the code > expects it to succeed. What do you think about a flag `require` such that > `re.match(pattern, string, require=True)` would either return a match or > raise an exception with an actually useful message? > > > Thanks, > Ram. > __

[Python-ideas] re.match(pattern, string, require=True)

2023-10-21 Thread Ram Rachum
ceed. What do you think about a flag `require` such that `re.match(pattern, string, require=True)` would either return a match or raise an exception with an actually useful message? Thanks, Ram. _______ Python-ideas mailing list -- python-ideas@

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread dn via Python-ideas
On 19/10/2023 20.43, Dom Grigonis wrote: On 19 Oct 2023, at 10:27, dn via Python-ideas wrote: On 19/10/2023 19.50, Dom Grigonis wrote: Thank you, Good information, thank you. Was not aware of __set_name__. IIRC that was one of the updates/improvements. Thanks to whomsoever

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread Dom Grigonis
e class-attribute and not call the descriptor), so instance > can never be None and owner is type(instance). > > Le jeu. 19 oct. 2023 à 09:45, Dom Grigonis <mailto:dom.grigo...@gmail.com>> a écrit : > > > On 19 Oct 2023, at 10:27, dn via Python-ideas > <mailto:python-ideas

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread Antoine Rozo
and not call the descriptor), so instance can never be None and owner is type(instance). Le jeu. 19 oct. 2023 à 09:45, Dom Grigonis a écrit : > > > On 19 Oct 2023, at 10:27, dn via Python-ideas > wrote: > > > > On 19/10/2023 19.50, Dom Grigonis wrote: > >>

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread Dom Grigonis
> On 19 Oct 2023, at 10:27, dn via Python-ideas wrote: > > On 19/10/2023 19.50, Dom Grigonis wrote: >> Thank you, >> Good information, thank you. Was not aware of __set_name__. > > IIRC that was one of the updates/improvements. Thanks to whomsoever...! > > T

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread dn via Python-ideas
in our application code... (YMMV!) -- Regards, =dn ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread Dom Grigonis
Thank you, Good information, thank you. Was not aware of __set_name__. DG > On 19 Oct 2023, at 09:28, dn via Python-ideas wrote: > > On 19/10/2023 18.29, Dom Grigonis wrote: >> def __get__(self, instance, owner): >> def __set__(self, instance, value): >> Is there

[Python-ideas] Re: Descriptor __get__ and __set__ argument discrepancy

2023-10-19 Thread dn via Python-ideas
#descriptors -- Regards, =dn ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org

[Python-ideas] Descriptor __get__ and __set__ argument discrepancy

2023-10-18 Thread Dom Grigonis
Hi all, Quick question. def __get__(self, instance, owner): def __set__(self, instance, value): Is there a reason why `__set__` does not have owner in it’s arguments while `__get__` does? Regards, DG ___ Python-ideas mailing list -- python-ideas

[Python-ideas] Non-aware operators PEP505

2023-10-16 Thread Dom Grigonis
egards, DG ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-10 Thread Rob Cliffe via Python-ideas
)) ___ Python-ideas mailing list --python-ideas@python.org To unsubscribe send an email topython-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived athttps://mail.python.org/archives/list/python-ideas@python.org

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-10 Thread Stephen J. Turnbull
else: > break Works for me. I suspect you can construct situations where it would be a lot uglier. But I'm not a fan of the walrus in the first place, so I'm not going to take this any further. Steve _______ Python-ideas mailing

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Dom Grigonis
e") as f: >lines = f.readlines() >for (line in lines): >if check(line): >process(line) >else: >break > > but that's not possible with an infinite iterable, undesireable for > most non-file streams, etc. > > Re "

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Stephen J. Turnbull
infinite iterable, undesireable for most non-file streams, etc. Re "simple examples", see why I used the "if check()" stuff? If I wasn't going to talk about infinite iterables and pausing external streams, that would just be (potentially wrong!) complexity that doesn't help

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Dom Grigonis
it's always the case that > there are objective reasons why it's a good thing. > > All additions have a 0 * infinity cost: a negligible cost of learning > (for one user) times *all* the users. Ok, thanks. DG ___ Python-ideas mailing list --

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Stephen J. Turnbull
0 * infinity cost: a negligible cost of learning (for one user) times *all* the users. Other projects feel differently about it, but Python tends to be quite conservative about additions. Steve ___ Python-ideas mailing list -- python-ideas@python.org T

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-08 Thread Dom Grigonis
unity likes it, then could be a good addition. Regards, DG P.S. Deferred evaluation will be able to handle this one too_______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-08 Thread MRAB
. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message

[Python-ideas] SyntaxError: cannot use assignment expressions with attribute

2023-10-08 Thread Dom Grigonis
Is there a reason why this is not allowed? return (self.mode := self.mode_valid(mode)) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: Extract variable name from itself

2023-09-28 Thread Dom Grigonis
.com>> wrote: > > > > On Mon, 25 Sept 2023 at 07:05, Dom Grigonis > <mailto:dom.grigo...@gmail.com>> wrote: > >> What I meant is that functions in __builtins__ are low level, with > >> functionality which is hidden from the user. > >> >

[Python-ideas] Re: Reconstructing datetime from microsecond timestamp

2023-09-25 Thread Samuel Freilich via Python-ideas
wrote: > Samuel Freilich via Python-ideas writes: > > > This might all be too much thought about edge cases that don't > > matter, but given the *_ns() functions in the time module (PEP > > 564), I'm curious why datetime doesn't have a constructor that > > take

[Python-ideas] Re: Extract variable name from itself

2023-09-25 Thread Chris Angelico
is a poll: > > https://take.supersurvey.com/QCVZKTDY0 > > It will not take more than few seconds. Appreciate your time. Polls are utterly useless. ChrisA ___________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email

[Python-ideas] Re: Extract variable name from itself

2023-09-25 Thread Dom Grigonis
com/QCVZKTDY0> It will not take more than few seconds. Appreciate your time. Regards, DG ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/

[Python-ideas] Reconstructing datetime from microsecond timestamp

2023-09-25 Thread Stephen J. Turnbull
Samuel Freilich via Python-ideas writes: > This might all be too much thought about edge cases that don't > matter, but given the *_ns() functions in the time module (PEP > 564), I'm curious why datetime doesn't have a constructor that > takes an integer timestamp with the fu

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Tiago Illipronti Girardi
t; >> > > > > What does that even mean? > > > > ChrisA > > ___ > > Python-ideas mailing list -- python-ideas@python.org > > To unsubscribe send an email to python-ideas-le...@python.org > > https://mail.python.org/mailman3/lists/python-ideas

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Chris Angelico
notice of it. ChrisA _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ide

[Python-ideas] Reconstructing datetime from microsecond timestamp

2023-09-24 Thread Samuel Freilich via Python-ideas
___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
in __builtins__ are low level, with >> functionality which is hidden from the user. >> > > What does that even mean? > > ChrisA > ___________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send a

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Chris Angelico
On Mon, 25 Sept 2023 at 07:05, Dom Grigonis wrote: > What I meant is that functions in __builtins__ are low level, with > functionality which is hidden from the user. > What does that even mean? ChrisA _______ Python-ideas mailing list -- pyt

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
egular expressions. Consider >>>> this possible notation: >>>> >>>>f'There are {count} expression{pluralize(count)} denoted by {=0}.' >>>> >>>> Otherwise it isn't great, but it's definitely concise. In the >>>> simplest cas

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Tiago Illipronti Girardi
{=0}.' >>> >>> Otherwise it isn't great, but it's definitely concise. In the >>> simplest case you could omit the position: >>> >>>f'{=} is {count} at this point in the program.' >>> >>> Hmmm... >>> >>> and viola

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
> >>>>> and violates DRY -- it doesn't solve the problem of the first >>>>> draft typo. >>> >>>> And how is “postfix =“ different? >>> >>> You *can't* use different identifiers for the name and value in >>> "postfix

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Tiago Illipronti Girardi
> >> >> You *can't* use different identifiers for the name and value in >> "postfix =": the same text is used twice, once as a string and one as >> an identifier. >> >> I see what you mean, but this property is arguably intrinsic to what it >

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
intrinsic to what it is. > And is part of f-strings vs explicit formatting property too: > variable = 1 > print(f'{variable=} and b={variable}') > # VS > msg = 'variable={v} and b={v}' > print(msg.format(v=variable)) > Especially, where msg can be pre-stored and reused. Then maybe

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
get the impression that you think everyone else > understands your idea. Apologies. Noted.___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.or

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Tiago Illipronti Girardi
rmatting property too: > > variable = 1print(f'{variable=} and b={variable}')# VS > msg = 'variable={v} and b={v}'print(msg.format(v=variable)) > > Especially, where msg can be pre-stored and reused. Then maybe not making > it f-string only is a better idea. So that one can do

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Chris Angelico
ng? Because that's, uhh, kinda not the point of str.format(). And if that isn't what you mean, what is it? Your posts are often distinctly unclear. I get the impression that you think everyone else understands your idea. ChrisA _______ Python-ideas mailing l

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
}' print(msg.format(v=variable)) Especially, where msg can be pre-stored and reused. Then maybe not making it f-string only is a better idea. So that one can do: msg = '{a!i}={a} and b={a}' print(msg.format(a=variable)) _______ Python-ideas mailing list

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Tiago Illipronti Girardi
gt; What could be more concise? > > > and > > violates DRY -- it doesn't solve the problem of the first draft typo. > And how is “postfix =“ different? > > > I don't see it as elegant the way "postfix =" is. > Agreed. > > DG ________

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Stephen J. Turnbull
> And how is “postfix =“ different? You *can't* use different identifiers for the name and value in "postfix =": the same text is used twice, once as a string and one as an identifier. _______ Python-ideas mailing list -- python-ideas@python.org To unsubsc

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Dom Grigonis
> But it's far from concise What could be more concise? > and > violates DRY -- it doesn't solve the problem of the first draft typo. And how is “postfix =“ different? > I don't see it as elegant the way "postfix =" is. Agreed. DG ______

[Python-ideas] Re: Extract variable name from itself

2023-09-24 Thread Stephen J. Turnbull
y, "prefix =" is a reasonable solution to the problem -- assuming you consider it a problem. But it's far from concise and violates DRY -- it doesn't solve the problem of the first draft typo. I don't see it as elegant the way "postfix =" is. _______

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
oks like" what it produces. > > The proposed prefix '=' flag is much less attractive to me on all > counts above, except that it's quite mnemonic. > > Steve ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an emai

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Stephen J. Turnbull
active to me on all counts above, except that it's quite mnemonic. Steve _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Me

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Eric V. Smith via Python-ideas
m proposing (Except the unneeded evaluation part) So if it is already there, why not have it done well given there is little to none overall cost to it? I think cost implementing such things in Editor is much greater.Regards,DG _______Python-ideas mailing list --

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
`` support even without further interpret support. >>>>> What do you mean by f’{name!id}’ ? I don’t understand your point here. >>>>> >>>>> Are you proposing f’{name!id}’ syntax for it? My whole point is to do >>>>> this in f-strings. >>&

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
>>> DG >>> —Evaluation of deferred evaluation can be deferred, but not indefinitely — >>> >>> >>>> Em sáb., 23 de set. de 2023 às 09:51, Dom Grigonis >>> <mailto:dom.grigo...@gmail.com>> escreveu: >>>>> This is

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
ethod to do it a bit more robustly? >>> >>> Given python being flexible multipurpose interpreted language, I am sure >>> more use cases would surface. >>> >>>> Couldn’t we just subclass typing.LiteralString to typing.Id or something >>>>

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
.rstrip(f'{a}') > # or a bit better > f'{a=}'.split('=')[0] > # = exactly what I am proposing (Except the unneeded evaluation part) > So if it is already there, why not have it done well given there is little to > none overall cost to it? I think cost implementing such things in Editor

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Tiago Illipronti Girardi
I think cost implementing such things in Editor > is much greater. > > Regards, > DG > _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.pyt

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
Regards, DG_______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@p

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Tiago Illipronti Girardi
This is the only use case I can think of. It could be supported by the typing module by subtyping LiteralString and let the editor tools do the rest. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Pyrous
I accidentaly made the windows11 client the app for responding these, can someone help to undo it, thanks. Send from Windows11 client (sorry IT SUCKS)  ___________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@p

[Python-ideas] Re: Extract variable name from itself

2023-09-23 Thread Dom Grigonis
ourage it in production code. Agree, this use case is not for production code. Correct me if I am wrong, but I think `eval` in general should not be encouraged in production code. ___ Python-ideas mailing list -- python-ideas@python.org To unsubs

[Python-ideas] Re: Extract variable name from itself

2023-09-22 Thread Stephen J. Turnbull
ase. I don't think we should encourage it in production code. _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message a

[Python-ideas] Re: Extract variable name from itself

2023-09-22 Thread Dom Grigonis
> this automatically, you're doing it wrong. ;-) >> >> I don't see any use case that f-string '=' doesn't satisfy well enough >> to make a new builtin pseudo-function[1] justifiable. >> >>> E.g. would it be faster than `Class.__name__`? >> >> You're

[Python-ideas] Re: Revise using the colon ( : )

2023-09-20 Thread Dom Grigonis
dy exists. So this is incorrect. >>> Or: >>> while a < b(x := c) - 42: >>> # ??? > > I actually think this is the better parsing of the three: a SyntaxError. > > > Celelibi > ___ > Python-ideas mailing list -- python-ideas@python.

[Python-ideas] Re: Revise using the colon ( : )

2023-09-20 Thread Celelibi
> while a < b(x := c) - 42: >># ??? I actually think this is the better parsing of the three: a SyntaxError. Celelibi _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@pytho

[Python-ideas] Re: Extract variable name from itself

2023-09-18 Thread Dom Grigonis
faults__ = (2, 1, 0) > >>> f() > (2, 1, 0) > > I am suspicious of your example in your original post because it does not > explicitly consider the possibilities already provided by Python for changing > default values on the fly. > > I hope this helps. > > Jo

[Python-ideas] Re: Extract variable name from itself

2023-09-18 Thread Jonathan Fine
cause it does not explicitly consider the possibilities already provided by Python for changing default values on the fly. I hope this helps. Jonathan _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas

[Python-ideas] Re: Extract variable name from itself

2023-09-17 Thread Dom Grigonis
ow it > makes bad code harder to write. > > Please note that my use of 'good' and 'bad' are subject to the provisos > mentioned earlier. > > I hope this helps. > > Jonathan > > > > > _______ Pyt

[Python-ideas] Re: Extract variable name from itself

2023-09-17 Thread Jonathan Fine
___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Dom Grigonis
ou provide of weaknesses in Python's present behaviour. > > I hope this helps. > > Jonathan _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Jonathan Fine
response to my request more highly if it shows that you have a clear understanding of Python's present behaviour. I'd also welcome any example you provide of weaknesses in Python's present behaviour. I hope this helps. Jonathan ___ Python-ideas mailing

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Dom Grigonis
ngs expressing code. If it's about speed, > there's got to be a better way. > > > > Footnotes: > [1] In C#, 'nameof' is first looked up as a function reference, and > if found that is called. Otherwise the compiler macro is used. > _______ Python-ide

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Stephen J. Turnbull
.g. would it be faster than `Class.__name__`? You're working with strings expressing code. If it's about speed, there's got to be a better way. Footnotes: [1] In C#, 'nameof' is first looked up as a function reference, and if found that is called. Otherwise the compiler macro is used.

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Dom Grigonis
parenthesized strings properly and all you need > to do is modify tools to recognize that syntax. It's even backwards > compatible, visually striking, and doesn't prevent compile-time string > folding. > > --- Bruce > > ___________ >

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Bruce Leban
parenthesized strings properly and all you need to do is modify tools to recognize that syntax. It's even backwards compatible, visually striking, and doesn't prevent compile-time string folding. --- Bruce > > ___ Python-ideas mailing list -- python

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Chris Angelico
d parsing it for variables - in fact, it's the exact same thing, just done a second time. I have done exactly this sort of parsing, using the Python ast module. It's not difficult. ChrisA ___________ Python-ideas mailing list -- python-ideas@python.org To unsubs

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Jeff Allen
ation as a Good Thing. 3. Willigness to implement and maintain. -- Jeff Allen _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.py

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Dom Grigonis
p (if it were project-local, not a stdlib object) would cause the string > to change in most existing IDEs. > Attempts to guess the name from the expression at runtime are futile and a > red herring. Trying to describe the desired semantics that way leads to > nonsensical ideas, I agree.

[Python-ideas] Re: Extract variable name from itself

2023-09-16 Thread Jeff Allen
ads to nonsensical ideas, I agree. I'm not convinced this feature is widely useful. Here I'm just trying to focus us on the *viable* semantics MRAB identified. -- Jeff Allen ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe s

  1   2   3   4   5   6   7   8   9   10   >