[issue47054] "SyntaxError: non-default argument follows default argument" should be "parameter"
New submission from Bluenix : Running the code below will produce a SyntaxError with the message: "non-default argument follows default argument". def test(a=None, b): return b if a is None else a The issue is that `a` and `b` aren't *arguments*, rather, they are *parameters*. The error message should be changed to: "non-default parameter follows default parameter". This change appears simple enough and although it is not something I've found to be troublesome, it will help users to use correct keywords (arguments vs. parameters) when searching on the internet. -- components: Interpreter Core messages: 415463 nosy: Bluenix2 priority: normal severity: normal status: open title: "SyntaxError: non-default argument follows default argument" should be "parameter" versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue47054> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47054] "SyntaxError: non-default argument follows default argument" should be "parameter"
Bluenix added the comment: Yes I agree, that would be the best. -- ___ Python tracker <https://bugs.python.org/issue47054> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44318] Asyncio classes missing __slots__
New submission from Bluenix : Most of asyncio's classes are missing a __slots__ attribute - for example Lock, Event, Condition, Semaphore, BoundedSemaphore all from locks.py; or Future, FlowControlMixin, Queue, BaseSubprocessTransport from various other parts of asyncio. -- components: asyncio messages: 395165 nosy: Bluenix2, asvetlov, yselivanov priority: normal severity: normal status: open title: Asyncio classes missing __slots__ versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue44318> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44318] Asyncio classes missing __slots__
Bluenix added the comment: > What is the problem with this? The problem is that asyncio *is not* defining __slots__. > Setting __slots__ in base class is required if you want to get a benefit of > setting __slots__ in any of subclasses. That is my use-case for this. -- ___ Python tracker <https://bugs.python.org/issue44318> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44318] Asyncio classes missing __slots__
Bluenix added the comment: >>> (1).__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'int' object has no attribute '__dict__' >>> 4.5.__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'float' object has no attribute '__dict__' >>> 'Hello'.__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'str' object has no attribute '__dict__' >>> b'50'.__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'bytes' object has no attribute '__dict__' >>> [2.72, 3.14].__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute '__dict__' > __slots__ allow us to explicitly declare data members (like properties) and > deny the creation of __dict__ and __weakref__ (unless explicitly declared in > __slots__ or available in a parent.) >From https://docs.python.org/3/reference/datamodel.html They don't have __slots__, nor a __dict__ or __weakref__: >>> (1).__weakref__ Traceback (most recent call last): File "", line 1, in AttributeError: 'int' object has no attribute '__weakref__' >>> 4.5.__weakref__ Traceback (most recent call last): File "", line 1, in AttributeError: 'float' object has no attribute '__weakref__' >>> 'Hello'.__weakref__ Traceback (most recent call last): File "", line 1, in AttributeError: 'str' object has no attribute '__weakref__' >>> b'50'.__weakref__ Traceback (most recent call last): File "", line 1, in AttributeError: 'bytes' object has no attribute '__weakref__' >>> [2.72, 3.14].__weakref__ Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute '__weakref__' They're essentially C extension classes: https://docs.python.org/3/extending/newtypes_tutorial.html I am not sure what this argument was meant to prove. What would be the downside to adding __slots__ to asyncio's classes? Other than that someone can no longer arbitrarily add attributes? -- ___ Python tracker <https://bugs.python.org/issue44318> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44318] Asyncio classes missing __slots__
Bluenix added the comment: My exact use-case is that I am subclassing asyncio.Semaphore to change some functionality (override `release()` to do nothing and set up tasks to schedule calls to reset the counter). I am expecting *a lot* of these instances so (like Serhiy Storchaka nicely put it) I would like to reduce the memory footprint of these classes by using __slots__. The issue now becomes that asyncio.Semaphore (like most other asyncio classes) have not defined __slots__, this prohibits my subclass from taking advantage of __slots__. -- ___ Python tracker <https://bugs.python.org/issue44318> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com