Re: LRU cache

2023-02-22 Thread Rob Cliffe via Python-list



On 18/02/2023 17:19, Albert-Jan Roskam wrote:



On Feb 18, 2023 17:28, Rob Cliffe via Python-list 
 wrote:


On 18/02/2023 15:29, Thomas Passin wrote:
> On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote:
>>     I sometimes use this trick, which I learnt from a book by
Martelli.
>>     Instead of try/except, membership testing with "in"
>> (__contains__) might
>>     be faster. Probably "depends". Matter of measuring.
>>     def somefunc(arg, _cache={}):
>>         if len(_cache) > 10 ** 5:
>>             _cache.pop()
>>         try:
>>             return _cache[arg]
>>         except KeyError:
>>             result = expensivefunc(arg)
>>             _cache[arg] = result
>>             return result
>>     Albert-Jan
>
> _cache.get(arg) should be a little faster and use slightly fewer
> resources than the try/except.
>
Provided that you can provide a default value to get() which will
never
be a genuine "result".


=

This might be better than None:
_cache.get(arg, Ellipsis)



A common strategy is to have a dedicated sentinel object.  E.g. (untested):
IMPOSSIBLE_RESULT = object()
...
        if _cache.get(arg, IMPOSSIBLE_RESULT) == IMPOSSIBLE_RESULT:
            # arg was not in the cache
            ...
--
https://mail.python.org/mailman/listinfo/python-list


Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-22 Thread Greg Ewing via Python-list

On 23/02/23 9:37 am, Hen Hanna wrote:

 for the first  several weeks... whenever i used Python...  all 
i could think ofwas     this is really Lisp (inside) with  a thin 
veil of   Java/Pascal syntax..

-  that  everything is  first converted  (macro-expanded)  
into (intermediated) Lisp code, and then.


I once toyed with the idea of implementing a Python compiler
by translating it into Scheme and then feeding it to a Scheme
compiler.

But I quickly realised that, although Scheme and Python are
both dynamically-typed languages, Python is way *more* dynamic
than Scheme.

So without doing some very serious static analysis, the best
I could do would be just putting together calls to runtime
support routines that implement all the dynamic dispatching
that Python does for its operators, etc., and the result
wouldn't be much better than an interpreter.

There are some similarities between Python and Lisp-family
languages, but really Python is its own thing.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: semi colonic

2023-02-22 Thread Greg Ewing via Python-list

On 23/02/23 1:58 pm, avi.e.gr...@gmail.com wrote:


Would anything serious break if it was deprecated for use as a statement
terminator?


Well, it would break all the code of people who like to
write code that way. They might get a bit miffed if we
decide that their code is not serious. :-)

On the other hand, if they really want to, they will still
be able to abuse semicolons by doing this sort of thing:

a = 5; pass
b = 7; pass
c = a * b; pass

Then everyone will know it's some really serious code!

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Greg Ewing via Python-list

On 23/02/23 9:12 am, Hen Hanna wrote:

On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:

 def f(a):
print(black_magic(a))# or black_magic('a')

 f(v1)# prints: v1
 f(v2)# prints: v2



the term  [call by name]  suggests  this should be possible.


But Python doesn't use call-by-name or anything remotely like it.

(Even if it did, the word "name" in that context doesn't mean
what it sounds like it means. The Algol docs used some words in
weird ways.)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: semi colonic

2023-02-22 Thread Thomas Passin

On 2/22/2023 10:42 PM, avi.e.gr...@gmail.com wrote:

That seems like a reasonable if limited use of a semi-colon, Thomas.

Of course, most shells will allow a multi-line argument too like some AWK
scripts I have written with a quote on the first line followed by multiple
lines of properly formatted code  and a closing quote.


"Most shells"... got to include cmd.exe, don't forget.


Python though can get touchy about getting just the right amount of
indentation and simple attempts to break your program up into two lines

python -c "import sys
print('\n'.join(sys.path))"


DO not work so well on some shells.

So, yes, I agree. But I tried this on bash under Cygwin on windows using a
"here" document and it worked fine with multiple lines so something to
consider with no semicolons:

$ python <
import sys
print('\n'.join(sys.path))
!


/usr/lib/python2.7/site-packages/pylint-1.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/astroid-1.3.4-py2.7.egg
/usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-cygwin
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0

-Original Message-
From: Python-list  On
Behalf Of Thomas Passin
Sent: Wednesday, February 22, 2023 9:05 PM
To: python-list@python.org
Subject: Re: semi colonic

On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote:

Thomas,

This is one of many little twists I see between languages where one
feature impacts use or even the need for another feature.

So can anyone point to places in Python where a semicolon is part of a
best or even good way to do anything?


Mostly I use it to run small commands on the command line with python -c.
e.g.

python -c "import sys;print('\n'.join(sys.path))"

This is handy enough that I wouldn't like to do without.

Another place I use the semicolon (once in a while) is for quick debugging.
I might add as line like, perhaps,

import os; print(os.path.exists(filename))

This way I can get rid of the debugging statement by deleting that single
line.  This is non only quicker but I'm less likely to delete too much by
mistake.


Some older languages had simple parsers/compilers that needed some way
to know when a conceptual line of code was DONE and the semi-colon was
a choice for making that clear. But some languages seem to only
continue looking past an end-of-line if they detect some serious
reason to assume you are in middle of something. An unmatched open
parenthesis or square bracket might be enough, and in some languages a

curly brace.


Python mainly has a concept of indentation and blank lines as one part
of the guidance. Continuing lines is possible, if done carefully.

But consider the lowly comma. Some languages may assume more is to
come if it is dangled at the end of a line. But in a language that
supports a dangling comma such as in making a tuple, how is the
interpreter to know more is to come?


