[issue42901] [Enum] move member creation to __set_name__ in order to support __init_subclass__

2021-01-12 Thread Ethan Furman
Ethan Furman added the comment: New changeset c314e60388282d9829762fb6c30b12e2807caa19 by Ethan Furman in branch 'master': bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196) https://github.com/python/cpython/commit/c314e60388282d9829762fb6c30b12e2807caa19 --

[issue42921] Inferred Optional type of wrapper function arguments

2021-01-12 Thread Joseph Perez
New submission from Joseph Perez : `typing.get_type_hints` gives a different result for a wrapper created with `functools.wraps` in case of inferred `Optional` arguments (when the default value of the argument is None) ```python from functools import wraps from typing import get_type_hints

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Ethan Furman
Ethan Furman added the comment: I just finished a rewrite of Flag for 3.10. Using your test below I was able to tweak the rewrite so the final numbers are: Took normal 0.148092 seconds. Took cached 0.017438 seconds. Your original post had a ratio of nearly 200 -- it is now 8.7ish.

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Xinmeng Xia added the comment: For sure! As soon as we validate this technique, we will open source it on GitHub. -- ___ Python tracker ___

[issue42920] How to add end_lineno in pyclbr?

2021-01-12 Thread Aviral Srivastava
New submission from Aviral Srivastava : I created a PR a year ago, https://github.com/python/cpython/pull/16466/files, and now the source code is completely changed. How do I create another PR or if there is another way through which I can get an end line for each object (class and function)

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: It’s good work! Is it open source? -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Xinmeng Xia added the comment: The bytecode of c is as following: 0 LOAD_CONST 0 (1) 2 STORE_NAME 0 (d) 4 LOAD_CONST 1 (None) 6 RETURN_VALUE === Yes,

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Christian Gollwitzer
Am 13.01.21 um 06:24 schrieb Greg Ewing: On 13/01/21 4:18 am, Grant Edwards wrote: AFAIK, Python can't be used to write device drivers for any popular OS At least not until some crazy person embeds Python in the Linux kernel... What do you mean, "until" ?

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: What does the bytecode for c in program 2 look like? Also, how do you find all these bugs? Are you developing a new fuzzier? -- nosy: +gvanrossum ___ Python tracker

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42919] Blank in multiline “if expressions” will lead to EOF errors

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42913] asyncio.ProactorEventLoop mishandles signal wakeup file descriptor

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Looks this was not tested or thought through with multiple loops and signals (admittedly, using signals is never fun, and even less so on Windows). Can you send a PR with a fix? -- nosy: +gvanrossum ___ Python

[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-12 Thread Dong-hee Na
Change by Dong-hee Na : -- pull_requests: +23031 pull_request: https://github.com/python/cpython/pull/24205 ___ Python tracker ___

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: When I removed myself from the nosy list I did mean to stop working on this bug, just that I am unlikely to be of any help. :-) -- nosy: +gvanrossum ___ Python tracker

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Change by Xinmeng Xia : -- components: +Interpreter Core ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42919] Blank in multiline “if expressions” will lead to EOF errors

2021-01-12 Thread Xinmeng Xia
New submission from Xinmeng Xia : In build-in function compile() of mode 'single', single statement can be well compiled. (see program 1 and program 2). However, if we leave 4 blank spaces before the end of triple-quotation mark of "if expression",(see program 3), The parser will raise

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
New submission from Xinmeng Xia : For build-in function compile() in mode 'single', only single statement can be well compiled. If we compile multiple statements, the parser will raise a syntaxError. Seeing the following two programs, In program 1, 2 statement are compiled. So the parser

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Greg Ewing
On 13/01/21 4:18 am, Grant Edwards wrote: AFAIK, Python can't be used to write device drivers for any popular OS At least not until some crazy person embeds Python in the Linux kernel... -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse presence of switch

2021-01-12 Thread Greg Ewing
On 13/01/21 7:13 am, Chris Angelico wrote: This is what different actions are for. I'd probably use action="store_true" here; that should mean that args.register will be set to True if "-r" was passed, or False if it wasn't. Yes, otherwise it expects another argument following -r containing a

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Gregory: Even in a low-level compiled language (say, C++), pretty sure the compiler can't automatically optimize out: if (x) { } unless it has sure knowledge of the implementation of operator bool; if operator bool's implementation isn't in the header

[issue15373] copy.copy() does not properly copy os.environment

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Would we remove the functionality of os.environ.copy()? It seems very odd for types to have a .copy() method that works, while not supporting copy.copy, especially when there is zero documentation, on the web or the docstring, to even hint at the

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42914] pprint numbers with underscore

2021-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It would be nice if pprint learned to insert underscores in long numbers +1 but I would make this optional. > Here is an implementation of the safe repr for numbers if helpful I suggest using the existing string formatting tools as a foundation

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

2021-01-12 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 1.0 -> 2.0 pull_requests: +23029 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24204 ___ Python tracker

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

2021-01-12 Thread Thomas Anderson
New submission from Thomas Anderson : Currently the block stack size is hardcoded to 20. Similar to how the value stack is dynamically sizable, we should make the block stack dynamically sizable. This will reduce space on average (since the typical number of blocks for a function is well

[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Will be fixed in 3.10. I prefer not to backport the solution (Irit, do you agree?) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

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

2021-01-12 Thread Charles Law
New submission from Charles Law : DICOM is a file format used frequently in medical imaging (it is also a communications protocol). It has been used since the 80's, and is still widely used by modern medical equipment. It has a well defined format:

[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Aaaah, PR 24182 doesn't add a hook to object.__getattr__, but to the C getter functions on traceback and frame. That sounds more acceptable to me :-) These operations are uncommon and should not be part of "hot code" (critical for performance) unless you're

[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: > In GH-23598, PyModule_AddObjectRef was added as EXPORT_DATA. Shouldn't it be > EXPORT_FUNC? Oh, I didn't notice that there was EXPORT_DATA. Right, EXPORT_FUNC must be used. -- ___ Python tracker

[issue41036] Visit the type of instance of heap types if tp_traverse is not implemented

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: I created a thread on python-dev: "Heap types (PyType_FromSpec) must fully implement the GC protocol" https://mail.python.org/archives/list/python-...@python.org/thread/C4ILXGPKBJQYUN5YDMTJOEOX7RHOD4S3/ -- ___

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
Felipe added the comment: Here is an implementation of the safe repr for numbers if helpful: ``` def safe_repr_int(object): sign = '' if object < 0: sign = '-' object = -object r = repr(object) if len(r) <= 4: return sign + r parts = [sign]

[issue25988] collections.abc.Indexable

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: New changeset c47c78b878ff617164b2b94ff711a6103e781753 by Hugo van Kemenade in branch 'master': bpo-37324: Remove ABC aliases from collections (GH-23754) https://github.com/python/cpython/commit/c47c78b878ff617164b2b94ff711a6103e781753 --

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Kevin Chen
New submission from Kevin Chen : Here's a code sample: ``` import time from enum import Flag, auto class MyFlag(Flag): NONE = 0 FLAG_1 = auto() FLAG_2 = auto() FLAG_3 = auto() FLAG_4 = auto() FLAG_5 = auto() FLAG_6 = auto() # # NOT_FLAG_1_OR_2 = ~FLAG_1 &

[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-12 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23028 pull_request: https://github.com/python/cpython/pull/24203 ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
New submission from Felipe : It would be nice if pprint learned to insert underscores in long numbers Current behavior: >>> pprint.pprint(int(1e9)) 10 Desired behavior >>> pprint.pprint(int(1e9)) 1_000_000_000 Wikipedia tells me that "groups of 3" is the international standard to

[issue37324] collections: remove deprecated aliases to ABC classes

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: New changeset c47c78b878ff617164b2b94ff711a6103e781753 by Hugo van Kemenade in branch 'master': bpo-37324: Remove ABC aliases from collections (GH-23754) https://github.com/python/cpython/commit/c47c78b878ff617164b2b94ff711a6103e781753 --

Re: Application window geometry specifier

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 10:02 AM Igor Korot wrote: > But for my dialogs (especially for dialogs where I need to ask for > credentials) - I don't think I want > WM to do my job. > > Again - we are talking positioning here and not size/client size. > And I don't think I want you to do the WM's

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Chris, On Tue, Jan 12, 2021 at 4:38 PM Chris Angelico wrote: > > On Wed, Jan 13, 2021 at 9:30 AM Igor Korot wrote: > > > > Not sure I follow - frame is a TLW. Dialog is a TLW. > > Program flow is as follows: > > > > 1. Program starts with a frame > > 2. At some point the user asks to connect to

Re: Application window geometry specifier

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 9:30 AM Igor Korot wrote: > > Not sure I follow - frame is a TLW. Dialog is a TLW. > Program flow is as follows: > > 1. Program starts with a frame > 2. At some point the user asks to connect to the database. > 3. Credentials dialog is shown. > > Now, while frame is TLW

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, Chris, On Tue, Jan 12, 2021 at 4:05 PM Chris Angelico wrote: > > On Wed, Jan 13, 2021 at 7:00 AM Igor Korot wrote: > > > > Hi, Chris, > > > > On Tue, Jan 12, 2021 at 1:33 PM Chris Angelico wrote: > > > > > > On Wed, Jan 13, 2021 at 6:18 AM Igor Korot wrote: > > > > > > > > Hi, Grant, > >

[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset 6dfd1734f5b230bb8fbd2a9df806c1333b6652a8 by Irit Katriel in branch 'master': bpo-42848: remove recursion from TracebackException (GH-24158) https://github.com/python/cpython/commit/6dfd1734f5b230bb8fbd2a9df806c1333b6652a8 --

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, Chris Angelico wrote: > * Command-line calculator - pressing Ctrl-Alt-P will open up a > terminal with Python, and that's the normal way that I do quick > calculations I do that a lot too. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Application window geometry specifier

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 7:00 AM Igor Korot wrote: > > Hi, Chris, > > On Tue, Jan 12, 2021 at 1:33 PM Chris Angelico wrote: > > > > On Wed, Jan 13, 2021 at 6:18 AM Igor Korot wrote: > > > > > > Hi, Grant, > > > > > > On Tue, Jan 12, 2021 at 12:47 PM Grant Edwards > > > wrote: > > > > > > > > On

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
On 12Jan2021 10:40, Michael F. Stemper wrote: >On 11/01/2021 14.37, DonK wrote: >>I've installed Python 3.7, the PyCharm IDE and watched some Youtube >>tutorials > >I would suggest that instead of watching tutorials, you open up your IDE >and start writing stuff. I would second that. Maybe this

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Cameron Simpson
On 12Jan2021 15:18, Grant Edwards wrote: >On 2021-01-12, songbird wrote: >> it can be used for pretty much anything except perhaps >> high pressure real time things, but i bet someone else will >> know that is being done too, i've just not heard of it. :) > >AFAIK, Python can't be used to

[issue42913] asyncio.ProactorEventLoop mishandles signal wakeup file descriptor

2021-01-12 Thread Michel Hidalgo
New submission from Michel Hidalgo : asyncio.ProactorEventLoop uses a socket.socketpair and signal.set_wakeup_fd to wake up a loop that's polling I/O. However it does so with no consideration for file descriptors previously set (i.e. no signal number forwarding). Either by user code or by

[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-12 Thread Petr Viktorin
Petr Viktorin added the comment: In GH-23598, PyModule_AddObjectRef was added as EXPORT_DATA. Shouldn't it be EXPORT_FUNC? -- ___ Python tracker ___

[issue42912] enum.Flag ~ bitwise negation is very slow

2021-01-12 Thread Kevin Chen
New submission from Kevin Chen : Ignore this, opened issue by accident -- stage: -> resolved status: open -> closed ___ Python tracker ___

[issue42912] enum.Flag ~ bitwise negation is very slow

2021-01-12 Thread Kevin Chen
Change by Kevin Chen : -- nosy: aspin2 priority: normal severity: normal status: open title: enum.Flag ~ bitwise negation is very slow versions: Python 3.8 ___ Python tracker

[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-12 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > I do not like using _functools._lru_cache_wrapper. It is a deep > implementation detail, private function of private module. Use > functools.lru_cache. All right, thanks. -- ___ Python tracker

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

2021-01-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, Chris, On Tue, Jan 12, 2021 at 1:33 PM Chris Angelico wrote: > > On Wed, Jan 13, 2021 at 6:18 AM Igor Korot wrote: > > > > Hi, Grant, > > > > On Tue, Jan 12, 2021 at 12:47 PM Grant Edwards > > wrote: > > > > > > On 2021-01-12, Rich Shepard wrote: > > > > On Tue, 12 Jan 2021, Igor Korot

Re: Application window geometry specifier

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 6:18 AM Igor Korot wrote: > > Hi, Grant, > > On Tue, Jan 12, 2021 at 12:47 PM Grant Edwards > wrote: > > > > On 2021-01-12, Rich Shepard wrote: > > > On Tue, 12 Jan 2021, Igor Korot wrote: > > > > > >> Keep in mind that if you target Linux, the "modern" window server > >

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, Rich, On Tue, Jan 12, 2021 at 12:52 PM Rich Shepard wrote: > > On Tue, 12 Jan 2021, Igor Korot wrote: > > > Maybe. :-) > > But it looks Wayland becomes more and more popular. > > Igor, > > What I've read from those struggling to use Wayland, it may turn out to be a > popular as systemd. :-)

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, Grant, On Tue, Jan 12, 2021 at 12:47 PM Grant Edwards wrote: > > On 2021-01-12, Rich Shepard wrote: > > On Tue, 12 Jan 2021, Igor Korot wrote: > > > >> Keep in mind that if you target Linux, the "modern" window server > >> (Wayland) will not allow user code to decide the positioning and

Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard
On Tue, 12 Jan 2021, Grant Edwards wrote: And those X11 users will swear at you if you override their window managers configured window placement. Application code should not care about or try to control window geometry. Period. Grant, Since this application is my own business use those

Binding menu accelerator to a callback

2021-01-12 Thread Rich Shepard
Menu options work from the menu, but not from the accelerator associated with that menu item. My research suggests that while 'command' works for the menu item, 'bind' is required for the associated accelerator. For example, File -> Quit is defined this way: self.file_menu.add_command(

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

2021-01-12 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: Some more information for the interested: The algorithm I made tries to smoothly change the"chunk size" with growing length of the exponent. So the exponents that win the most (up to 14% fewer multiplication) are the long exponents that are just shorter

Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard
On Tue, 12 Jan 2021, Igor Korot wrote: Maybe. :-) But it looks Wayland becomes more and more popular. Igor, What I've read from those struggling to use Wayland, it may turn out to be a popular as systemd. :-) It's important to remember that while all progress involves change, not all change

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Chris Angelico
On Tue, Jan 12, 2021 at 7:41 AM DonK wrote: > So, what do you folks use Python for? > Since everyone else is, I'll add my list. * API lookups of various sorts (usually via HTTP requests) * Audio analysis. Calculate the maximum and average volume of each of many songs. * Code generation. The

Re: Application window geometry specifier

2021-01-12 Thread Grant Edwards
On 2021-01-12, Rich Shepard wrote: > On Tue, 12 Jan 2021, Igor Korot wrote: > >> Keep in mind that if you target Linux, the "modern" window server >> (Wayland) will not allow user code to decide the positioning and size of >> the TLW. > > Igor, > > I suspect that Slackware will continue with X11.

Re: Application window geometry specifier

2021-01-12 Thread Eli the Bearded
In comp.lang.python, Rich Shepard wrote: >> Keep in mind that if you target Linux, the "modern" window server >> (Wayland) will not allow user code to decide the positioning and size of > I suspect that Slackware will continue with X11. Even with traditional X11, geometry is "preferred" size

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, Chris Angelico wrote: > On Wed, Jan 13, 2021 at 3:18 AM Grant Edwards > wrote: >> >> On 2021-01-12, songbird wrote: >> >> > it can be used for pretty much anything except perhaps >> > high pressure real time things, but i bet someone else will >> > know that is being done too,

Re: argparse presence of switch

2021-01-12 Thread David Lowry-Duda
> I want to have an argument's presence only - value is not required. > For example, my program main.py needs to know if "-r" is present when program > is invoked. > So the value command line would be: > (1) python3 main.py -r > or... > (1) python3 main.py > > I tried following: >

[issue15373] copy.copy() does not properly copy os.environment

2021-01-12 Thread Irit Katriel
Change by Irit Katriel : -- components: +Library (Lib) versions: +Python 3.10 -Python 3.7 ___ Python tracker ___ ___

[ANN] Austin -- CPython frame stack sampler v2.1.1 is now available

2021-01-12 Thread Gabriele Tornetta
I am delighted to announce the release 2.1.1 of Austin. If you haven't heard of Austin before, it is an open-source frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data out of a running Python application without a single line of

[issue42906] python3 -m doctest test.py tests the stdlib "time" module instead

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Whoops, I meant export PYTHONPATH=. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue42906] python3 -m doctest test.py tests the stdlib "time" module instead

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Sorry, this is not a bug. The builtin time module takes precedence in this case because the current directory is not put at the front of the module search path (sys.path). As a workaround you could exportPYTHONPATH=. -- nosy: +gvanrossum

[issue42874] running configure on Solaris 10 gives grep "illegal option" errors

2021-01-12 Thread miss-islington
miss-islington added the comment: New changeset 0f66498fd8ee8644be6df963b86a1523f6069ddd by Paul Ganssle in branch 'master': bpo-42874: Remove grep -qE options for Solaris 10 compatibility (GH-24200) https://github.com/python/cpython/commit/0f66498fd8ee8644be6df963b86a1523f6069ddd

Re: argparse presence of switch

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 5:01 AM Dhimant Patel wrote: > > Its what I searched for on this group. > > I want to have an argument's presence only - value is not required. > For example, my program main.py needs to know if "-r" is present when program > is invoked. > So the value command line would

[issue41620] Python Unittest does not return results object when the test is skipped

2021-01-12 Thread Irit Katriel
Irit Katriel added the comment: The justification on the PR is: "The problem is that when I'm trying to collect test results if one of the tests is being skipped the error below pops up because test_result object is None. AttributeError: 'NoneType' object has no attribute 'testsRun'"

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Hm, I hadn't realized the issue of bool(a) being evaluated once or twice. The most important side effect that bool(a) can have is raising (as e.g. numpy arrays do), not producing random results. Another important side effect might be loading some value

[ANN] Austin -- CPython frame stack sampler v2.1.1 is now available

2021-01-12 Thread Gabriele Tornetta
I am delighted to announce the release 2.1.1 of Austin. If you haven't heard of Austin before, it is an open-source frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data out of a running Python application without a single line of

[issue33066] raise an exception from multiple positions break the traceback frames

2021-01-12 Thread Irit Katriel
Irit Katriel added the comment: See this documentation of with_traceback() regarding an API to set the traceback on an exception object. https://docs.python.org/3/library/exceptions.html#BaseException.with_traceback -- resolution: -> not a bug stage: -> resolved status: open ->

argparse presence of switch

2021-01-12 Thread Dhimant Patel
Its what I searched for on this group. I want to have an argument's presence only - value is not required. For example, my program main.py needs to know if "-r" is present when program is invoked. So the value command line would be: (1) python3 main.py -r or... (1) python3 main.py I tried

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, On Tue, Jan 12, 2021, 11:44 AM Rich Shepard wrote: > On Tue, 12 Jan 2021, Igor Korot wrote: > > > Keep in mind that if you target Linux, the "modern" window server > > (Wayland) will not allow user code to decide the positioning and size of > > the TLW. > > Igor, > > I suspect that

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Gregory P. Smith
Gregory P. Smith added the comment: If the body of a conditional does nothing, it seems fine to optimize the condition out to me. But I see code from a low level compiled language perspective where that is clearly what would happen. In reality, who ever meaningfully writes code where the

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper
On 12/01/2021 10.40, Michael F. Stemper wrote: Modeling of electric power systems: - load behavior in response to conservation load reduction Sorry, that should have been "conservation voltage reduction". -- Michael F. Stemper Psalm 82:1-4 --

Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard
On Tue, 12 Jan 2021, Igor Korot wrote: Keep in mind that if you target Linux, the "modern" window server (Wayland) will not allow user code to decide the positioning and size of the TLW. Igor, I suspect that Slackware will continue with X11. Rich --

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread MRAB
On 2021-01-11 20:37, DonK wrote: [snip] So, what do you folks use Python for? Since we're sharing: - Personal information manager in the form of a tree of pages. Each page can have code associated with it which defines functions to call when shortcut keys are pressed, giving

Re: Application window geometry specifier [RESOLVED]

2021-01-12 Thread Rich Shepard
On Wed, 13 Jan 2021, Chris Angelico wrote: Do the offsets need to be integers? ChrisA, Yep. I totally missed that. Thanks for seeing it. Stay well, Rich -- https://mail.python.org/mailman/listinfo/python-list

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Hum. The code in Python 3.8 is complicated. When Py_SetPath() is called, Python starts by computing the Python Path Configuration because of: /* Getting the program full path calls pathconfig_global_init() */ wchar_t *program_full_path =

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread Eryk Sun
Eryk Sun added the comment: > I still don't understand if the issue involves Py_SetPath() or not. It seems to me that this issue is concerned with the default behavior that looks for the "lib/os.py" landmark via search_for_prefix() in PC/getpathp.c. Starting at the image path, it searches

Re: Application window geometry specifier

2021-01-12 Thread Igor Korot
Hi, On Tue, Jan 12, 2021 at 10:47 AM Chris Angelico wrote: > > On Wed, Jan 13, 2021 at 3:38 AM Rich Shepard wrote: > > > > I want my application's window (main frame) to open centered on the > > monitor's screen. Keep in mind that if you target Linux, the "modern" window server (Wayland) will

[issue42843] What min_sphinx for Python 3.10

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: There is a PPA on Ubuntu for Python 3.10. The PPA maintainer considers the drop the documentation, see discussion at: https://github.com/python/cpython/pull/23620#issuecomment-755423140 -- ___ Python tracker

[issue42843] What min_sphinx for Python 3.10

2021-01-12 Thread STINNER Victor
Change by STINNER Victor : -- versions: +Python 3.10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper
On 11/01/2021 14.37, DonK wrote: I've installed Python 3.7, the PyCharm IDE and watched some Youtube tutorials I would suggest that instead of watching tutorials, you open up your IDE and start writing stuff. Get an introductory python book (I used the O'Reilly _Introducing Python_), start at

Re: Application window geometry specifier

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 3:38 AM Rich Shepard wrote: > > I want my application's window (main frame) to open centered on the > monitor's screen. This code: > # open application centered on screen; set window width and height > self.appwidth = 600 > self.appheight = 500 >

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Mark Shannon
Mark Shannon added the comment: > How do we know `x` is falsey without calling `bool()` on it? We don't, but in `if x: pass`, it doesn't matter. Discounting side-effects in __bool__, the code does nothing regardless of the value of `x`. -- ___

[issue42843] What min_sphinx for Python 3.10

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: * Fedora 33 (stable) ships python3-sphinx 3.2.1-1 and python3.10 version 3.10.0~a3-1 (the alpha4 is under tests). * Debian Buster (stable) ships python3-sphinx 1.8.4-1 and python3 version 3.7.3-1 * Debian Sid (unstable) ships python3-sphinx 3.4.3-1 and

Application window geometry specifier

2021-01-12 Thread Rich Shepard
I want my application's window (main frame) to open centered on the monitor's screen. This code: # open application centered on screen; set window width and height self.appwidth = 600 self.appheight = 500 # get screen width and height self.scrwidth =

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Mark Shannon
Mark Shannon added the comment: It's clearer if you rewrite if a and b: ... as tmp = a and b if tmp: ... if a is falsey then bool(a) gets called in `tmp = a and b` and `a` is assigned to `tmp`. Then in `if tmp`, bool(a) is called again. I agree with you about it not being an

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Chris Angelico
On Wed, Jan 13, 2021 at 3:18 AM Grant Edwards wrote: > > On 2021-01-12, songbird wrote: > > > it can be used for pretty much anything except perhaps > > high pressure real time things, but i bet someone else will > > know that is being done too, i've just not heard of it. :) > > AFAIK, Python

[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2021-01-12 Thread seb
seb added the comment: I tried that before, also with your command, without success. I saw that the CFLAGS includes weren't forwarded to the compiler - I don't know if that is only an issue here on my system. So instead I modified the setup.py and added the directory manually. It now works.

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Ethan Furman
Ethan Furman added the comment: If an optimization changes semantics it's not an optimization. In `if x: pass` how do we know `x` is falsely without calling `bool()` on it? --- On a slightly different note, in the code: if a and b: ... why is `bool(a)` called twice?

[issue42843] What min_sphinx for Python 3.10

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Ah, the issue is also being discussed in PR 24142 comments. -- ___ Python tracker ___ ___

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Mark Shannon
Change by Mark Shannon : -- priority: normal -> release blocker ___ Python tracker ___ ___ Python-bugs-list mailing list

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-12, songbird wrote: > it can be used for pretty much anything except perhaps > high pressure real time things, but i bet someone else will > know that is being done too, i've just not heard of it. :) AFAIK, Python can't be used to write device drivers for any popular OS (Linux,

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Grant Edwards
On 2021-01-11, DonK wrote: > So, what do you folks use Python for? I mainly use it for writing command-line utilities. Many of them work on either Windows or Linux, but are mostly used on Linux: * Two-pass symbolic assembler and dissassembler for a proprietary communications controller.

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Mark Shannon
Mark Shannon added the comment: They aren't quite the same. If `a` is falsey, and bool(a) has a side-effect, then that side-effect should occur twice in: if a and b: ... but only once in if a: if b: ... It gets more interesting (silly), if `a.__bool__()` alternated between

  1   2   >