[issue23850] Missing documentation for Py_TPFLAGS_HAVE_NEWBUFFER

2015-04-02 Thread Giacomo Alzetta
Changes by Giacomo Alzetta giacomo.alze...@gmail.com: -- assignee: - docs@python components: +Documentation nosy: +docs@python type: - enhancement versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23850

[issue23850] Missing documentation for Py_TPFLAGS_HAVE_NEWBUFFER

2015-04-02 Thread Giacomo Alzetta
New submission from Giacomo Alzetta: Python2.7 documentation is missing critical information regarding the backporting of the new-buffer protocol. There is no mention whatsoever of the Py_TPFLAGS_HAVE_NEWBUFFER flag which is required to implement it. The only way to discover it is by reading

[issue21782] hashable documentation error: shouldn't mention id

2014-06-16 Thread Giacomo Alzetta
New submission from Giacomo Alzetta: The documentation for hashable in the glossary (https://docs.python.org/3.4/reference/datamodel.html#object.__hash__) is incorrect: they all compare unequal (except with themselves), **and their hash value is their id().** It is *not* true

[issue21782] hashable documentation error: shouldn't mention id

2014-06-16 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: their hash value is their id() seems quite clearly stating that: class A: pass ... a = A() hash(a) == id(a) should be true, but: hash(a) == id(a) False (both in python2 and in python3) The python 2 documentation for the __hash__ special method *does

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-13 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: I asked this because, for example, in Haskell it *is* a well-defined behaviour (see its documentation at: http://hackage.haskell.org/package/containers-0.5.4.0/docs/Data-Set.html): the left operand is preferred by all operations. In fact, working

[issue20902] Which operand is preferred by set operations? Missing information in the documentation

2014-03-12 Thread Giacomo Alzetta
New submission from Giacomo Alzetta: Currently the documentation for set (at: http://docs.python.org/2/library/stdtypes.html#set) does not mention which operand is preferred when performing the usual binary operations. For example the following sample code doesn't have a defined result

[issue18750] '' % [1] doesn't fail

2013-08-19 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: Note that the documentation for formatting with %, found here: http://docs.python.org/2/library/stdtypes.html#string-formatting-operations, states: If format requires a single argument, values may be a single non-tuple object. [5] Otherwise, values must

[issue16273] f.tell() returning negative number on Windows build

2013-04-11 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: I can reproduce a similar behaviour, but instead of negative values I obtain huge values(which may as well be a negative unsigned converted to a python int). See this stackoverflow question: http://stackoverflow.com/questions/15934950/python-file-tell

[issue16273] f.tell() returning negative number on Windows build

2013-04-11 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: The documentation for python 3.3.1 states, at http://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files, states: f.tell() returns an integer giving the file object’s current position in the file, **measured in bytes from the beginning

[issue16273] f.tell() returning negative number on Windows build

2013-04-10 Thread Giacomo Alzetta
Giacomo Alzetta added the comment: I can't find any mention of this behaviour in python3's documentation, nor any reference to ftell(). Is it only well hidden or was it deleted by accident? -- nosy: +bakuriu status: pending - open ___ Python tracker

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-22 Thread Giacomo Alzetta
Il giorno giovedì 22 novembre 2012 09:44:21 UTC+1, Steven D'Aprano ha scritto: On Wed, 21 Nov 2012 23:01:47 -0800, Giacomo Alzetta wrote: Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: On 2012-11-22 03:41, Terry Reedy wrote: It can't return 5 because 5 isn't

Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) - int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno mercoledì 21 novembre 2012 20:25:10 UTC+1, Hans Mulder ha scritto: On 21/11/12 17:59:05, Alister wrote: On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: On 2012-11-22 03:41, Terry Reedy wrote: It can't return 5 because 5 isn't an index in 'spam'. It can't return 4 because 4 is below the start index. Uhm. Maybe you are right, because returning a greater value would cause

Missing modules compiling python3.3

2012-11-04 Thread Giacomo Alzetta
I'm trying to compile python3.3 on my (K)ubuntu 12.04, but some modules are missing. In particular when doing make test I get: Python build finished, but the necessary bits to build these modules were not found: _bz2 _curses_curses_panel _dbm _gdbm

Re: Missing modules compiling python3.3

2012-11-04 Thread Giacomo Alzetta
Il giorno domenica 4 novembre 2012 15:56:03 UTC+1, mm0fmf ha scritto: Giacomo Alzetta wrote: I'm trying to compile python3.3 on my (K)ubuntu 12.04, but some modules are missing. In particular when doing make test I get: Python build finished, but the necessary bits

Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
I've just noticed that the bisect module lacks of the key parameter. The documentation points to a recipe that could be used to handle a sorted collection, but I think it's an overkill if I want to bisect my sequence only once or twice with a key. Having something like `bisect(sequence,

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
Il giorno mercoledì 12 settembre 2012 17:54:31 UTC+2, Giacomo Alzetta ha scritto: I've just noticed that the bisect module lacks of the key parameter. The documentation points to a recipe that could be used to handle a sorted collection, but I think it's an overkill if I want to bisect

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
Il giorno mercoledì 12 settembre 2012 18:05:10 UTC+2, Miki Tebeka ha scritto: I've just noticed that the bisect module lacks of the key parameter. ... Is there some reason behind this lack? See full discussion at http://bugs.python.org/issue4356. Guido said it's going in, however

Re: Why doesn't Python remember the initial directory?

2012-08-19 Thread Giacomo Alzetta
Il giorno domenica 19 agosto 2012 22:42:16 UTC+2, kj ha scritto: As far as I've been able to determine, Python does not remember (immutably, that is) the working directory at the program's start-up, or, if it does, it does not officially expose this information. Does anyone know why

Re: in-place exponentiation incongruities

2012-08-14 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 23:53:46 UTC+2, Terry Reedy ha scritto: Are you actually planning to do this, or is this purely theoretical? Yes, I do plan to implement ipow. Not true. Whether the function is coded in Python or C cls.__ipow__(base, exp, mod) # or

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 06:28:10 UTC+2, Steven D'Aprano ha scritto: On Sat, 11 Aug 2012 09:54:56 -0700, Giacomo Alzetta wrote: I've noticed some incongruities regarding in-place exponentiation. On the C side nb_inplace_power is a ternary function, like nb_power (see

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 13:03:08 UTC+2, Steven D'Aprano ha scritto: On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote: From The Number Protocol(http://docs.python.org/c-api/number.html). The full text is: PyObject* PyNumber_InPlacePower(PyObject *o1

Re: [c-api]Transmutation of an extension object into a read-only buffer adding an integer in-place.

2012-08-11 Thread Giacomo Alzetta
Il giorno venerdì 10 agosto 2012 20:50:08 UTC+2, Stefan Behnel ha scritto: Giacomo Alzetta, 10.08.2012 10:20: I'm trying to implement a c-extension which defines a new class(ModPolynomial on the python side, ModPoly on the C-side). At the moment I'm writing the in-place addition, but I

Re: [c-api]Transmutation of an extension object into a read-only buffer adding an integer in-place.

2012-08-11 Thread Giacomo Alzetta
Il giorno sabato 11 agosto 2012 08:40:18 UTC+2, Stefan Behnel ha scritto: Giacomo Alzetta, 11.08.2012 08:21: I'd prefer to stick to Python and C, without having to put cython sources or cython-generated c modules (which I know are almost completely unreadable from a human point

in-place exponentiation incongruities

2012-08-11 Thread Giacomo Alzetta
I've noticed some incongruities regarding in-place exponentiation. On the C side nb_inplace_power is a ternary function, like nb_power (see here: http://docs.python.org/c-api/typeobj.html?highlight=numbermethods#PyNumberMethods). Obviously you can't pass the third argument using the usual

[c-api]Transmutation of an extension object into a read-only buffer adding an integer in-place.

2012-08-10 Thread Giacomo Alzetta
I'm trying to implement a c-extension which defines a new class(ModPolynomial on the python side, ModPoly on the C-side). At the moment I'm writing the in-place addition, but I get a *really* strange behaviour. Here's the code for the in-place addition: #define ModPoly_Check(v)

Re: [c-api]Transmutation of an extension object into a read-only buffer adding an integer in-place.

2012-08-10 Thread Giacomo Alzetta
Il giorno venerdì 10 agosto 2012 11:22:13 UTC+2, Hans Mulder ha scritto: On 10/08/12 10:20:00, Giacomo Alzetta wrote: I'm trying to implement a c-extension which defines a new class(ModPolynomial on the python side, ModPoly on the C-side). At the moment I'm writing the in-place

Re: [c-api]Transmutation of an extension object into a read-only buffer adding an integer in-place.

2012-08-10 Thread Giacomo Alzetta
Il giorno venerdì 10 agosto 2012 14:21:50 UTC+2, Hans Mulder ha scritto: On 10/08/12 11:25:36, Giacomo Alzetta wrote: Il giorno venerdì 10 agosto 2012 11:22:13 UTC+2, Hans Mulder ha scritto: [...] Yes, you're right. I didn't thought the combined operator would do a Py_DECREF