a = 5,
a

(5,)


a = 5, \

... 6

a

(5, 6)

Well, one possible use of a semi-colon is to make short one-liner
functions like this:

  def twoByFour(a): sq = a*a; forth = sq*sq; return((sq, forth))

There is no reason, of course, that could not be done in multiple
indented lines or other ways.

So if it was allowed in something like a lambda creation, it could be
useful but it isn't!

About the only thing that I can think of is if someone wishes to
compress a file of python code a bit. The indentation can add up but a
semi-colon does not solve all such problems.

Would anything serious break if it was deprecated for use as a
statement terminator? Then again, is it hurting anything? If it
stopped being used this way, could it later be introduced as some new
language feature or operator such as we now have a := b as a reuse of
the colon, maybe a semicolon could be useful at least until someone
decides to allow additional Unicode characters!

Now if there are serious reasons to use semi-colon in python, great.
If not, it is a historical artifact.

-Original Message-
From: Python-list
 On Behalf Of
Thomas Passin
Sent: Wednesday, February 22, 2023 7:24 PM
To: python-list@python.org
Subject: Re: Introspecting the variable bound to a function argument

On 2/22/2023 3:12 PM, Hen Hanna wrote:

On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev

wrote:

Hello, all.

Does Python have an instrospection facility that can determine to
which outer variable a function argument is bound, e.g.:

v1 = 5;
v2 = 5;



do some Python coders like to end lines with   ;   ?


Very few, probably.  It's not harmful but adds unnecessary visual clutter.



   def f(a):
  print(black_magic(a))# or

black_magic('a')


   f(v1)# prints: v1
   f(v2)# prints: v2



the term  [call by name]  suggests  this should be possible.


30 years ago...  i used to think about this 

RE: semi colonic

2023-02-22 Thread avi.e.gross
That seems like a reasonable if limited use of a semi-colon, Thomas.

Of course, most shells will allow a multi-line argument too like some AWK
scripts I have written with a quote on the first line followed by multiple
lines of properly formatted code  and a closing quote.

Python though can get touchy about getting just the right amount of
indentation and simple attempts to break your program up into two lines 

python -c "import sys 
print('\n'.join(sys.path))"


DO not work so well on some shells.

So, yes, I agree. But I tried this on bash under Cygwin on windows using a
"here" document and it worked fine with multiple lines so something to
consider with no semicolons:

$ python < import sys
> print('\n'.join(sys.path))
> !

/usr/lib/python2.7/site-packages/pylint-1.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/astroid-1.3.4-py2.7.egg
/usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-cygwin
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0

-Original Message-
From: Python-list  On
Behalf Of Thomas Passin
Sent: Wednesday, February 22, 2023 9:05 PM
To: python-list@python.org
Subject: Re: semi colonic

On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote:
> Thomas,
> 
> This is one of many little twists I see between languages where one 
> feature impacts use or even the need for another feature.
> 
> So can anyone point to places in Python where a semicolon is part of a 
> best or even good way to do anything?

Mostly I use it to run small commands on the command line with python -c.
e.g.

python -c "import sys;print('\n'.join(sys.path))"

This is handy enough that I wouldn't like to do without.

Another place I use the semicolon (once in a while) is for quick debugging.
I might add as line like, perhaps,

import os; print(os.path.exists(filename))

This way I can get rid of the debugging statement by deleting that single
line.  This is non only quicker but I'm less likely to delete too much by
mistake.

> Some older languages had simple parsers/compilers that needed some way 
> to know when a conceptual line of code was DONE and the semi-colon was 
> a choice for making that clear. But some languages seem to only 
> continue looking past an end-of-line if they detect some serious 
> reason to assume you are in middle of something. An unmatched open 
> parenthesis or square bracket might be enough, and in some languages a
curly brace.
> 
> Python mainly has a concept of indentation and blank lines as one part 
> of the guidance. Continuing lines is possible, if done carefully.
> 
> But consider the lowly comma. Some languages may assume more is to 
> come if it is dangled at the end of a line. But in a language that 
> supports a dangling comma such as in making a tuple, how is the 
> interpreter to know more is to come?
> 
 a = 5,
 a
> (5,)
> 
 a = 5, \
> ... 6
 a
> (5, 6)
> 
> Well, one possible use of a semi-colon is to make short one-liner 
> functions like this:
> 
>  def twoByFour(a): sq = a*a; forth = sq*sq; return((sq, forth))
> 
> There is no reason, of course, that could not be done in multiple 
> indented lines or other ways.
> 
> So if it was allowed in something like a lambda creation, it could be 
> useful but it isn't!
> 
> About the only thing that I can think of is if someone wishes to 
> compress a file of python code a bit. The indentation can add up but a 
> semi-colon does not solve all such problems.
> 
> Would anything serious break if it was deprecated for use as a 
> statement terminator? Then again, is it hurting anything? If it 
> stopped being used this way, could it later be introduced as some new 
> language feature or operator such as we now have a := b as a reuse of 
> the colon, maybe a semicolon could be useful at least until someone 
> decides to allow additional Unicode characters!
> 
> Now if there are serious reasons to use semi-colon in python, great. 
> If not, it is a historical artifact.
> 
> -Original Message-
> From: Python-list 
>  On Behalf Of 
> Thomas Passin
> Sent: Wednesday, February 22, 2023 7:24 PM
> To: python-list@python.org
> Subject: Re: Introspecting the variable bound to a function argument
> 
> On 2/22/2023 3:12 PM, Hen Hanna wrote:
>> On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev
wrote:
>>> Hello, all.
>>>
>>> Does Python have an instrospection facility that can determine to 
>>> which outer variable a function argument is bound, e.g.:
>>>
>>> v1 = 5;
>>> v2 = 5;
>>
>>
>> do some Python coders like to end lines with   ;   ?
> 
> Very few, probably.  It's not harmful but adds unnecessary visual clutter.
> 
>>>
>>>   def f(a):
>>>  print(black_magic(a))# or
> black_magic('a')
>>>
>>>   f(v1)# prints: v1
>>>   f(v2)# prints: v2
>>>
>>
>> 

Re: semi colonic

2023-02-22 Thread Hen Hanna
On Wednesday, February 22, 2023 at 6:21:13 PM UTC-8, Rob Cliffe wrote:
> On 23/02/2023 02:04, Thomas Passin wrote: 
> > On 2/22/2023 7:58 PM, avi.e...@gmail.com wrote: 
> >> 
> >> 
> >> So can anyone point to places in Python where a semicolon is part of 
> >> a best 
> >> or even good way to do anything? 
> >
> >  I use the semicolon (once in a while) is for quick debugging.  I 
> >might add as line like, perhaps, 
> > 
> > import os; print(os.path.exists(filename)) 
> > 
> > This way I can get rid of the debugging statement by deleting that 
> > single line.  This is non only quicker but I'm less likely to delete 
> > too much by mistake. 
> >

> I do exactly the same. 
> Rob Cliffe


i sometimes  put  extra  commas...  as:

   [  1, 2,  3,  4, ]

so it is (or may be)  easier  to add things   later.

   ---  i can think of putting extra final  ;   for the same 
reason.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Add angle brackets for required args in argparse

2023-02-22 Thread scruel tao
Thank you for your workarounds, Mark Bourne.
`metavar` argument should be sufficient  for infrequent use scenarios, and I 
will consider to use the custom help formatter if necessary.

>>> That's a bit closer to what you asked for, since the required argument
>>> shown in the error message doesn't include the angle brackets.  It also
>>> avoids needing to specify a `metavar` for every positional argument.
>>> However, it is overriding a non-public method of the `HelpFormatter`
>>> class, so might not work across all Python versions if the name or
>>> signature of that method changes (even if it does work with all current
>>> versions, it might break in future).

Your are right to be concerned, that’s why I still think, might the `argparse` 
can provide a more stable way which can set such format strategy globally, your 
workarounds are fine to work now, just I have to write the same code to parse 
either `metaver` or `formatter` every times I use argparse.
Might can have different argparse subclasses, or make some HelpFormatter 
builtin, so that users won’t need to write them by themselves.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semi colonic

2023-02-22 Thread Rob Cliffe via Python-list



On 23/02/2023 02:04, Thomas Passin wrote:

On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote:



So can anyone point to places in Python where a semicolon is part of 
a best

or even good way to do anything?


 I use the semicolon (once in a while) is for quick debugging.  I 
might add as line like, perhaps,


import os; print(os.path.exists(filename))

This way I can get rid of the debugging statement by deleting that 
single line.  This is non only quicker but I'm less likely to delete 
too much by mistake.



I do exactly the same.
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list


Re: semi colonic

2023-02-22 Thread Thomas Passin

On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote:

Thomas,

This is one of many little twists I see between languages where one feature
impacts use or even the need for another feature.

So can anyone point to places in Python where a semicolon is part of a best
or even good way to do anything?


Mostly I use it to run small commands on the command line with python 
-c.  e.g.


python -c "import sys;print('\n'.join(sys.path))"

This is handy enough that I wouldn't like to do without.

Another place I use the semicolon (once in a while) is for quick 
debugging.  I might add as line like, perhaps,


import os; print(os.path.exists(filename))

This way I can get rid of the debugging statement by deleting that 
single line.  This is non only quicker but I'm less likely to delete too 
much by mistake.



Some older languages had simple parsers/compilers that needed some way to
know when a conceptual line of code was DONE and the semi-colon was a choice
for making that clear. But some languages seem to only continue looking past
an end-of-line if they detect some serious reason to assume you are in
middle of something. An unmatched open parenthesis or square bracket might
be enough, and in some languages a curly brace.

Python mainly has a concept of indentation and blank lines as one part of
the guidance. Continuing lines is possible, if done carefully.

But consider the lowly comma. Some languages may assume more is to come if
it is dangled at the end of a line. But in a language that supports a
dangling comma such as in making a tuple, how is the interpreter to know
more is to come?


a = 5,
a

(5,)


a = 5, \

... 6

a

(5, 6)

Well, one possible use of a semi-colon is to make short one-liner functions
like this:

 def twoByFour(a): sq = a*a; forth = sq*sq; return((sq, forth))

There is no reason, of course, that could not be done in multiple indented
lines or other ways.

So if it was allowed in something like a lambda creation, it could be useful
but it isn't!

About the only thing that I can think of is if someone wishes to compress a
file of python code a bit. The indentation can add up but a semi-colon does
not solve all such problems.

Would anything serious break if it was deprecated for use as a statement
terminator? Then again, is it hurting anything? If it stopped being used
this way, could it later be introduced as some new language feature or
operator such as we now have a := b as a reuse of the colon, maybe a
semicolon could be useful at least until someone decides to allow additional
Unicode characters!

Now if there are serious reasons to use semi-colon in python, great. If not,
it is a historical artifact.

-Original Message-
From: Python-list  On
Behalf Of Thomas Passin
Sent: Wednesday, February 22, 2023 7:24 PM
To: python-list@python.org
Subject: Re: Introspecting the variable bound to a function argument

On 2/22/2023 3:12 PM, Hen Hanna wrote:

On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:

Hello, all.

Does Python have an instrospection facility that can determine to
which outer variable a function argument is bound, e.g.:

v1 = 5;
v2 = 5;



do some Python coders like to end lines with   ;   ?


Very few, probably.  It's not harmful but adds unnecessary visual clutter.



  def f(a):
 print(black_magic(a))# or

black_magic('a')


  f(v1)# prints: v1
  f(v2)# prints: v2



the term  [call by name]  suggests  this should be possible.


30 years ago...  i used to think about this type of thing A LOT ---
   ---  CBR, CBV, CBN,   (call by value),(call by name)

etc.




--
https://mail.python.org/mailman/listinfo/python-list



--
https://mail.python.org/mailman/listinfo/python-list


Re: Python + Vim editor

2023-02-22 Thread Cameron Simpson

On 21Feb2023 18:00, Hen Hanna  wrote:

what editor do you (all) use to write Python code?  (i use Vim)


vim
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna
On Wednesday, February 22, 2023 at 3:46:21 PM UTC-8, Hen Hanna wrote:
> On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote: 
> > > py bug.py 
> > Traceback (most recent call last): 
> > File "C:\Usenet\bug.py", line 5, in  
> > print( a + 12 ) 
> > TypeError: can only concatenate str (not "int") to str 
> > 
> > 
> > Why doesn't Python (error msg) do the obvious thing and tell me 
> > WHAT the actual (offending, arg) values are ? 
> > 
> > In many cases, it'd help to know what string the var A had , when the error 
> > occurred. 
> >  i wouldn't have to put print(a) just above, to see. 
> > 
> > 
> > 
> > 
> > ( pypy doesn't do that either, but Python makes programming (debugging) so 
> > easy that i hardly feel any inconvenience.)


 i see that my example would be (even)  clearER with this one-line change:

   py bug.py 
   
 Traceback (most recent call last): 
  
   File "C:\Usenet\bug.py", line 5, in 
 map( Func, fooBar( X, Y, X + Y ))

 TypeError: can only concatenate str (not "int") to str
attempt to call +  with  'abc'  ,   123.45  
<--

> i hope that NOW a few of you can see this as a genuine, (reasonable) question.

Python  seems so perfectly  User-friendly that
   i 'm  so curious (puzzled)  that it doesn't do the very  
obvious and easy thing 
 of giving me this info:

attempt to call  + with  'abc'  ,   
123.45  <--
-- 
https://mail.python.org/mailman/listinfo/python-list


semi colonic

2023-02-22 Thread avi.e.gross
Thomas,

This is one of many little twists I see between languages where one feature
impacts use or even the need for another feature.

So can anyone point to places in Python where a semicolon is part of a best
or even good way to do anything?

Some older languages had simple parsers/compilers that needed some way to
know when a conceptual line of code was DONE and the semi-colon was a choice
for making that clear. But some languages seem to only continue looking past
an end-of-line if they detect some serious reason to assume you are in
middle of something. An unmatched open parenthesis or square bracket might
be enough, and in some languages a curly brace.

Python mainly has a concept of indentation and blank lines as one part of
the guidance. Continuing lines is possible, if done carefully.

But consider the lowly comma. Some languages may assume more is to come if
it is dangled at the end of a line. But in a language that supports a
dangling comma such as in making a tuple, how is the interpreter to know
more is to come?

>>> a = 5,
>>> a
(5,)

>>> a = 5, \
... 6
>>> a
(5, 6)

Well, one possible use of a semi-colon is to make short one-liner functions
like this:

def twoByFour(a): sq = a*a; forth = sq*sq; return((sq, forth))

There is no reason, of course, that could not be done in multiple indented
lines or other ways. 

So if it was allowed in something like a lambda creation, it could be useful
but it isn't!

About the only thing that I can think of is if someone wishes to compress a
file of python code a bit. The indentation can add up but a semi-colon does
not solve all such problems.

Would anything serious break if it was deprecated for use as a statement
terminator? Then again, is it hurting anything? If it stopped being used
this way, could it later be introduced as some new language feature or
operator such as we now have a := b as a reuse of the colon, maybe a
semicolon could be useful at least until someone decides to allow additional
Unicode characters!

Now if there are serious reasons to use semi-colon in python, great. If not,
it is a historical artifact.

-Original Message-
From: Python-list  On
Behalf Of Thomas Passin
Sent: Wednesday, February 22, 2023 7:24 PM
To: python-list@python.org
Subject: Re: Introspecting the variable bound to a function argument

On 2/22/2023 3:12 PM, Hen Hanna wrote:
> On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:
>> Hello, all.
>>
>> Does Python have an instrospection facility that can determine to 
>> which outer variable a function argument is bound, e.g.:
>>
>> v1 = 5;
>> v2 = 5;
> 
> 
> do some Python coders like to end lines with   ;   ?

Very few, probably.  It's not harmful but adds unnecessary visual clutter.

>>
>>  def f(a):
>> print(black_magic(a))# or
black_magic('a')
>>
>>  f(v1)# prints: v1
>>  f(v2)# prints: v2
>>
> 
> the term  [call by name]  suggests  this should be possible.
> 
> 
> 30 years ago...  i used to think about this type of thing A LOT ---
>   ---  CBR, CBV, CBN,   (call by value),(call by name)
etc.
> 

--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Thomas Passin

On 2/22/2023 6:46 PM, Hen Hanna wrote:

On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote:

py bug.py

Traceback (most recent call last):
File "C:\Usenet\bug.py", line 5, in 
print( a + 12 )
TypeError: can only concatenate str (not "int") to str


Why doesn't Python (error msg) do the obvious thing and tell me
WHAT the actual (offending, arg) values are ?

In many cases, it'd help to know what string the var A had , when the error 
occurred.
 i wouldn't have to put print(a) just above, to see.




( pypy doesn't do that either, but Python makes programming (debugging) so easy 
that i hardly feel any inconvenience.)




i  see that my example   would be clearER  with this one-line  change:


   >  py   bug.py

Traceback (most recent call last):

   File "C:\Usenet\bug.py", line 5, in 
  map( Func,fooBar(  X,  Y,  X +  Y 
 ))
  
TypeError: can only concatenate str (not "int") to str



i hope that   NOW   a few of you  can  see this as a genuine,  (reasonable)  
question.


It tells me to go look at the function definition and how it's being 
invoked.  Even if I knew which of (X, Y) was an int and which a str, I'd 
still need to do that.


Or you could add type annotations to your code and run mypy on it...


--
https://mail.python.org/mailman/listinfo/python-list


Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Thomas Passin

On 2/22/2023 3:12 PM, Hen Hanna wrote:

On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:

Hello, all.

Does Python have an instrospection facility that can
determine to which outer variable a function argument is
bound, e.g.:

v1 = 5;
v2 = 5;



do some Python coders like to end lines with   ;   ?


Very few, probably.  It's not harmful but adds unnecessary visual clutter.



 def f(a):
print(black_magic(a))# or black_magic('a')

 f(v1)# prints: v1
 f(v2)# prints: v2



the term  [call by name]  suggests  this should be possible.


30 years ago...  i used to think about this type of thing A LOT ---
  ---  CBR, CBV, CBN,   (call by value),(call by name)   
etc.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna
On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote:
> > py bug.py 
> Traceback (most recent call last): 
> File "C:\Usenet\bug.py", line 5, in  
> print( a + 12 ) 
> TypeError: can only concatenate str (not "int") to str 
> 
> 
> Why doesn't Python (error msg) do the obvious thing and tell me 
> WHAT the actual (offending, arg) values are ? 
> 
> In many cases, it'd help to know what string the var A had , when the error 
> occurred. 
>  i wouldn't have to put print(a) just above, to see. 
> 
> 
> 
> 
> ( pypy doesn't do that either, but Python makes programming (debugging) so 
> easy that i hardly feel any inconvenience.)



i  see that my example   would be clearER  with this one-line  change:


  >  py   bug.py

   Traceback (most recent call last):

  File "C:\Usenet\bug.py", line 5, in 
 map( Func,fooBar(  X,  Y,  X +  Y  
))
 
   TypeError: can only concatenate str (not "int") to str


i hope that   NOW   a few of you  can  see this as a genuine,  (reasonable)  
question.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Line continuation and comments

2023-02-22 Thread Cameron Simpson

On 22Feb2023 11:27, Thomas Passin  wrote:

On 2/22/2023 10:02 AM, Weatherby,Gerard wrote:

That’s a neat tip. End of line comments work, too

x = (3 > 4  #never
 and 7 == 7  # hopefully
 or datetime.datetime.now().day > 15 # sometimes
 )
print(x)


I find myself doing this more and more often.  It can also help to 
make the code more readable and the intention more clear. Here's one 
example:


   return (getTerminalFromProcess()
   or getTerminalFromDirectory('/usr/bin')
   or getTerminalFromDirectory('/bin')
   or getCommonTerminal(('konsole', 'xterm'))
   )


Aye, me too.

