Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: > > On 15/01/2021 15.26, Stefan Ram wrote: > > "Michael F. Stemper" writes: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it completely at odds > >> with

Re: How to flush 's stdout stream?

2021-01-15 Thread Grant Edwards
On 2021-01-15, Eryk Sun wrote: > On 1/15/21, Grant Edwards wrote: >> In Python 3.7+, how does one flush the stdout FILE stream? I mean the >> FILE *declared as 'stdio' in . I'm _not_ asking how to flush the >> Python file object sys.stdio. > > You can flush all output streams via C fflush(NULL).

Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. Here's a small example (nbtest.py): ---8< --- #!/usr/bin/env python3 import tkinter as tk

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread MRAB
On 2021-01-15 20:51, Rich Shepard wrote: I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. Here's a small example (nbtest.py): ---8< ---

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 15/01/2021 17:31, Grant Edwards wrote: > cur.putp(cls) name = input("Hello, what's your name? ") cur.putp(bold) print("Nice to meet you ", name) > > >>> putp(clr); >>> putp(bold); >>> printf("Enter a name:

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.00, Chris Green wrote: Michael F. Stemper wrote: On 14/01/2021 13.00, Rob Cliffe wrote: On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Dennis Lee Bieber wrote: Off-hand, I'd suspect you should be adding these to the NOTEBOOK object "n". Dennis, You're correct. The MWE didn't have the proper syntax. Now, the problem is the notebook doesn't display its tabs on the main window, while the proper

Re: why sqrt is not a built-in function?

2021-01-15 Thread Rob Cliffe via Python-list
On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! I agree that, especially if you have experience in other languages, this feels odd, and I have some

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 21:30, Barry Scott wrote: >> During lockdown I've been digging deeper into the curses module >> and lately into the ti family of functions that reside there. > It seems that curses does not allow you to mix raw stdin/stdout with its > calls. That's true of curses after you

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 23:08, Grant Edwards wrote: > Alternatively, I think you can use the ncurses library to retrieve the control > strings (just don't use any ncurses input/output calls), like this example > from > https://stackoverflow.com/questions/6199285/tput-cup-in-python-on-the-commandline: > >

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 22:11, Grant Edwards wrote: > Or use a terminfo library: > > https://github.com/DirectXMan12/py-terminfo > > It _may_ be possible to use ncurses to get the terminfo strings > required for various functions without actually having ncurses to any > I/O, but I've never tried

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 16:12, Alan Gauld via Python-list wrote: > # > import curses as cur > cur.setupterm() > > bold = cur.tigetstr('bold') > cls = cur.tigetstr('clear') > > cur.putp(cls) > name = input("Hello, what's your name? ") > > cur.putp(bold) > print("Nice to meet you ", name)

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 14/01/2021 16:12, Alan Gauld via Python-list wrote: > >> # >> import curses as cur >> cur.setupterm() >> >> bold = cur.tigetstr('bold') >> cls = cur.tigetstr('clear') >> >> cur.putp(cls) >> name = input("Hello, what's your

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > I suspect that the problem is that putp is writing to the libc > "stdout" FILE stream that's declaredin . That stream > layer/object has buffering that is invisible to Python. Python's > sys.stdout.flush() is flushing the Python file object's output buffers

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 15/01/2021 17:31, Grant Edwards wrote: >>> cur.putp(cls) >>> name = input("Hello, what's your name? ") >>> >>> cur.putp(bold) >>> print("Nice to meet you ", name) >> putp(clr); >> putp(bold); >> printf("Enter a name: "); >> fgets(line, sizeof(line),stdin); >> >>

How to flush 's stdout stream?

2021-01-15 Thread Grant Edwards
In Python 3.7+, how does one flush the stdout FILE stream? I mean the FILE *declared as 'stdio' in . I'm _not_ asking how to flush the Python file object sys.stdio. The problem is that some Python modules write to FILE *stdio, but don't flush the stream so that the data gets written to the

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 14/01/2021 13.00, Rob Cliffe wrote: On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! I agree that, especially if you have experience in other languages,

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: > Here's the status of the square root function in various languages, > in the order that I encountered them: > > FORTRANPart of the language > Pascal Part of the language > SNOBOL Part of the language > c Need to

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 7:45 AM Michael F. Stemper wrote: > > Languages differ. I don't see why it's so important to focus on just > > one thing - and to complain that, even though it's in the standard > > library, you have to use an import command to get it. > > You should probably direct this

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, MRAB wrote: You should be adding the frames to the notebook. Also, the tabs are 'self.tab1', not 'tab1', etc: n.add(self.tab1, text='Activities') Similarly for the others. Thanks. MRAB. This allows me to move on and put pre-built widget pages on the tabs.

[issue42849] pool worker can't be terminated

2021-01-15 Thread ppperry
ppperry added the comment: duplicate of issue22393? -- nosy: +ppperry ___ Python tracker ___ ___ Python-bugs-list mailing list

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 15/01/2021 06.44, Denys Contant wrote: > I don't understand why sqrt is not a built-in function. > Why do we have to first import the function from the math module? > I use it ALL THE TIME! > > That felt good. Thank you. Are you 'venting', or do you have a specific frustration-induced

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:47 AM Michael F. Stemper wrote: > > On 15/01/2021 16.01, Chris Angelico wrote: > > On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper > > wrote: > >> > >> On 15/01/2021 15.26, Stefan Ram wrote: > >>> "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Green
Michael F. Stemper wrote: > On 14/01/2021 13.00, Rob Cliffe wrote: > > On 14/01/2021 17:44, Denys Contant wrote: > > >> I don't understand why sqrt is not a built-in function. > >> Why do we have to first import the function from the math module? > >> I use it ALL THE TIME! > > I agree that,

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it completely at odds with The Zen of Python. I'm torn between forgetting that I ever saw it and using it for

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:16 AM Michael F. Stemper wrote: > > On 15/01/2021 14.01, Stefan Ram wrote: > > "Michael F. Stemper" writes: > > >> Of these, only EcmaScript has > >> Math.sqrt() as part of the language, and that could be partly > >> due to the fact that

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > Entities that are parameterized (e.g. goto location) would need to be > passed through curses.tiparm() before they're decoded and printed. I'm > goign to try that next. The curses module doesn't expose tiparm, but you can use tparm instead:

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: How to flush 's stdout stream?

2021-01-15 Thread Eryk Sun
On 1/15/21, Grant Edwards wrote: > In Python 3.7+, how does one flush the stdout FILE stream? I mean the > FILE *declared as 'stdio' in . I'm _not_ asking how to flush the > Python file object sys.stdio. You can flush all output streams via C fflush(NULL). If it has to be just stdout, the code

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.02, Chris Angelico wrote: On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: Here's the status of the square root function in various languages, in the order that I encountered them: FORTRANPart of the language Pascal Part of the language SNOBOL Part of the

Re: why sqrt is not a built-in function?

2021-01-15 Thread Eli the Bearded
In comp.lang.python, Chris Angelico wrote: > Michael F. Stemper wrote: >> On 15/01/2021 14.01, Stefan Ram wrote: >>> __import__( "math" ).sqrt( 4 ) >> I had no idea that syntax existed, and find it completely at odds >> with The Zen of Python. I'm torn between forgetting that I ever saw >> it

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > On 2021-01-15, Alan Gauld via Python-list wrote: >> On 15/01/2021 17:31, Grant Edwards wrote: >> >>> I suspect that the problem is that putp is writing to the libc >>> "stdout" FILE stream that's declaredin . That stream >>> layer/object has buffering that

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Alan Gauld via Python-list wrote: > On 15/01/2021 17:31, Grant Edwards wrote: > >> I suspect that the problem is that putp is writing to the libc >> "stdout" FILE stream that's declaredin . That stream >> layer/object has buffering that is invisible to Python. > > That would

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.01, Stefan Ram wrote: "Michael F. Stemper" writes: Of these, only EcmaScript has Math.sqrt() as part of the language, and that could be partly due to the fact that the language doesn't have any concept of "import" or "include". You do not

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 10.49, Michael F. Stemper wrote: ... > Es ist Feierabend You had me there for a moment, because spotting a 'double meaning" (actually triple) my mind succumbing to dissonance, refused to translate (into English), instead latching onto the last two syllables:- At one time,

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it

Vulture 2.2

2021-01-15 Thread Jendrik Seipp
Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you run Vulture on both your library and test suite you can find untested code. Due to Python's dynamic nature, static code

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:25 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Chris Angelico wrote: > > Michael F. Stemper wrote: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it

[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-01-15 Thread CDirkx
New submission from CDirkx : Currently the method `ipaddress.is_global` returns true for the IPv4 address 192.0.0.8. This was correct when `is_global` was initially implemented, but in 2015 192.0.0.8 got designated as the "IPv4 dummy address" and not globally reachable, see the IANA special

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 10:18 AM dn via Python-list wrote: > >> I am confuzzed. > > > > It's a common condition. > > There are three components: > 1 From the Greek: "con" meaning 'against' or 'unable'. > 2 From tech-jargon (and the Australian habit of shortening every word in > the English

[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- components: +C API -Interpreter Core title: Not installed “libgcc_s.so.1” causes parser crash. -> Not installed “libgcc_s.so.1” causes exit crash. ___ Python tracker

Re: why sqrt is not a built-in function?

2021-01-15 Thread Greg Ewing
On 16/01/21 10:14 am, Michael F. Stemper wrote: I had no idea that syntax existed, and find it completely at odds with The Zen of Python. It's not an *obvious* way, so there's no Zen conflict. As for why it exists, it's part of the mechanism that implements imports -- 'import' statements get

[issue42889] Incorrect behavior after ast node visits

2021-01-15 Thread Xinmeng Xia
Xinmeng Xia added the comment: Thank you for your kindly explanations! The output of the first program in msg384799 behaves as expected from the view of AST compiling. Yes,I see now. But for the second example in msg384879, the behaviors are inconsistent between old Python

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Cameron Simpson wrote: > On 15Jan2021 18:36, Alan Gauld wrote: >>> One difference is that the name prompt is being written to stdout in >>> the C version and stderr in the Python version. But I don't see why >>> that would matter. >> >>That could make a big difference, the putp()

Re: binascii.b2a vs ord()

2021-01-15 Thread Bischoop
On 2021-01-10, Chris Angelico wrote: > > Hope that helps! > Yep, now it seems more understandable what is going on. Thanks for you time. -- Thanks -- https://mail.python.org/mailman/listinfo/python-list

HEKLP

2021-01-15 Thread Z3PS1
NEED HELP WITH MY IDLE   Sent from [1]Mail for Windows 10   References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list

Re: HEKLP

2021-01-15 Thread Terry Reedy
On 1/16/2021 12:23 AM, Z3PS1 wrote: NEED HELP WITH MY IDLE Sent from [1]Mail for Windows 10 References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 I answer real IDLE questions, but this looks like spam to drive traffic to the hidden link, so I am ignoring

[issue42889] Incorrect behavior after ast node visits

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: The parser is not involved here. The transformed code is *not* equivalent to "1=2; print(1)" because you replace 'a' with the string '1', not the int 1. The result is to transform "globals()['a']=2; print(globals()['a'])" to "globals()['1']=2;

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread Xinmeng Xia
Xinmeng Xia added the comment: Thank you. But I am not sure this is a recursion problem. Please see the following example, I replace "__sizeof__" with "__class__". No segmentation fault. Everything goes well. mystr = "hello123" print(dir(mystr)) for x in

Re: Exploring terminfo

2021-01-15 Thread Greg Ewing
On 16/01/21 3:37 pm, Chris Angelico wrote: Surely it should be the other way around? If you use the C stdio streams, flush them after use. 1. You might not know that you're (implicitly) using C stdio. 2. There doesn't seem to be an easy way to flush C stdio from Python any more. -- Greg --

Re: count consecutive elements

2021-01-15 Thread Bischoop
On 2021-01-14, Tim Chase wrote: > > seems to only return one value so seems to get odd results if I > specify something like > > get_longest("aaabcccbbb") > > which at least here tells me that "c" is the longest run, even though > aaa, bbb, and ccc are all runs of length 3. The OP didn't

Re: count consecutive elements

2021-01-15 Thread Tim Chase
On 2021-01-16 03:32, Bischoop wrote: >> The OP didn't specify what should happen in that case, so it would >> need some clarification. > > In that case maybe good solution would be to return three of them? That's the solution I chose in my initial reply, you get a tuple back of ([list of longest

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Rich Shepard wrote: Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of the window. I'll read the options on grid. The notebook tabs are placed on the grid as nb.grid(row=0, column=0,

Re: Exploring terminfo

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 1:36 PM Greg Ewing wrote: > > On 16/01/21 7:33 am, Grant Edwards wrote: > > Starting in Python 3., python's stdio file objects are _not_ > > on top of the libc FILE streams: they're directly on top of the file > > descriptor. > > This sounds like rather a bad situation,

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
My previous code didn't work if the terminfo entities contained delay specifiers because the delay specifier was left in the output datastream. The case where the terminfo description contains delays, but the delays aren't needed can be handled by simply removing the delay specifiers by wrapping

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Terry Reedy
On 1/15/2021 3:51 PM, Rich Shepard wrote: I want to replace the menu on my application with the more appropriate notebook. After looking at examples in my reference books and on the Web I still cannot get it working properly. IDLE's settings dialog uses a ttk.Notebook. The file is

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2021-01-15 Thread hai shi
hai shi added the comment: >Not a function, shouldn't be used with PyType_Slot: > * tp_dict - I'd add a PyType_GetDict if there is a need to get this > * tp_mro - I'd add a PyType_GetMRO if there is a need to get this I checked some other projects which use type fileds directly. cpython

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Rich Shepard wrote: The file 'application.py' is attached. If I had better docs here I could probably work a lot of this out by myself. Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of

Re: Exploring terminfo

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 2:16 PM Greg Ewing wrote: > > On 16/01/21 3:37 pm, Chris Angelico wrote: > > Surely it should be the other way around? If you use the C stdio > > streams, flush them after use. > > 1. You might not know that you're (implicitly) using C stdio. > > 2. There doesn't seem to

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Greg Ewing wrote: > On 16/01/21 7:33 am, Grant Edwards wrote: > >> Starting in Python 3., python's stdio file objects are _not_ >> on top of the libc FILE streams: they're directly on top of the file >> descriptor. > > This sounds like rather a bad situation, because it means that

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-16, Chris Angelico wrote: > On Sat, Jan 16, 2021 at 1:36 PM Greg Ewing > wrote: > >> Can something be done about this? Maybe Python stdio objects >> should flush all the C stdio streams before writing anything? >> > > Surely it should be the other way around? If you use the C stdio >

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Xinmeng, to verify Ronald's explanation, run this instead mystr = "hello123" for x in range(100): mystr = mystr.__sizeof__() input('>') # Hit Enter to continue. del mystr # Expect crash here. input('<') # And never get here. -- nosy:

[issue42916] Support for DICOM image file format in imghdr module

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Can you submit a patch, or post here an test_dicom function? -- nosy: +terry.reedy stage: -> needs patch ___ Python tracker ___

[issue37006] Add top level await statement support for doctest

2021-01-15 Thread Austin "Paco" Rainwater
Change by Austin "Paco" Rainwater : -- nosy: +pacorain ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread William Pickard
William Pickard added the comment: Jumping in here to explain why '__class' doesn't crash when '__sizeof__' does: When '__class__' is fetched, it returns a new reference to the object's type. When '__sizeof__' is fetched on the otherhand, a new object is allocated on the heap

[issue42935] Pickle can't import builtins at exit

2021-01-15 Thread Guido van Rossum
Guido van Rossum added the comment: I don’t know there is much we can do about this. I recommend using ‘with’ to close the shelf earlier. -- nosy: +gvanrossum ___ Python tracker

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread MRAB
On 2021-01-16 00:16, Rich Shepard wrote: On Fri, 15 Jan 2021, Rich Shepard wrote: Progress: I didn't put the notebook on the main window using grid. Now I need to find how to specify the position so it's at the top of the window. I'll read the options on grid. The notebook tabs are placed on

Re: Exploring terminfo

2021-01-15 Thread Greg Ewing
On 16/01/21 7:33 am, Grant Edwards wrote: Starting in Python 3., python's stdio file objects are _not_ on top of the libc FILE streams: they're directly on top of the file descriptor. This sounds like rather a bad situation, because it means that any C library using stdio is going to interact

Re: Exploring terminfo

2021-01-15 Thread Grant Edwards
On 2021-01-15, Grant Edwards wrote: > On 2021-01-15, Grant Edwards wrote: > >> Entities that are parameterized (e.g. goto location) would need to be >> passed through curses.tiparm() before they're decoded and printed. I'm >> goign to try that next. > > The curses module doesn't expose tiparm,

Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard
On Fri, 15 Jan 2021, Terry Reedy wrote: IDLE's settings dialog uses a ttk.Notebook. The file is Lib/idlelib/configdialog.py. Thanks, Terry! I completely forgot that. I'll study the IDLE's code and learn from that. Stay well, Rich -- https://mail.python.org/mailman/listinfo/python-list

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 11.40, Michael F. Stemper wrote: > On 15/01/2021 16.01, Chris Angelico wrote: >> On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper >> wrote: >>> >>> On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram wrote: > >>

Re: Exploring terminfo

2021-01-15 Thread Cameron Simpson
On 15Jan2021 18:36, Alan Gauld wrote: >> One difference is that the name prompt is being written to stdout in >> the C version and stderr in the Python version. But I don't see why >> that would matter. > >That could make a big difference, the putp() function specifically >states that it writes

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42933] OUTPUT WRONG

2021-01-15 Thread Kkshitish
New submission from Kkshitish : try: a = 10 if a == 11: print ("Yes") except: print ("Out") else: print ("No") Output: No The output should be "Out" but it print "No", The else statement should be print when try condition is execute. But the try

[issue42933] OUTPUT WRONG

2021-01-15 Thread Christian Heimes
Christian Heimes added the comment: "No" is the correct output for your code example. Your code does not raise an exception, therefore the else block is executed. Please don't use the bug tracker to get assistance with learning Python. There are community resources like chat and forums

[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-01-15 Thread Christian Heimes
Christian Heimes added the comment: I got bad news. OpenSSL 1.1.1i introduced a regression in cert validation. This affects some cases that involve self-signed certificates. Cert validation fails if a self-signed certificate is used as both a trust anchor (root CA) and EE cert. This may

[issue42927] Inline cache for slots

2021-01-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > What is the next step? I would say just finishing the PR (making sure that we do not miss some arcane edge case) and updating the what's new for 3.10 :) -- ___ Python tracker

[issue42930] xml.parsers.expat results differ buffer_text and / or buffer_size

2021-01-15 Thread Walter Dörwald
Walter Dörwald added the comment: Just a guess, but the buffer size might be so small that the text that you expect gets passed via **two** calls to _char_data(). You should refactor your code the simply collect all the text in _char_data() and act on it in the _end_element() handler. So

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
New submission from Irit Katriel : The TracebackException instance created here https://github.com/python/cpython/blob/63298930fb531ba2bb4f23bc3b915dbf1e17e9e1/Lib/unittest/result.py#L185 is only used for format(), so it can benefit from the compact param added in issue42877. --

[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-15 Thread Ulrich Petri
Ulrich Petri added the comment: That would make it slightly better, but I still think it's a pretty arcane incantation (esp. for newer people). What makes you hesitant to adding the parameter to the convenience functions? -- ___ Python tracker

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Eryk Sun, do you mind to create a PR? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___

[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-15 Thread Irit Katriel
Irit Katriel added the comment: Generally speaking, I don't think it's a good idea to create redundant APIs. If we copy all the params from TracebackException (and it will be all params, why only this one?) that means more code, more tests, more documentation and a higher cognitive load for

[issue7946] Convoy effect with I/O bound threads and New GIL

2021-01-15 Thread Maarten Breddels
Maarten Breddels added the comment: In case someone finds it useful, I've written a blog post on how to visualize the GIL: https://www.maartenbreddels.com/perf/jupyter/python/tracing/gil/2021/01/14/Tracing-the-Python-GIL.html In the comments (or at

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +23046 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24221 ___ Python tracker ___

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +ezio.melotti, michael.foord, rbcollins ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42935] Pickle can't import builtins at exit

2021-01-15 Thread Pete Wicken
New submission from Pete Wicken : Originally found as an issue in Lib/shelve.py; if we attempt to pickle a builtin as the program is exiting then Modules/_pickle.c will fail at the point of the PyImport_Import in save_global. In CPython3.8 this causes a segfault, in CPython3.9 a

[issue42925] Error trace of else inside class

2021-01-15 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23047 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24222 ___ Python tracker ___

[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2021-01-15 Thread gaborjbernat
Change by gaborjbernat : -- nosy: +gaborjbernat ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-15 Thread Mark Shannon
Mark Shannon added the comment: Reducing the size of the frame object seems like a worthwhile goal, but what's the point in increasing the maximum block stack? -- nosy: +Mark.Shannon ___ Python tracker

[issue42693] "if 0:" lines are traced; they didn't use to be

2021-01-15 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42930] xml.parsers.expat results differ buffer_text and / or buffer_size

2021-01-15 Thread Michael XU
Michael XU added the comment: Thank you so much Walter. I think that might be it - it fixed this particular instance, and it makes sense given what you have said. I'll proceed to close this up but will follow up if I encounter this issue when the data has changed. Thanks again! --

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Jens
New submission from Jens : from decimal import Decimal print(-0.9//0.123) # prints -8.0 print(Decimal('-0.9')//Decimal('0.123')) # prints -7 print(-10//4.2) # prints -3.0 print(Decimal('-10')//Decimal('4.2')) # prints -2 -- messages: 385113 nosy: multiks2200 priority: normal severity:

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: The behaviour is deliberate, if unfortunate: it's covered in the documentation here: https://docs.python.org/3/library/decimal.html#decimal-objects - see the paragraph starting > There are some small differences between arithmetic on Decimal objects > and

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Guido van Rossum
Change by Guido van Rossum : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset ba876c44a8d06668e622fb580fdcde45c7a36d48 by Irit Katriel in branch 'master': bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221) https://github.com/python/cpython/commit/ba876c44a8d06668e622fb580fdcde45c7a36d48

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-15 Thread Eryk Sun
Eryk Sun added the comment: I can help, but in this case there isn't much to do. Just replace os.rename() with os.replace(), make a minor doc change, and maybe add a test that ensures a junction can be moved over an existing file on the same filesystem. For example: >>> os.mkdir('temp')

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the report. I'm going to close here, since this isn't a bug. If you want to advocate for a behaviour change, by all means go ahead, but be aware that it would likely be a hard sell. The main challenge would be finding a way to change the

[issue41824] Docs for typing.ForwardRef don't state that it was added in 3.7

2021-01-15 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch nosy: +kj nosy_count: 2.0 -> 3.0 pull_requests: +23048 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24224 ___ Python tracker

[issue42911] Addition chains for pow saves 10 % time!

2021-01-15 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: Well, measurements show that it saves more time than I thought (sometimes over 20%!), because there are other ways in which it saves time; I am quite happy with that. In the code I needed functions _Py_bit_length64 and _Py_bit_count64. I thought these

[issue42911] Addition chains for pow saves 5-20% time for pow(int, int)

2021-01-15 Thread Jurjen N.E. Bos
Change by Jurjen N.E. Bos : -- title: Addition chains for pow saves 10 % time! -> Addition chains for pow saves 5-20% time for pow(int,int) ___ Python tracker ___

  1   2   >