[issue13026] Dis module - documentation of MAKE_FUNCTION
New submission from Arnaud Delobelle : The description of the opcode MAKE_FUNCTION in the dis module document is out of date. It still describes the 2.X version of the opcode: """ MAKE_FUNCTION(argc) Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have argc default parameters, which are found below TOS. """ According to http://hg.python.org/cpython/file/default/Python/ceval.c#l2684: 2684 int posdefaults = oparg & 0xff; 2685 int kwdefaults = (oparg>>8) & 0xff; 2686 int num_annotations = (oparg >> 16) & 0x7fff; So the documentation should read something like """ MAKE_FUNCTION(argc) Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have argc & 0xFF positional default parameters, (argc >> 8) & 0xFF keyword only default parameters, and (argc >> 16) & 0x7FFF parameter annotations which are push below TOS in this order. For each keyword only default, the name of the parameter is pushed just below its default value. On top of all the annotations, a tuple is pushed listing the parameter names for these annotations. """ -- assignee: docs@python components: Documentation messages: 144393 nosy: arno, docs@python, terry.reedy priority: normal severity: normal status: open title: Dis module - documentation of MAKE_FUNCTION versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue13026> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13026] Dis module - documentation of MAKE_FUNCTION
Arnaud Delobelle added the comment: Yes, you are correct. Reading this again, I don't think I should have used the word "pushed" as it sounds like the effect of the opcode is to push stuff onto the stack, whereas I was only trying to describe what is on the stack just before the opcode is executed. -- ___ Python tracker <http://bugs.python.org/issue13026> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13026] Dis module - documentation of MAKE_FUNCTION
Arnaud Delobelle added the comment: This reads a lot better. Perhaps change (with name and object in separate positions) to something like (with name just below object on the stack) -- ___ Python tracker <http://bugs.python.org/issue13026> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9717] operator module - "in place" operators documentation
New submission from Arnaud Delobelle : More detailed explanation of how in place operators work, and how they are related to the operator module iadd, isub, ... functions. Submitted following this message on python-list: http://mail.python.org/pipermail/python-list/2010-August/1254243.html -- assignee: d...@python components: Documentation files: operator_inplace.diff keywords: patch messages: 115237 nosy: arno, d...@python priority: normal severity: normal status: open title: operator module - "in place" operators documentation versions: Python 3.3 Added file: http://bugs.python.org/file18682/operator_inplace.diff ___ Python tracker <http://bugs.python.org/issue9717> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9717] operator module - "in place" operators documentation
Arnaud Delobelle added the comment: Terry: I agree that augmented assignement should be described better in the language reference. I guess that would warrant opening another issue? However I tend to think that the term "in-place operation" is a good one. BTW: - the reference of "(See section Primaries for the syntax definitions for the last three symbols.)" is probably there to point to the definition of what can go on the left side of the augmented assignement symbol (what used to be called an "lvalue") - "With the exception of assigning to tuples ": this refers to the fact that whereas x, y, z = l is correct syntax, x, y, z += l isn't. Raymond: I agree that the operator doc would be clearer if better structured. So I put forward another patch to operator.rst, structuring it more clearly and providing a more detailed introduction to the "In-place operations" section, but not trying to detail the workings of augmented assignement in general. -- Added file: http://bugs.python.org/file18752/operator_structured.diff ___ Python tracker <http://bugs.python.org/issue9717> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys
New submission from Arnaud Delobelle : The pprint function in the python 3.1 pprint module fails when printing a dictionary containing more than one item and with one item being a user-defined type. It seems pprint tries to sort the keys but fails, (maybe because calling __lt__ on a user-defined type doesn't bind its first argument to 'self'? Looking into pprint.py would probably yield the answer). This seems related to issue 3976 but it was fixed in r76389 and r76390. My example below fails in r79147. I'm not in a position to check more recent revisions right now. In Python 2.6, the following works fine: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pprint import pprint >>> class A(object): pass ... >>> pprint({A:1, 1:2}) {1: 2, : 1} But in Python 3.1, it fails with the error below: Python 3.1.2 (r312:79147, Apr 15 2010, 12:35:07) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pprint import pprint >>> class A: pass ... >>> pprint({A:1, 1:2}) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.1/pprint.py", line 55, in pprint printer.pprint(object) File "/usr/lib/python3.1/pprint.py", line 132, in pprint self._format(object, self._stream, 0, 0, {}, 0) File "/usr/lib/python3.1/pprint.py", line 155, in _format rep = self._repr(object, context, level - 1) File "/usr/lib/python3.1/pprint.py", line 242, in _repr self._depth, level) File "/usr/lib/python3.1/pprint.py", line 254, in format return _safe_repr(object, context, maxlevels, level) File "/usr/lib/python3.1/pprint.py", line 296, in _safe_repr items = sorted(object.items(), key=_safe_tuple) File "/usr/lib/python3.1/pprint.py", line 89, in __lt__ rv = self.obj.__lt__(other.obj) TypeError: expected 1 arguments, got 0 -- components: Library (Lib) messages: 117895 nosy: arno priority: normal severity: normal status: open title: pprint.pprint raises TypeError on dictionaries with user-defined types as keys versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue10017> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3069] Let set.union and set.intersection accept multiple arguments
New submission from Arnaud Delobelle <[EMAIL PROTECTED]>: The patch allows the following syntax for s set/frozenset: * s.union(a, b, c,...) * s.update(a, b, c,...) * s.intersection(a, b, c,...) * s.intersection_update(a, b, c,...) By extension: * set.union(a, b, c,...) # provided a is a set/frozenset * ... Union is extended by iterative application of set_union_internal Intersection is optimized by sorting all sets/frozensets/dicts in increasing order of size and only iterating over elements in the smallest. This was discussed on python-ideas: http://groups.google.com/group/python- ideas/browse_thread/thread/945a6c989ab905a3/54defd5e62b9a2a6 -- components: Interpreter Core files: set_ui_varargs.diff keywords: patch messages: 67878 nosy: arno severity: normal status: open title: Let set.union and set.intersection accept multiple arguments type: feature request versions: Python 3.0 Added file: http://bugs.python.org/file10565/set_ui_varargs.diff ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3069> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3069] Let set.union and set.intersection accept multiple arguments
Arnaud Delobelle <[EMAIL PROTECTED]> added the comment: I must have diffed my patch against the wrong revision then, because I haven't seen it. I had finished it last thursday, but have had a very hectic few days and only found a few minutes to send it this evening. Something must have gone wrong & the patch must be against last thursday's revision I guess. Anyway it doesn't matter too much as you have started making the changes and it's easy to isolate set_intersection, which is a whole new function, in the patch file. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3069> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com