I autoformat my code using `yapf` (I _hate_ `black`) and append my 
personal code style below. In particular, note the 
`split_before_logical_operator` which does the above automatically when 
it reflows a logical expression (you need the brackets, but you need 
them anyway for multiline stuff if you're eschewing the backslash).


[style]
based_on_style = pep8
align_closing_bracket_with_visual_indent = True
arithmetic_precedence_indication = False
blank_line_before_module_docstring = True
blank_line_before_nested_class_or_def = True
blank_lines_around_top_level_definition = 1
dedent_closing_brackets = True
indent_dictionary_value = False
indent_width = 2
space_between_ending_comma_and_closing_bracket = False
spaces_before_comment = 2
split_before_dot = True
split_before_expression_after_opening_paren = True
split_before_first_argument = True
split_before_logical_operator = True
split_complex_comprehension = True
use_tabs = False

So basicly PEP8 with some tweaks.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python + Vim editor

2023-02-22 Thread Mats Wichmann

On 2/22/23 11:16, Tramiv wrote:

On 2023-02-22, Hen Hanna  wrote:


what editor do you (all) use to write Python code?  (i use Vim)



For short editin I also use Vim and Pycharm IDE for bigger projects.



The community has submitted some answers to that question here (two 
lists, some entrants don't fit neatly into one or the other):


https://wiki.python.org/moin/PythonEditors
https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

There are a *lot* if you want to rathole... :)




--
https://mail.python.org/mailman/listinfo/python-list


RE: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread avi.e.gross
Hen or Hanna,

You keep asking WHY which may be reasonable but hard or irrelevant in many
cases.

I find the traceback perfectly informative.

It says you asked it to print NOT just "a" but "a + 12" and the error is
coming not from PRINT but from trying to invoke addition between two objects
that have not provided instructions on how to do so. Specifically, an object
of type str has not specified anything to do if asked to concatenate an
object of type int to it. And, an object of type int has not specified what
to do if asked to add itself to an object of type str to the left of it.
Deeper in python, the objects have dunder methods like __ADD__() and
___RADD__() to invoke for those situations that do some logic and decide
they cannot handle it and return an exception of sorts that ends up
generating your message.

If you want to know what "a" has at the moment, ask for just it, not adding
twelve to it. Perhaps you should add a line above your print asking to just
print(a).

Before you suggest what might be helpful, consider what it might mean in a
complex case with lots of variables and what work the interpreter might have
to do to dump the current values of anything relevant or just ANYTHING.

The way forward is less about asking why but asking what to do to get what
you want, or realize it is not attained the way you thought.

Avi

-Original Message-
From: Python-list  On
Behalf Of Hen Hanna
Sent: Wednesday, February 22, 2023 3:05 PM
To: python-list@python.org
Subject: Why doesn't Python (error msg) tell me WHAT the actual (arg) values
are ?


  >  py   bug.py
   Traceback (most recent call last):
 File "C:\Usenet\bug.py", line 5, in 
 print( a + 12 )
  TypeError: can only concatenate str (not "int") to str


Why doesn't  Python (error msg) do the obvious thing and tell me
WHAT   the actual   (offending,  arg)  values are ?

In many cases, it'd help to know what string the var  A  had  ,   when the
error occurred.
   i wouldn't have to put  print(a) just
above,  to see.




( pypydoesn't do that either,   but Python makes programming (debugging)
so easy that i hardly feel any inconvenience.)
-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-22 Thread Hen Hanna


it seems like a few weeks ago... but
   actually it was more like 30 years ago
that i was programming in C,  and

i'd get
 [Segmentation Fault] (core dumped)
  [Bus Error]  (core dumped)
  [access violation] (core dumped)
  [bad address]

and,   yes,  some of us   sometimes  analyzed the core file.



i  (vaguely) fantasized that someday   programming would be much more pleasant 
-- and  that  programming language would be  something like  Common 
Lisp  with a more   Algol, Pascal (C) like syntax.


i've been using Python for 3,4 years and .. 

for the first  several weeks... whenever i used Python...  all 
i could think ofwas     this is really Lisp (inside) with  a thin 
veil of   Java/Pascal syntax..

   -  that  everything is  first converted  (macro-expanded)  
into (intermediated) Lisp code, and then.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: is [comprehension] the right word???

2023-02-22 Thread Hen Hanna
On Monday, February 20, 2023 at 5:45:39 PM UTC-8, Paul Rubin wrote:
> Hen Hanna  writes: 
> > is [comprehension] the right word???

> Yes, it comes from math, particularly set theory. An expression like 
> 
> { n | n:integer, n mod 2 = 0 } 
> 
> is called a set comprehension, and then one there denotes the set of all 
> even integers. Axioms saying that the above denotes a legitimate set 
> are called comprehension axioms. In ZFC (an axiomitization of set 
> theory widely used in math), there is an infinite schema of such axioms. 
> 
> The Haskell language used a notation inspired by this for "list 
> comprehensions", and Python list (and later dictionary etc.) 
> comprehensions were inspired by Haskell's version.


thank you   i did a search thru   Google.Books  and found  just 1  hit  
(before 1970).



The Cambridge History of Later Greek and Early Medieval ... - Page 133
books.google.com › books
A. H. Armstrong · 1967
  FOUND INSIDE – PAGE 133
Too powerful , in fact : in 1902 , Russell showed that it is inconsistent , 
since it implies Russell's Antinomy ( see Russell's letter to Frege in van 
Heijenoort 1967 ) . Law V is close to what has become known as the Set 
Comprehension Principle (SCP)   

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Hen Hanna
On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:
> Hello, all. 
> 
> Does Python have an instrospection facility that can 
> determine to which outer variable a function argument is 
> bound, e.g.: 
> 
> v1 = 5; 
> v2 = 5; 


do some Python coders like to end lines with   ;   ?


> 
> def f(a): 
>print(black_magic(a))# or black_magic('a') 
> 
> f(v1)# prints: v1 
> f(v2)# prints: v2 
> 

the term  [call by name]  suggests  this should be possible.


30 years ago...  i used to think about this type of thing A LOT ---
 ---  CBR, CBV, CBN,   (call by value),(call by name)   etc.

-- 
https://mail.python.org/mailman/listinfo/python-list


Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-22 Thread Hen Hanna


  >  py   bug.py
   Traceback (most recent call last):
 File "C:\Usenet\bug.py", line 5, in 
 print( a + 12 )
  TypeError: can only concatenate str (not "int") to str


Why doesn't  Python (error msg) do the obvious thing and tell me
WHAT   the actual   (offending,  arg)  values are ?

In many cases, it'd help to know what string the var  A  had  ,   when the 
error occurred.
   i wouldn't have to put  print(a) just above, 
 to see.




( pypydoesn't do that either,   but Python makes programming (debugging) so 
easy that i hardly feel any inconvenience.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating logs with Python

2023-02-22 Thread Dave (NK7Z)

Thank you Gerard!  I am working on a project and needed that...  :)

73, and thanks,
Dave (NK7Z)
https://www.nk7z.net
ARRL Volunteer Examiner
ARRL Technical Specialist, RFI
ARRL Asst. Director, NW Division, Technical Resources

On 2/22/23 07:03, Weatherby,Gerard wrote:

https://docs.python.org/3/howto/logging.html

From: Python-list  on behalf of 
Bibi 
Date: Wednesday, February 22, 2023 at 9:44 AM
To: python-list@python.org 
Subject: Creating logs with Python
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Hello
I want to store and make available as part of my project, logs, for access to 
data. Do you have any proposals?
Kind regards
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ntBEz59Ey9Aq3lepQ3xSKwSYtD_mYgoMO3OPqxMUrzbHNliAV76yHKsVIbEDpznq3hXNHvGxG3RNUPVxj5k$

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python + Vim editor

2023-02-22 Thread Thomas Passin

On 2/22/2023 1:45 PM, orzodk wrote:

