On Sun, 29 May 2022 at 08:26, Eryk Sun wrote:
>
> On 5/28/22, Chris Angelico wrote:
> >
> > be extremely confusing; so to keep everything safe, the interpreter
> > generates a name you couldn't possibly want - same as for the function
> > itself, which is named "" or "", angle brackets
> >
On 5/28/22, Chris Angelico wrote:
>
> be extremely confusing; so to keep everything safe, the interpreter
> generates a name you couldn't possibly want - same as for the function
> itself, which is named "" or "", angle brackets
> included.
To clarify, "" is the co_name and co_qualname value of
ntifier. An identifier cannot
> > begin with a decimal number.
>
> I'm not sure about the first statement. Feeding
>
> [print("locals:", locals()) or c for c in "ab"]
>
> to the REPL, the result is
>
> locals: {'.0': , 'c': 'a'}
> locals: {'
. Feeding
[print("locals:", locals()) or c for c in "ab"]
to the REPL, the result is
locals: {'.0': , 'c': 'a'}
locals: {'.0': , 'c': 'b'}
['a', 'b']
i.e. there is a variable of name .0 in the local namespace within the
list comprehension, and .0 is definitely not an identif
ering name like __init__
...
-Original Message-
From: dn
To: python-list@python.org
Sent: Sat, May 14, 2022 12:33 am
Subject: Re: .0 in name
This is not what @Avi menat by "silly variable names" but:
3D_position
2nd_floor_area
3M_PostIt_size
3rd_degree_polynom
This is not what @Avi menat by "silly variable names" but:
3D_position
2nd_floor_area
3M_PostIt_size
3rd_degree_polynomial
360_degree_view
12_hours_later
and ???
2_fast_2_furious
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list
❽
-Original Message-
From: Avi Gross via Python-list
To: python-list@python.org
Sent: Fri, May 13, 2022 6:02 pm
Subject: Re: .0 in name
Bryan,
As has been pointed out, it is very common in possibly all programming
languages to not allow digits at the start of many identifiers. It make
On Fri, 2022-05-13 at 22:02 +, Avi Gross via Python-list wrote:
> So why you wonder where it is documented that variables cannot be
> what you feel like is a bit puzzling!
I had just assumed on good faith that the request to the documentation
would be so that the OP could determine what is
rame with embedded spaces and other anomalies requiring
special handling.
So why you wonder where it is documented that variables cannot be what you feel
like is a bit puzzling!
-Original Message-
From: bryangan41
To: python-list@python.org
Sent: Fri, May 13, 2022 12:47 pm
Subject: .0 i
On Sat, 2022-05-14 at 00:47 +0800, bryangan41 wrote:
> May I know (1) why can the name start with a number?
The name of an attribute must be an identifier. An identifier cannot
begin with a decimal number.
> (2) where in the doc is it?!
May I know (1) why can the name start with a number?(2) where in the doc is
it?!>>> import pdb>>> pdb.run('(a for a in "")')> (1)()(Pdb)
s--Call--> (1)()(Pdb) a.0 = (Pdb) c>>>Sent from Samsung tablet.
--
https://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo