Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Chris Angelico via Python-list
On Sat, 9 Mar 2024 at 03:42, Grant Edwards via Python-list wrote: > > On 2024-03-08, Chris Angelico via Python-list wrote: > > On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list > > wrote: > > > >> One might argue that "global" isn't a good choice for what to call the > >> scope in

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Chris Angelico via Python-list wrote: > On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list > wrote: > >> One might argue that "global" isn't a good choice for what to call the >> scope in question, since it's not global. It's limited to that source >> file. It doesn't make

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Chris Angelico via Python-list
On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list wrote: > One might argue that "global" isn't a good choice for what to call the > scope in question, since it's not global. It's limited to that source > file. It doesn't make sense to me to call a binding "global", when > there can be

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-07, Cameron Simpson via Python-list wrote: > Yes. Note that the "global" namespace is the module in which the > function is defined. One might argue that "global" isn't a good choice for what to call the scope in question, since it's not global. It's limited to that source file. It

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-07 Thread Cameron Simpson via Python-list
On 06Mar2024 15:12, Jacob Kruger wrote: So, this does not make sense to me in terms of the following snippet from the official python docs page: https://docs.python.org/3/faq/programming.html "In Python, variables that are only referenced inside a function are implicitly global. If a

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-07 Thread Jacob Kruger via Python-list
Thanks again, all. I think the python -i scoping2.py would have given me a good beginning as well - will archive that one for use. And, to maybe explain how I work - not an excuse at all - but, I am actually 100% blind, so a lot of the IDE's, or their common means/methods of interaction

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Grant Edwards via Python-list
On 2024-03-07, dn via Python-list wrote: > The idea of importing a module into the REPL and then (repeatedly) > manually entering the code to set-up and execute is unusual (surely type > such into a script (once), and run that (repeatedly). As you say, most > of us would be working from an

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread dn via Python-list
On 7/03/24 05:28, Jacob Kruger via Python-list wrote: ... So, yes, know this comes across like some form of a scam/joke, or list-garbage, since it doesn't make any sense to me at all, but still just wondering if missing something, or should I shift over to 3.12 to see if if works differently,

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Grant Edwards via Python-list schreef op 6/03/2024 om 18:59: On 2024-03-06, Roel Schroeven via Python-list wrote: > Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >> >>> from scoping2 import * > > [...] > > I would advice not to use 'import *', if at all possible, for multiple

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Grant Edwards via Python-list
On 2024-03-06, Roel Schroeven via Python-list wrote: > Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >> >>> from scoping2 import * > > [...] > > I would advice not to use 'import *', if at all possible, for multiple > reasons, one of which is to prevent problems like this.

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >>> from scoping2 import * Ah yes, that explains what's happening. After that statement, the name dt_expiry in the current namespace is bound to the same object that the name dt_expiry in the namespace of module scoping2 is bound to.

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
Ok, Ethan, that makes sense - I generally work with modules in folders, etc., but, this was just test code, but, 'see' if I instead import scoping2 as sc2, and then refer to sc2.dt_expiry and sc2.do_it, then it does operate as it should - thanks, again. Jacob Kruger +2782 413 4791

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Ethan Furman via Python-list
On 3/6/24 08:28, Jacob Kruger via Python-list wrote: > C:\temp\py_try>python > Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> from scoping2 import * And it becomes

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
You'll see more details in other mail, but, here I am firing up standard python interpreter from within windows terminal, and then executing following line: from scoping2 import * And, this is under windows 11 windows terminal, which is where I generally interact with my python code, via

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
Matt, other mail is more relevant - seems to maybe have more to do with different behavour if import code, or not - no, does not make sense to me - but, here's the command line contents including printing out id() results, but, only working via importing code: #---start session---

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
able is fine in this context, the moment I try to reassign it, that's where the issue is occurring . Here are relevant excerpts from the file:- # start code # original assignation in main part of file l_servers = [] # function wich is initially being executed def interact():   

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 16:39 schreef Roel Schroeven via Python-list: Op 6/03/2024 om 13:55 schreef Jacob Kruger via Python-list: If you import the contents of that file into the python interpreter, [...] What exactly to you mean by "import the contents of that file into the python interpreter"?

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Roel Schroeven via Python-list
Op 6/03/2024 om 13:55 schreef Jacob Kruger via Python-list: If you import the contents of that file into the python interpreter, [...] What exactly to you mean by "import the contents of that file into the python interpreter"? Other people have put your code in a script, executed it, and saw

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Thomas Passin via Python-list
executed def interact(): global l_servers # extra code inbetween choosing what to carry out # ... # end of other code bl_response, o_out = list_servers() if bl_response: # just make sure other function call was successful l_servers.clear() # first

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Thomas Passin via Python-list
On 3/6/2024 5:59 AM, Alan Gauld via Python-list wrote: On 05/03/2024 22:46, Grant Edwards via Python-list wrote: Unfortunately (presumably thanks to SEO) the enshittification of Google has reached the point where searching for info on things like Python name scope, the first page of links are

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Mats Wichmann via Python-list
On 3/6/24 05:55, Jacob Kruger via Python-list wrote: Ok, simpler version - all the code in a simpler test file, and working with two separate variables to explain exactly what am talking about: If you import the contents of that file into the python interpreter, dt_expiry will start off as

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
  if bl_response: # just make sure other function call was successful l_servers.clear() # first make reference to global variable for srv in o_out: l_servers.append(srv) # now re-populate items # end code snippet from inside interact function # end of interact function # end of cod

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Jacob Kruger via Python-list
just make sure other function call was successful l_servers.clear() # first make reference to global variable for srv in o_out: l_servers.append(srv) # now re-populate items # end code snippet from inside interact function # end of interact function # end of code snippet That oth

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Alan Gauld via Python-list
On 05/03/2024 22:46, Grant Edwards via Python-list wrote: > Unfortunately (presumably thanks to SEO) the enshittification of > Google has reached the point where searching for info on things like > Python name scope, the first page of links are to worthless sites like > geeksforgeeks. And not just

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread Grant Edwards via Python-list
On 2024-03-05, Cameron Simpson via Python-list wrote: > Because there are no variable definitions in Python, when you write > a function Python does a static analysis of it to decide which > variables are local and which are not. If there's an assignment to a > variable, it is a local variable.

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread Cameron Simpson via Python-list
On 05Mar2024 20:13, Jacob Kruger wrote: Now, what almost seems to be occurring, is that while just manipulating the contents of a referenced variable is fine in this context, the moment I try to reassign it, that's where the issue is occurring . Because there are no variable definitions in

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread dn via Python-list
()     if bl_response: # just make sure other function call was successful     l_servers.clear() # first make reference to global variable     for srv in o_out: l_servers.append(srv) # now re-populate items     # end code snippet from inside interact function # end of interact

Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread Jacob Kruger via Python-list
: # just make sure other function call was successful     l_servers.clear() # first make reference to global variable     for srv in o_out: l_servers.append(srv) # now re-populate items     # end code snippet from inside interact function # end of interact function # end of code snippet

[issue529750] Circular reference makes Py_Init crash

2022-04-10 Thread admin
Change by admin : -- github: None -> 36257 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue516076] Assign boolean value to a weak reference

2022-04-10 Thread admin
Change by admin : -- github: None -> 36084 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210866] re group self-reference weird behavior (PR#2)

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue474538] Memory (reference) leak in poller.regis

2022-04-10 Thread admin
Change by admin : -- github: None -> 35397 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue223398] "Python/C API Reference Manual" erroneous Python/C exception

2022-04-10 Thread admin
Change by admin : -- github: None -> 33507 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue488477] Reference counting bugs

2022-04-10 Thread admin
Change by admin : -- github: None -> 35654 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue448194] Debuging negative reference counts

2022-04-10 Thread admin
Change by admin : -- github: None -> 34898 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue453111] C API Reference bugs

2022-04-10 Thread admin
Change by admin : -- github: None -> 35008 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue443059] typo in reference manual

2022-04-10 Thread admin
Change by admin : -- github: None -> 34798 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue425836] Reference leak in filter()

2022-04-10 Thread admin
Change by admin : -- github: None -> 34525 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue411118] Typo in Python Reference Manual

2022-04-10 Thread admin
Change by admin : -- github: None -> 34229 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue402652] Reference implementation for PEP 208 (coercion)

2022-04-10 Thread admin
Change by admin : -- github: None -> 33546 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue223398] "Python/C API Reference Manual" erroneous Python/C exception

2022-04-10 Thread admin
Change by admin : -- github: None -> 33507 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210863] Reference counting problem? (PR#338)

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue402652] Reference implementation for PEP 208 (coercion)

2022-04-10 Thread admin
Change by admin : -- github: None -> 33546 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210863] Reference counting problem? (PR#338)

2022-04-10 Thread admin
Change by admin : -- github: None -> 32861 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210866] re group self-reference weird behavior (PR#2)

2022-04-10 Thread admin
Change by admin : -- github: None -> 32864 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36643] Forward reference is not resolved by dataclasses.fields()

2022-03-27 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Jelle here: dataclasses shouldn't be calling get_type_hints(). -- resolution: -> wont fix stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-24 Thread Thomas Fischbacher
Thomas Fischbacher added the comment: Addendum Serhiy, I agree that my assessment was incorrect. It actually is unittest/mock.py that has quite a few 'raise AssertionError' that are not coming from an 'assert' keyword statement. At a deeper level, the problem here is as follows: Every

[issue46857] Python leaks one reference at exit on Windows

2022-03-22 Thread STINNER Victor
STINNER Victor added the comment: The last leak of a memory block on Windows was fixed by: New changeset 88872a29f19092d2fde27365af230abd6d301941 by Jeremy Kloth in branch 'main': bpo-47084: Clear Unicode cached representations on finalization (GH-32032)

[issue35577] side_effect mocked method lose reference to instance

2022-03-19 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Eric. The existing documentation looks pretty clear to me. Any exception can be raised explicitly, no need to repeat this. And unittest.TestCase methods do not raise AssertionError. They raise TestCase.failureException, which by default is

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Eric V. Smith
Eric V. Smith added the comment: > I would argue that "The reference documentation for X states that it gets > raised under condition Y" generally should be understood as "this is a > guarantee that also includes the guarantee that it is not raised under other &

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Thomas Fischbacher
Thomas Fischbacher added the comment: The documentation of exceptions in the reference is one of the places that makes the life of users substantially harder than it ought to be, since the documentation appears to not have been written with the intent to give guarantees that users can

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Eric V. Smith
ary) key is not found in the set of existing keys", but I've raised them in my own code. > An assert[{add reference to `assert` definition}] statement fails, or a unit > testing related assert{...}() callable detects an assertion violation. I think that's also misleading, and not an improve