Thomas Passin  writes:


On 2/22/2023 12:00 AM, orzodk wrote:

Thomas Passin  writes:


On 2/21/2023 9:00 PM, Hen Hanna wrote:

what editor do you (all) use to write Python code?  (i use Vim)


I usually use the Leo-editor (https://github.com/leo-editor/leo-editor
or PyPi).  It's wonderful once you get it figured out but it's got a
real learning curve.

I had never heard of Leo before. This is a real rabbit-hole. Thanks
for
sharing this interesting editor.


There's also a Google Group: https://groups.google.com/g/leo-editor

Leo does dog-fooding: Leo's own code base (hundreds of Python files)
is contained and developed in a Leo file (called an "outline").  I
just this afternoon searched it to find where a particular core method
is called in less than a second (two places, it turned out).  Leo lets
you break down a program or other chunk of code into whatever pieces
you like, not being limited to modules, classes, methods, and
functions, and to rearrange them pretty much at will.

Much of Leo's documentation is in Sphinx documents that are authored
and managed in Leo outlines - it's an excellent documentation tool.

More of how I use it is at
https://leo-editor.github.io/leo-editor/testimonials.html#thomas-passin


I watched a couple of the intro videos and saw the dog-fooding. Leo is a
total paradigm shift for me. Thanks for links, I'll be sure to check
them out.


Good luck!  Please contact me or the Google Group if you need help or 
guidance.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python + Vim editor

2023-02-22 Thread orzodk
Thomas Passin  writes:

> On 2/22/2023 12:00 AM, orzodk wrote:
>> Thomas Passin  writes:
>> 
>>> On 2/21/2023 9:00 PM, Hen Hanna wrote:
 what editor do you (all) use to write Python code?  (i use Vim)
>>>
>>> I usually use the Leo-editor (https://github.com/leo-editor/leo-editor
>>> or PyPi).  It's wonderful once you get it figured out but it's got a
>>> real learning curve.
>> I had never heard of Leo before. This is a real rabbit-hole. Thanks
>> for
>> sharing this interesting editor.
>
> There's also a Google Group: https://groups.google.com/g/leo-editor
>
> Leo does dog-fooding: Leo's own code base (hundreds of Python files)
> is contained and developed in a Leo file (called an "outline").  I
> just this afternoon searched it to find where a particular core method
> is called in less than a second (two places, it turned out).  Leo lets
> you break down a program or other chunk of code into whatever pieces
> you like, not being limited to modules, classes, methods, and
> functions, and to rearrange them pretty much at will.
>
> Much of Leo's documentation is in Sphinx documents that are authored
> and managed in Leo outlines - it's an excellent documentation tool.
>
> More of how I use it is at
> https://leo-editor.github.io/leo-editor/testimonials.html#thomas-passin

I watched a couple of the intro videos and saw the dog-fooding. Leo is a
total paradigm shift for me. Thanks for links, I'll be sure to check
them out.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python + Vim editor

2023-02-22 Thread Tramiv
On 2023-02-22, Hen Hanna  wrote:
>
> what editor do you (all) use to write Python code?  (i use Vim)
>

For short editin I also use Vim and Pycharm IDE for bigger projects.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Barry
please do not use an email address on a public list that cannot be replied to.


> On 22 Feb 2023, at 14:43, Anton Shepelev  wrote:
> 
> Hello, all.
> 
> Does Python have an instrospection facility that can
> determine to which outer variable a function argument is
> bound, e.g.:

There is no requirement for a variable to be used in the call.
It could be an an int or string, 42 “forty two”.

> 
>  v1 = 5;
>  v2 = 5;
> 
>  def f(a):
>  print(black_magic(a)) # or black_magic('a')
> 
>  f(v1) # prints: v1
>  f(v2) # prints: v2

There is the traceback module that lets you find where you are called from.
Also there is the inspect module that also lets tou get at the stack in more 
detail.

Barry

> 
> -- 
> ()  ascii ribbon campaign -- against html e-mail
> /\  www.asciiribbon.org   -- against proprietary attachments
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Line continuation and comments

2023-02-22 Thread Thomas Passin

On 2/22/2023 10:02 AM, Weatherby,Gerard wrote:

That’s a neat tip. End of line comments work, too

x = (3 > 4  #never
  and 7 == 7  # hopefully
  or datetime.datetime.now().day > 15 # sometimes
  )
print(x)


I find myself doing this more and more often.  It can also help to make 
the code more readable and the intention more clear. Here's one example:


return (getTerminalFromProcess()
or getTerminalFromDirectory('/usr/bin')
or getTerminalFromDirectory('/bin')
or getCommonTerminal(('konsole', 'xterm'))
)

It's easier to read than using a "\" at the end of lines, writing it all 
on one line would make for an unreadably long line, while building up 
the final result in steps would make the logic less clear.




From: Python-list  on behalf of 
Edmondo Giovannozzi 
Date: Wednesday, February 22, 2023 at 9:40 AM
To: python-list@python.org 
Subject: Re: Line continuation and comments
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha 
scritto:

I found myself building a complicated logical condition with many ands and ors
which I made more manageable by putting the various terms on individual lines
and breaking them with the "\" line continuation character. In this context it
would have been nice to be able to add comments to lines terms which of course
isn't possible because the backslash must be the last character on the line.

Question: If the Python syntax were changed to allow comments after line-ending
backslashes, would it break any existing code? I can't think of an example.


Well you can if you use parenthesis like in:
x = 5
a = (x > 3 and
# x < 21 or
  x > 100
  )
You don't need the "\" to continue a line in this case

--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!kck9yP0ubC7L_tbIUoMY-nkZJlkXFAiZdnjPtekuYQXN6F8K2wFMW5lO1xZ6gYv6vDdsSo5jxy1QYU_T-EgHsOJ6x7TvXQ$


--
https://mail.python.org/mailman/listinfo/python-list


Re: Line continuation and comments

2023-02-22 Thread Weatherby,Gerard
That’s a neat tip. End of line comments work, too

x = (3 > 4  #never
 and 7 == 7  # hopefully
 or datetime.datetime.now().day > 15 # sometimes
 )
print(x)

From: Python-list  on 
behalf of Edmondo Giovannozzi 
Date: Wednesday, February 22, 2023 at 9:40 AM
To: python-list@python.org 
Subject: Re: Line continuation and comments
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha 
scritto:
> I found myself building a complicated logical condition with many ands and ors
> which I made more manageable by putting the various terms on individual lines
> and breaking them with the "\" line continuation character. In this context it
> would have been nice to be able to add comments to lines terms which of course
> isn't possible because the backslash must be the last character on the line.
>
> Question: If the Python syntax were changed to allow comments after 
> line-ending
> backslashes, would it break any existing code? I can't think of an example.

Well you can if you use parenthesis like in:
x = 5
a = (x > 3 and
# x < 21 or
 x > 100
 )
You don't need the "\" to continue a line in this case

--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!kck9yP0ubC7L_tbIUoMY-nkZJlkXFAiZdnjPtekuYQXN6F8K2wFMW5lO1xZ6gYv6vDdsSo5jxy1QYU_T-EgHsOJ6x7TvXQ$
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Line continuation and comments

2023-02-22 Thread Paul Bryan
Adding to this, there should be no reason now in recent versions of
Python to ever use line continuation. Black goes so far as to state
"backslashes are bad and should never be used":

https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#using-backslashes-for-with-statements

On Wed, 2023-02-22 at 01:24 -0800, Edmondo Giovannozzi wrote:
> Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert
> Latest ha scritto:
> > I found myself building a complicated logical condition with many
> > ands and ors 
> > which I made more manageable by putting the various terms on
> > individual lines 
> > and breaking them with the "\" line continuation character. In this
> > context it 
> > would have been nice to be able to add comments to lines terms
> > which of course 
> > isn't possible because the backslash must be the last character on
> > the line. 
> > 
> > Question: If the Python syntax were changed to allow comments after
> > line-ending 
> > backslashes, would it break any existing code? I can't think of an
> > example.
> 
> Well you can if you use parenthesis like in:
> x = 5
> a = (x > 3 and
> # x < 21 or
>  x > 100
>  )
> You don't need the "\" to continue a line in this case
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating logs with Python

2023-02-22 Thread Weatherby,Gerard
https://docs.python.org/3/howto/logging.html

From: Python-list  on 
behalf of Bibi 
Date: Wednesday, February 22, 2023 at 9:44 AM
To: python-list@python.org 
Subject: Creating logs with Python
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Hello
I want to store and make available as part of my project, logs, for access to 
data. Do you have any proposals?
Kind regards
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ntBEz59Ey9Aq3lepQ3xSKwSYtD_mYgoMO3OPqxMUrzbHNliAV76yHKsVIbEDpznq3hXNHvGxG3RNUPVxj5k$
-- 
https://mail.python.org/mailman/listinfo/python-list


Creating logs with Python

2023-02-22 Thread Bibi
Hello
I want to store and make available as part of my project, logs, for access to 
data. Do you have any proposals?
Kind regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Introspecting the variable bound to a function argument

2023-02-22 Thread Anton Shepelev
Hello, all.

Does Python have an instrospection facility that can
determine to which outer variable a function argument is
bound, e.g.:

   v1 = 5;
   v2 = 5;

   def f(a):
   print(black_magic(a)) # or black_magic('a')

   f(v1) # prints: v1
   f(v2) # prints: v2

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Line continuation and comments

2023-02-22 Thread Edmondo Giovannozzi
Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha 
scritto:
> I found myself building a complicated logical condition with many ands and 
> ors 
> which I made more manageable by putting the various terms on individual lines 
> and breaking them with the "\" line continuation character. In this context 
> it 
> would have been nice to be able to add comments to lines terms which of 
> course 
> isn't possible because the backslash must be the last character on the line. 
> 
> Question: If the Python syntax were changed to allow comments after 
> line-ending 
> backslashes, would it break any existing code? I can't think of an example.

Well you can if you use parenthesis like in:
x = 5
a = (x > 3 and
# x < 21 or
 x > 100
 )
You don't need the "\" to continue a line in this case

-- 
https://mail.python.org/mailman/listinfo/python-list


Line continuation and comments

2023-02-22 Thread Robert Latest via Python-list
I found myself building a complicated logical condition with many ands and ors
which I made more manageable by putting the various terms on individual lines
and breaking them with the "\" line continuation character. In this context it
would have been nice to be able to add comments to lines terms which of course
isn't possible because the backslash must be the last character on the line.

Question: If the Python syntax were changed to allow comments after line-ending
backslashes, would it break any existing code? I can't think of an example.
-- 
https://mail.python.org/mailman/listinfo/python-list


__getattr__ is much slower in Python3.11

2023-02-22 Thread 王翔
hello everyone:
I upgrade my project from Py3.10.4 to Py3.11.1 recently and I noticed Py3.11.1 
is faster than Py3.10.4 except for some testcase, like __getattr__.
This is my test code in python discussion:
https://discuss.python.org/t/getattr-is-much-slower-in-python3-11/24028


But no one knows why. I don't know whether this is a Python bug so I wrote this 
email. 
Thank you for your time.
-- 
https://mail.python.org/mailman/listinfo/python-list