[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Thomas Fischbacher
New submission from Thomas Fischbacher : The Python reference says: (1) https://docs.python.org/3/library/exceptions.html#concrete-exceptions exception AssertionError Raised when an assert statement fails. (2) https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement

[issue46857] Python leaks one reference at exit on Windows

2022-03-03 Thread STINNER Victor
STINNER Victor added the comment: The initial issue "Python leaks one reference at exit on Windows" is now fixed. If someone wants to investigate the remaining leak of 1 memory block or the negative ref count of PYTHONDUMPREFS=1, please open a separated issue. --

[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-28 Thread Vidhya
Vidhya added the comment: Thanks Alex. I will look into @slateny's patch. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-27 Thread Alex Waygood
Alex Waygood added the comment: Hi Vidhya — @slateny submitted a PR for this issue only two days ago (you can see that it's linked to this BPO issue in the "Pull Requests" field). I think it would be good to wait until that has been reviewed before doing any work on a possible PR for this

[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-27 Thread Vidhya
Vidhya added the comment: If this is still open, I would like to work on this. Please let me know. -- nosy: +vidhya ___ Python tracker ___

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: Ah, with PYTHONDUMPREFS=1 (and without -I), I get a negative ref count: $ PYTHONDUMPREFS=1 ./python -X showrefcount -c pass [-10 refs, 0 blocks] I don't plan to investigate this issue. I'm not using PYTHONDUMPREFS=1 anymore. --

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread Jeremy Kloth
Jeremy Kloth added the comment: Did you also modify initconfig.c? That part is required as the usual processing of the environment variable PYTHONDUMPREFS needed to enable tracing output is ignored with -I -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: I just built Python with --with-trace-refs. On Linux, it works as expected: $ ./python -I -X showrefcount -c pass [0 refs, 0 blocks] -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: > Initially, I modified Py_INCREF to dump the object (addr & tp_name) on > initial inc (ob_refcnt == 1) and Py_DECREF to dump on final dec > (ob_refcnt == 0). Then filter that list (~65K) to find objects not > dealloc'ed. Given those names (~200), cross-check

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset ad56919c5ed54523f866e6605a2573ab7b7d5235 by Victor Stinner in branch 'main': bpo-46857: Fix refleak in OSError INIT_ALIAS() (GH-31594) https://github.com/python/cpython/commit/ad56919c5ed54523f866e6605a2573ab7b7d5235 --

Re: PYT - The expressions described in the Python language reference yield only boolean values

2022-02-26 Thread Peter J. Holzer
On 2022-02-19 23:28:28 +0100, vanyp wrote: > *I am trying to learn Python from the grammar given in the Python language > reference and I am surprised.* > > *Lets start here:* > > *"* > *6.3.4. Calls* > > A call calls a callable object (e.g., a funct

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: > ./configure --enabled-shared --with-py-debug --with-trace-refs (that's what I get for typing from memory): ./configure --enable-shared --with-pydebug --with-trace-refs > > I proposed GH-31594 to fix this macro. > > Even using that change, I still have

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: > Oh wow. How did you find this leak? Did you read all C files and check for > code specific to Windows? How did you proceed? Well spotted! Initially, I modified Py_INCREF to dump the object (addr & tp_name) on initial inc (ob_refcnt == 1) and Py_DECREF to

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
STINNER Victor added the comment: > Good news, the difference on Windows was easy enough to find, bad news total > refs are now negative! Oh wow. How did you find this leak? Did you read all C files and check for code specific to Windows? How did you proceed? Well spotted! > #define

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29717 pull_request: https://github.com/python/cpython/pull/31594 ___ Python tracker ___

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: Note that an allocated block is still leaking. Strange as well, when using dump_refs, the total refs are much more negative (-12 linux, -13 Windows) -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: Good news, the difference on Windows was easy enough to find, bad news total refs are now negative! --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -3647,8 +3647,7 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod) #define INIT_ALIAS(NAME, TYPE) \

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
STINNER Victor added the comment: New changeset ea9612a17bc60d44e0058f525d3c02a91c439cef by Victor Stinner in branch 'main': bpo-46857: Fix test_embed.test_no_memleak() on Windows (GH-31589) https://github.com/python/cpython/commit/ea9612a17bc60d44e0058f525d3c02a91c439cef --

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +29712 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31589 ___ Python tracker ___

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
New submission from STINNER Victor : "./python -X showrefcount -I -c pass" returns "[0 refs, 0 blocks]" as expected on Linux: Python doesn't leak any reference nor memory block. But on Windows, it still leaks 1 reference (and 1 memory block)! vstinner@DESKTOP-DK7VBIL C:\

[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-24 Thread Stanley
Change by Stanley : -- keywords: +patch nosy: +slateny nosy_count: 6.0 -> 7.0 pull_requests: +29687 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/31565 ___ Python tracker

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Jelle Zijlstra
Here's a few similar things I noticed while reading through the reference recently: - https://docs.python.org/3.10/reference/datamodel.html#the-standard-type-hierarchy is supposed to be a list of primitive types but has a few problems: - Lists "numbers.Number" as a standard type

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Guido van Rossum
Guido van Rossum added the comment: Another: - The description of this name binding and resolution process in the PLR [20, §4.2.] is unfortunately not particularly clear. (I found this to be the case too, and wrote up what I found: https://gvanrossum.github.io/formal/scopesblog.html

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Guido van Rossum
Guido van Rossum added the comment: A few examples of issues brought up by Kohl: - While the PLR explicitly states that “x < y calls x.__lt__(y)” [20, §3.3.1.] this is actually false. There are cases where x < y does not call x.__lt__(y) and there are other cases where x.__lt__(y) is

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Brandt Bucher
Change by Brandt Bucher : -- nosy: +brandtbucher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-23 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-22 Thread Eric Snow
Eric Snow added the comment: Thanks for the updates, Eddie. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo
Eddie Elizondo added the comment: It seems that we are back on track with perf being back to neutral! I've created 4 new PRs. Each with an optimization applied on top of the baseline introduction of instance immortalization. The main PR 19474 currently stands at around 4%, after rebasing

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Inada Naoki
Inada Naoki added the comment: All of these optimizations should be disabled by default. * It will cause leak when Python is embedded. * Even for python command, it will break __del__ and weakref callbacks. -- ___ Python tracker

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo
Change by Eddie Elizondo : -- pull_requests: +29621 pull_request: https://github.com/python/cpython/pull/31491 ___ Python tracker ___

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo
Change by Eddie Elizondo : -- pull_requests: +29620 pull_request: https://github.com/python/cpython/pull/31490 ___ Python tracker ___

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo
Change by Eddie Elizondo : -- pull_requests: +29619 pull_request: https://github.com/python/cpython/pull/31489 ___ Python tracker ___

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo
Change by Eddie Elizondo : -- pull_requests: +29618 pull_request: https://github.com/python/cpython/pull/31488 ___ Python tracker ___

Re: PYT - The expressions described in the Python language reference yield only boolean values

2022-02-19 Thread Chris Angelico
On Sun, 20 Feb 2022 at 12:00, vanyp wrote: > > *I am trying to learn Python from the grammar given in the Python > language reference and I am surprised.* > The grammar is not the best way to learn the language. It'll show you a lot of unnecessary details. For technical reasons, Pyth

PYT - The expressions described in the Python language reference yield only boolean values

2022-02-19 Thread vanyp
*I am trying to learn Python from the grammar given in the Python language reference and I am surprised.* *Lets start here:* *"* *6.3.4. Calls* A call calls a callable object (e.g., a function <https://docs.python.org/3/glossary.html#term-function>) with a possibly empty series o

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood
Change by Alex Waygood : -- keywords: -patch nosy: -AlexWaygood stage: patch review -> ___ Python tracker ___ ___

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood
Change by Alex Waygood : -- pull_requests: -29560 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood
Change by Alex Waygood : -- keywords: +patch nosy: +AlexWaygood nosy_count: 1.0 -> 2.0 pull_requests: +29560 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29479 ___ Python tracker

[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-14 Thread Guido van Rossum
New submission from Guido van Rossum : In https://arxiv.org/pdf/2109.03139.pdf ("M Köhl, An Executable Structural Operational Formal Semantics for Python, Master Thesis 2020 Saarland University) there are some observations on cases where the Language Reference (referred to a

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-11 Thread Inada Naoki
Inada Naoki added the comment: I think making more objects immortal by default will reduce the gap, although I am not sure it can be 2%. (I guess 3% and I think it is acceptable gap.) * Code attributes (contents of co_consts, co_names, etc...) in deep frozen modules. * only if

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-11 Thread Eddie Elizondo
Eddie Elizondo added the comment: @eric.snow great to hear about this update! I'll start looking at some of the techniques that we talked about to improve performance, I'm optimistic that we'll be able to close down the gap to 2%. -- ___ Python

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-09 Thread Eric Snow
Eric Snow added the comment: @Eddie, what can I do to push this forward? FYI, in addition to the python-dev thread a few weeks back, I've brought the matter up with the steering council. [1] Also, if we can get back to performance-neutral (currently at about 4% slower) then there would be

[issue45555] Object stays alive for weak reference if an exception happens in constructor

2022-01-28 Thread Irit Katriel
Irit Katriel added the comment: I don't think there's any suitable place in the documentation to describe this. Like Pablo says, it is one of the many ways in which you can create a reference to an object. -- nosy: +iritkatriel stage: -> resolved status: open ->

[issue36643] Forward reference is not resolved by dataclasses.fields()

2022-01-21 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: I don't think we should merge this change. get_type_hints() is fragile and full of corner cases around using the right globals and locals dictionaries. dataclasses shouldn't execute it implicitly for you. -- nosy: +Jelle Zijlstra versions: +Python

[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-01-18 Thread STINNER Victor
Change by STINNER Victor : -- title: Fixing Copy on Writes from reference counting -> Fixing Copy on Writes from reference counting and immortal objects ___ Python tracker <https://bugs.python.org/issu

[issue40255] Fixing Copy on Writes from reference counting

2022-01-14 Thread STINNER Victor
STINNER Victor added the comment: I just want to say that GOOGLE_ETERNAL_REFCOUNT_SUPPORT is a cool name :-D I love "eternal refcount"! -- ___ Python tracker ___

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger
ms which people may be having -- so it has the added benefit of explaining the code and teaching people useful patterns. Take the itertools.permutation as an example: writing that as it was in the reference implementation the code is IMHO pretty opaque and hard to reason about. Write it in a

  1   2   3   4   5   6   7   8   9   10   >