[issue13386] Document documentation conventions for optional args

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

> From Ezio's original post: '''
> If a function has optional arguments but it doesn't accept keyword 
> arguments, the "func([arg1])" notation is used instead. ... The 
> notation "func([arg=default])" should never be used, and "func([arg])" 
> should be used only when keyword args are not accepted.
> '''
>
> In the following, I give objections to this PO (position only) rule and > 
> suggest an alternative ND (no default) rule: use 'name=default' when
> there is a default and '[name]' when there is not'.

Maybe we should try to keep it simple and just document the signature of the 
function.
Everything that can not be described in the signature can be explained by words.

I tried to write down all the combinations of optional/non optional, 
with/without default, works/doesn't work with keywords to see how to represent 
them, but it started being a bit messy.  The "problematic" combinations (for 
example a function that accepts an optional arguments with no default but that 
doesn't work with keywords) seem quite rare, and for them we could just write 
down what's special about them.

There are two more cases that could be solved with a specific notation though:
1) optional arg, with default, doesn't work with keywords (e.g. range, 
startswith):
   func(arg1)
   func(arg1, arg2)
   *arg2* defaults to .
2) optional arg, with no default, that works only with keywords:
   func(arg1, *, arg2)

The keyword-only *, and the multiple signatures "tricks" can also be used for 
other similar cases.

func(arg1, **kwargs) can be used for functions that accept kwargs without 
expecting any specific value; if the values are known and have defaults they 
could be included in the signature (even if the default is like foo = 
kwargs.get('foo', default)).

This should cover most of the cases, it only uses valid Python syntax and 
avoids potentially confusing [].

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

> I found safe_repr() from Lib/unittest/util.py.

The functions in Lib/unittest/util.py shouldn't be used outside unittest.

> We would require a similar function, just implemented in C.
> What is a good place to define such C helpers that could be used everywhere?

You could start by adding it in the file where you need it.  If it starts 
becoming useful elsewhere too, it can then be moved somewhere else.  I would 
expect such function to be private, so we are free to move it whenever we need 
it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

Ezio Melotti wrote:
> You could start by adding it in the file where you need it. If it
> starts becoming useful elsewhere too, it can then be moved somewhere
> else. I would expect such function to be private, so we are free to
> move it whenever we need it.

Well, msg147109 already lists 6 files that would use this function.
Some of them are under Objects&, some are under Modules/.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13423] Ranges cannot be meaningfully compared for equality or hashed

2011-11-18 Thread Chase Albert

New submission from Chase Albert :

My expectation was that range(2,5) == range(2,5), and that they should hash the 
same. This is not the case.

--
messages: 147838
nosy: rob.anyone
priority: normal
severity: normal
status: open
title: Ranges cannot be meaningfully compared for equality or hashed
type: behavior
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13423] Ranges cannot be meaningfully compared for equality or hashed

2011-11-18 Thread Florent Xicluna

Florent Xicluna  added the comment:

this was implemented with ticket #13201.
It will be available in version 3.3.

--
nosy: +flox
resolution:  -> out of date
stage:  -> committed/rejected
status: open -> closed
superseder:  -> Implement comparison operators for range objects
type: behavior -> feature request

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13424] Add examples for open’s new opener argument

2011-11-18 Thread Éric Araujo

New submission from Éric Araujo :

The new opener argument to open and TextIOWrapper closed two bugs on this 
tracker: using O_CLOEXEC and replacing the unofficial 'c' mode (O_CREATE).  I 
think it’d be nice to have these as examples (maybe not in the docs of 
TextIOWrapper which are already huge, but for example in the os docs after the 
O_* constants).

--
assignee: docs@python
components: Documentation
messages: 147840
nosy: docs@python, eric.araujo
priority: normal
severity: normal
status: open
title: Add examples for open’s new opener argument
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12760] Add create mode to open()

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

See #13424 for a doc request about this.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13424] Add examples for open’s new opener argument

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

s/TextIOWrapper/FileIO/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12797] io.FileIO and io.open should support openat

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

See #13424 for a doc request about this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12780] Clean up tests for pyc/pyo in __file__

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

> Seems reasonable to me.  When did/does unicodedata ever have a __file__ 
> attribute?
No idea.  Maybe it has to do with static vs. dynamic linking?  Or alternate VMs?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2979] use_builtin_types in xmlrpc.server

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

Looks good.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Attached patch should solve the issue.

--
assignee:  -> ezio.melotti
keywords: +patch
stage: test needed -> commit review
versions: +Python 3.2, Python 3.3
Added file: http://bugs.python.org/file23721/issue13358.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13294] http.server: HEAD request should not return a body

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

Hi Michele, long time no see :)

> Well, actually SimpleHTTPRequesthandler extends BaseHTTPHandler with basic 
> do_GET and
> do_HEAD methods.
> Unittests for http.server shows that this behavior is intended, since: [snip] 
Not sure what this test shows (maybe because I need coffee :)

> Anyway, I would propose a trivial patch to make http.server a little more 
> elegant.
The first change may do more that you want it to: rstrip without argument will 
remove all whitespace, but there the code wants to remove only CRLF or LF.  
Anyway, changes for the sake of elegance or cleanliness are not done for the 
sake of it, but usually as a part of a greater refactoring or fix.  We prefer 
to minimize chances of compatibility breakage by avoiding gratuitous changes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

I did some tests, creating an element ('elem') that contains two adjacent text 
nodes ('text').  With my latest patch the prettyprint is:


text
text


Here both the text nodes are printed on a newline and they are indented.

With your patch it should be:

texttext

I'm not sure there's any reason to prefer the second option though.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-18 Thread Stanisław Jankowski

New submission from Stanisław Jankowski :

http.client.HTTPMessage.getallmatchingheaders() always returns []

Python 3.2.2:
Calling the code below does not give the expected result.

sjankowski@sjankowski:~$ python3
Python 3.2.2rc1 (default, Aug 14 2011, 18:43:44) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.request import urlopen
>>> fp = urlopen('http://www.python.org/')
>>> fp.headers.getallmatchingheaders('Content-Type')
[]

At Python 2.7.2 returns the result.

sjankowski@sjankowski:~$ python
Python 2.7.2+ (default, Aug 16 2011, 09:23:59) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib import urlopen
>>> fp = urlopen('http://www.python.org/')
>>> fp.headers.getallmatchingheaders('Content-Type')
['Content-Type: text/html\r\n']

--
components: Library (Lib)
messages: 147849
nosy: stachjankowski
priority: normal
severity: normal
status: open
title: http.client.HTTPMessage.getallmatchingheaders() always returns []
type: behavior
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

The problem seems to be in Lib/http/client.py:227.
The code adds a ':' that is not found in the list of headers returned by 
self.keys().

--
nosy: +ezio.melotti

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-18 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
nosy: +petri.lehtinen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] The Python Standard Library >> 11. Data Persistence

2011-11-18 Thread Nebelhom

New submission from Nebelhom :

--
Python v3.3a0 documentation >> The Python Standard Library >> 11. Data
Persistence

Section 11.1 pickle module

#1
11.1.3. Module Interface

exception pickle.UnpicklingError

   Error raised when there a problem unpickling an object, such as a data 
corruption or a security violation.
   It inherits PickleError.

TYPO: Error raised when there IS a problem unpickling an object

--
#2
11.1.3. Module Interface

persistent_load(pid)

   Raise an UnpickingError by default.

TYPO: Should be "Unpick"l"ingError" as wrtten earlier in the section


#3
11.1.4 What can be pickled and unpickled

Note that functions (built-in and user-defined) are pickled by >>fully
qualified<< name reference, not by value.
This means that only the function name is pickled, along with the name of 
module the function is defined in.

TYPO: along with the name of "THE" module the function is defined in.


#4
11.1.5.1. Persistence of External Objects

In Windows XP SP3, example does not work out of the box as sqlite3 is not 
included when compiling python3.3a following the Getting Set Up directions in 
the Developer's Guide

Is this an issue?

Code works in Ubuntu 10.04 lucid.

When run from Terminal, it gives the following output:

Pickled records:
[MemoRecord(key=1, task='give food to fish'),
 MemoRecord(key=2, task='prepare group meeting'),
 MemoRecord(key=3, task='fight with a zebra')]
Unpickled records:
[MemoRecord(key=1, task='learn italian'),
 MemoRecord(key=2, task='prepare group meeting'),
 MemoRecord(key=3, task='fight with a zebra')]


 Should that not be given afterwards as a reference to the user, so that
(s)he knows, that the code is right?


#5
11.1.6 Restricting Globals

Thus it is possible to either forbid completely globals

NOTE: should be "either completely forbid globals"



--
assignee: docs@python
components: Documentation
messages: 147851
nosy: Nebelhom, docs@python
priority: normal
severity: normal
status: open
title: The Python Standard Library >> 11. Data Persistence
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Actually the headers are already parsed, so the code should use self.items() 
instead of self.keys(), check if the key (without ':') matches, and append the 
key-value pair to the list.
Having a list of key-value pairs seems more useful than having a bare string, 
but this would be incompatible with 2.7.
This function also doesn't seem to be tested and documented, and it's used only 
once in the stdlib.

--
keywords: +easy
stage:  -> test needed
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Nick Coghlan

Nick Coghlan  added the comment:

Please don't stress too much about providing an indication that the repr has 
been truncated - it's an error message, not part of the normal program output. 
Besides, the lack of a closing ')', ']', '}' or '>' will usually indicate 
something is amiss in long reprs.

More useful would be to raise a separate feature request about the lack of 
width and precision handling for string formatting in PyUnicode_FromFormatV - 
the common format code handling means it *accepts* the width and precision 
information for string codes, but then proceeds to completely ignore it. It 
should be using them to pad short strings (width) and truncate long ones 
(precision), just like printf() (only in terms of code points rather than 
bytes, since those codes work with Unicode text).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13427] string comparison with ==

2011-11-18 Thread Alan Beccati

New submission from Alan Beccati :

Hello,
did I discover a python string comparison bug or is this behaviour expected and 
I am doing something wrong?

This is the code I run:
for line in lines[4:]:
currColl=line.split(":")[1].strip()
print "'",currColl,"'","==","'",collName,"'"
if currColl == collName :
return True
else:
print "not equal"

where currColl is a method parameter and lines is built from subprocess Popen 
like:
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
lines=[]
for line in p.stdout.readlines():
lines.append(line)

The output of the abovementioned code is:
' utm ' == ' utm10 '
not equal
' utm1000 ' == ' utm10 '
not equal
' utm100 ' == ' utm10 '
not equal
' utm10 ' == ' utm10 '
not equal
' utm1 ' == ' utm10 '
not equal

as you can see the fourth comparison should return True while it gives a "not 
equal" as the others.

Python info:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) 
[GCC 4.5.2] on linux2

--
messages: 147854
nosy: Alan.Beccati
priority: normal
severity: normal
status: open
title: string comparison with ==
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13427] string comparison with ==

2011-11-18 Thread Florent Xicluna

Florent Xicluna  added the comment:

collName is probably not what you expect.
You can print repr(collName), repr(currColl) to verify this.

It is not a bug on Python side.

--
nosy: +flox
resolution:  -> works for me
stage:  -> committed/rejected
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] The Python Standard Library >> 11. Data Persistence

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset ce34e9223450 by Ezio Melotti in branch '2.7':
#13426: fix typo in pickle doc.
http://hg.python.org/cpython/rev/ce34e9223450

New changeset 1f31061afdaf by Ezio Melotti in branch '3.2':
#13426: fix typos in pickle doc.
http://hg.python.org/cpython/rev/1f31061afdaf

New changeset 7992f3247447 by Ezio Melotti in branch 'default':
#13426: merge with 3.2.
http://hg.python.org/cpython/rev/7992f3247447

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] The Python Standard Library >> 11. Data Persistence

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

This is fixed now, thanks for the report!
Regarding #4, sqlite3 is included in the official installer provided for 
Windows, so that shouldn't be a problem.
Regarding the output, I don't think is necessary to add it.
The example is fairly complex, so people that need it will probably have to try 
it and experiment a bit anyway, rather than just reading 100 lines of code and 
trying to understand how they work without actually trying it.

--
assignee: docs@python -> ezio.melotti
nosy: +ezio.melotti
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
versions: +Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13428] PyUnicode_FromFormatV: support width and precision for string codes, e.g %S and %R

2011-11-18 Thread Petri Lehtinen

New submission from Petri Lehtinen :

Currently, the width and precision information for string codes are accepted 
but ignored. They should be used to pad short strings (width) and truncate long 
ones (precision), just like printf() (only in terms of code points rather than 
bytes, since those codes work with Unicode text).

--
components: Interpreter Core
messages: 147858
nosy: petri.lehtinen
priority: normal
severity: normal
status: open
title: PyUnicode_FromFormatV: support width and precision for string codes, e.g 
%S and %R
type: feature request
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

Nick Coghlan wrote:
> Please don't stress too much about providing an indication that the
> repr has been truncated - it's an error message, not part of the
> normal program output. Besides, the lack of a closing ')', ']', '}'
> or '>' will usually indicate something is amiss in long reprs.

Ok. This makes things easier.

> More useful would be to raise a separate feature request about the
> lack of width and precision handling for string formatting in
> PyUnicode_FromFormatV - the common format code handling means it
> *accepts* the width and precision information for string codes, but
> then proceeds to completely ignore it. It should be using them to
> pad short strings (width) and truncate long ones (precision), just
> like printf() (only in terms of code points rather than bytes, since
> those codes work with Unicode text).

Created #13428.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13428] PyUnicode_FromFormatV: support width and precision for string codes, e.g %S and %R

2011-11-18 Thread STINNER Victor

STINNER Victor  added the comment:

Duplicate of #7330.

--
nosy: +haypo
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

2011-11-18 Thread STINNER Victor

STINNER Victor  added the comment:

Issue #13428 has been marked as a duplicate of this issue.

--
nosy: +petri.lehtinen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13427] string comparison with ==

2011-11-18 Thread Florent Xicluna

Changes by Florent Xicluna :


--
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] Typos in pickle docs

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
title: The Python Standard Library >> 11. Data Persistence -> Typos in pickle 
docs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] The Python Standard Library >> 11. Data Persistence

2011-11-18 Thread Nebelhom

Nebelhom  added the comment:

Hi Ezio,

"Regarding the output, I don't think is necessary to add it."

I left it in because of a discussion in core-mentorship, where they
mentioned that it would be beneficial to have it in. I pasted the exchange
below if you are interested.

Thanks for looking at it,

Johannes

-
Pasted content:

Message: 2
Date: Fri, 18 Nov 2011 04:15:03 +0200
From: Eli Bendersky 
To: Python Core Development Mentorship 
Subject: Re: [Core-mentorship] What classes as an issue in
   documentation?
Message-ID:
   
Content-Type: text/plain; charset=windows-1252

trying
> to gauge what is relevant and what is just a little overly picky.
>
> I applied the standard, I use when proofreading scientific texts of fellow
> researchers (which raises the bar into infinity as you may always
encounter
> someone who is willing to split hairs over a comma in the wrong position
> just to be right). I would be grateful, if you could just quickly scan
over
> the list and say in each case (I numbered them) if it is relevant or not.
>
> thanks a bundle.
>
> Johannes
>
> P.S. Also, one issue for all issues in one section (like Nick Coghlan
> suggested)
>
> --
> Python v3.3a0 documentation ? The Python Standard Library ? 11. Data
> Persistence ?
>
> Section 11.1 pickle module
>
> #1
> 11.1.3. Module Interface
>
> exception pickle.UnpicklingError
>
> ??? Error raised when there a problem unpickling an object, such as a data
> corruption or a security violation.
> ??? It inherits PickleError.
>
> TYPO: Error raised when there IS a problem unpickling an object
>
> --
> #2
> 11.1.3. Module Interface
>
> persistent_load(pid)
>
> ??? Raise an UnpickingError by default.
>
> TYPO: Should be "Unpick"l"ingError" as wrtten earlier in the section
>
> --
--
> #3
> 11.1.4 What can be pickled and unpickled
>
> Note that functions (built-in and user-defined) are pickled by ?fully
> qualified? name reference, not by value.
> This means that only the function name is pickled, along with the name of
> module the function is defined in.
>
> TYPO: along with the name of "THE" module the function is defined in.
>
> 
> #4
> 11.1.5.1. Persistence of External Objects
>
> In Windows XP SP3, example does not work out of the box as sqlite3 is not
> included when compiling python3.3a
> following the Getting Set Up directions in the Developer's Guide
>
> Is this an issue?
>
> Code works in Ubuntu 10.04 lucid.
>
> When run from Terminal, it gives the following output:
>
> Pickled records:
> [MemoRecord(key=1, task='give food to fish'),
> ?MemoRecord(key=2, task='prepare group meeting'),
> ?MemoRecord(key=3, task='fight with a zebra')]
> Unpickled records:
> [MemoRecord(key=1, task='learn italian'),
> ?MemoRecord(key=2, task='prepare group meeting'),
> ?MemoRecord(key=3, task='fight with a zebra')]
>
>
> ?Should that not be given afterwards as a reference to the user, so that
> (s)he knows, that the code is right?
>
> 
> #5
> 11.1.6 Restricting Globals
>
> Thus it is possible to either forbid completely globals
>
> NOTE: should be "either completely forbid globals"
>

Johannes,

These look perfectly valid to me. Even the smallest typos mentioned
here are worth fixing. The next step is opening an issue in the
tracker (http://bugs.python.org/) and submitting a patch.

Eli

--

Message: 3
Date: Fri, 18 Nov 2011 13:17:11 +1000
From: Nick Coghlan 
To: Python Core Development Mentorship 
Subject: Re: [Core-mentorship] What classes as an issue in
   documentation?
Message-ID:
   
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Nov 18, 2011 at 12:15 PM, Eli Bendersky  wrote:
> Johannes,
>
> These look perfectly valid to me. Even the smallest typos mentioned
> here are worth fixing. The next step is opening an issue in the
> tracker (http://bugs.python.org/) and submitting a patch.

Although I'll note that even if you're not yet ready to make the patch
yourself, a detailed report like this one makes it very easy for
someone *else* to produce a patch, so the tracker issue is the most
important next step.

Lots of things have to happen for a change to get into the source
tree, and the reason we have tools like the tracker around is so that
the work can be coordinated amongst multiple people.

Even as core devs, we'll still often post changes we design, code and
commit ourselves as tracker issues for a while, just so we have a
venue to coordinate reviews and gather feedback.

Cheers,
Nick.

--
title: Typos in pickle docs -> The Python Standard Library >> 11. Data 
Persistence

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.or

[issue6570] Tutorial clarity: section 4.7.2, parameters and arguments

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Here is a new patch.

--
Added file: http://bugs.python.org/file23722/issue6570-2.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13125] test_all_project_files() expected failure

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10772] Several actions for argparse arguments missing from docs

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

Looks good to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10772] Several actions for argparse arguments missing from docs

2011-11-18 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage: patch review -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4508] distutils compiler not handling spaces in path to output/src files

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

> Ok, I found a similar problem with MMTK.
I don’t know what that is.

> I am currently altering my distutils package to add a function called 
> nt_quote_dir
> that adds quotes to paths with spaces and then applies it to each path if the 
> platform
> is win32.
You shouldn’t have to do that; there’s already a similar function in 
distutils.spawn.

> When I'm done I will submit a diff after confirming that it works.
What is needed is a diff for distutils 2.7 or 3.2 adding a test with a file 
containing a space.  I can’t do anything with diffs for other projects.

--
versions: +Python 3.3 -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13294] http.server: HEAD request should not return a body

2011-11-18 Thread Michele Orrù

Michele Orrù  added the comment:

These tests shows how SimpleHTTPRequestHandler behaves: if the class
contains a do_FOO method, it is called, otherwise error501 is raised.
That's what Karl said with «Or to modify the library code that for any
resources not yet defined.».
Since SimpleHTTPRequestHandler.do_HEAD exists, and this is reflected
in the correspondent unittest, I belive that this is not a bug.

Patch attached. No problem if it's not committed now. I hope that
someone in the noisy list will make a little cleanup one day :)

>
> --
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file23723/issue13294.patch

___
Python tracker 

___diff -r a00bb30cf775 Lib/http/server.py
--- a/Lib/http/server.pyTue Nov 15 16:12:49 2011 +0100
+++ b/Lib/http/server.pyWed Nov 16 11:15:45 2011 +0100
@@ -271,14 +271,11 @@
 self.request_version = version = self.default_request_version
 self.close_connection = 1
 requestline = str(self.raw_requestline, 'iso-8859-1')
-if requestline[-2:] == '\r\n':
-requestline = requestline[:-2]
-elif requestline[-1:] == '\n':
-requestline = requestline[:-1]
+requestline = requestline.rstrip('\r\n')
 self.requestline = requestline
 words = requestline.split()
 if len(words) == 3:
-[command, path, version] = words
+command, path, version = words
 if version[:5] != 'HTTP/':
 self.send_error(400, "Bad request version (%r)" % version)
 return False
@@ -304,7 +301,7 @@
   "Invalid HTTP Version (%s)" % base_version_number)
 return False
 elif len(words) == 2:
-[command, path] = words
+command, path = words
 self.close_connection = 1
 if command != 'GET':
 self.send_error(400,

___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13427] string comparison with ==

2011-11-18 Thread Alan

Alan  added the comment:

Using repr highlights the issue which lies in the behaviour of str.strip() 
which does not strip away null spaces as I would have expected:

' 'utm10\x00' ' == ' 'utm10' '
not equal

Changing the code to:
currColl=line.split(":")[1].strip().strip("\0")

works but I think strip() should already do that by default, shouldn't it?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13420] newer() function in dep_util.py discard changes in the same second

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

Hi David.  Thanks for reporting the issue.  I have to warn you that there is a 
high bar for distutils changes; due to the mass of code out there that relies 
on undocumented internal behavior or works around old bugs, a feature freeze is 
in effect and we try to be very careful with the changes we make to fix bugs.  
Some things clearly qualify as bugs and can be fixed, some things are clearly 
new features and are redirected to the distutils2 project, some bugs can’t be 
fixed because everyone and every tool is used to the buggy behavior.  Here we 
are in a gray area between bug and feature; one can argue that the behavior is 
not what is expected (bug), but one can reply that the documentation just 
doesn’t say that filesystems with millisecond precision are supported (so it 
would be a new feature).

> For example, I've a file that is modified with an installation prefix.
Modified by what when?

> CDBS runs the build step and after the install step. In build step, the 
> prefix is
> '/usr/local' because the prefix argument isn't supported, immediately the 
> install step
> runs with prefix='/usr', so the file that contains a variable with project 
> path
> modified with the prefix is not copied by distutils, it runs in a different 
> millisec
> but in the same second.
I don’t understand when the file is changed.  (BTW, I read some Debian mailing 
lists and I had the impression that CDBS was deprecated.)

--
nosy: +jsjgruber

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13427] string comparison with ==

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Nope, str.strip only strips whitespace, and \x00 is not considered whitespace:
>>> '\x00'.isspace()
False

--
nosy: +ezio.melotti
resolution: works for me -> invalid

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13294] http.server: HEAD request should not return a body

2011-11-18 Thread Michele Orrù

Michele Orrù  added the comment:

As Ezio just pointed out, strip('\r\n') is still behaves differently from the 
previous code. Sorry for that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13420] newer() function in dep_util.py discard changes in the same second

2011-11-18 Thread David Amian

David Amian  added the comment:

sorry, I didn't explain well.
I've a project, in the setup.py file, I've a function called update_prefix, 
that updates the 'path_project' variable with prefix arguments from setup.py
If you runs setup.py with --prefix=/usr, then the file in 
'projectname/projectnameconfig.py' is modified changing the 'path_project' 
variable from @PREFIX@+"share/projectname" to '/usr/share/projectname'.
If you runs setup.py without prefix arguments, the prefix is '/usr/local'.

Debuild which is the tool used to build debian package, in this case using 
CDBS, gives this output:
it first runs:
...
python setup.py build \
--build-base="/tmp/buildd/pdal2-0.3.1/./build"
running build
running build_py
creating /tmp/buildd/pdal2-0.3.1/build
creating /tmp/buildd/pdal2-0.3.1/build/lib.linux-i686-2.7
creating /tmp/buildd/pdal2-0.3.1/build/lib.linux-i686-2.7/pdal
copying pdal/utils.py -> /tmp/buildd/pdal2-0.3.1/./build/lib.linux-i686-2.7/pdal
copying pdal/pdalconfig.py -> 
/tmp/buildd/pdal2-0.3.1/./build/lib.linux-i686-2.7/pdal
...
then it runs:
...
cd . && \
python setup.py install \
--root="/tmp/buildd/pdal2-0.3.1/debian/pdal2/" \
--install-purelib=/usr/lib/python2.7/site-packages/ \
--prefix=/usr --no-compile -O0 --install-layout=deb 
running install
running build
running build_py
running build_scripts

It doesn't copy pdal/pdalconfig.py becouse the file in 
/tmp/buildd/pdal2-0.3.1/./build/lib.linux-i686-2.7/pdal have the same st_mtime 
in seconds than pdal/pdalconfig.py, but if you see de st_mtime, both are 
different in millisec and the file is different.

 File: «pdal/pdalconfig.py»
Modify: 2011-11-16 11:55:52.665727826 +0100

File: «/tmp/buildd/pdal2-0.3.1/./build/lib.linux-i686-2.7/pdal/pdalconfig.py»
Modify: 2011-11-16 11:55:52.0 +0100

but if you print the st_mtime of both files within newer() function you can 
check the file's timestamp are the same when they are really not:
ST_MTIME-source-target-1321440952-1321440952

That is cause of the issue, that I explain in the early comment, I fixed it 
rounding to two decimals instead of rounding to integer.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13426] Typos in pickle docs

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

>> Regarding the output, I don't think is necessary to add it.
> I left it in because of a discussion in core-mentorship, where they
> mentioned that it would be beneficial to have it in.

Well, people can have diverging opinions.  Terry’s was that “having the output, 
perhaps in a separate box, will also help to analyze the code to understand 
it”, but Ezio judged that “the example is fairly complex, so people that need 
it will probably have to try it and experiment a bit anyway”.  I think I agree 
with Ezio.

--
nosy: +terry.reedy
title: The Python Standard Library >> 11. Data Persistence -> Typos in pickle 
docs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13424] Add examples for open’s new opener argument

2011-11-18 Thread Ross Lagerwall

Changes by Ross Lagerwall :


--
nosy: +rosslagerwall

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12779] Update packaging documentation

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

I worked on this a bit more and the current boring diff has more than 1000 
deleted lines and more than 1000 added lines.  After thinking about it, maybe I 
should not make a mega-patch with markup/boring changes first but rather fix 
markup as part of more consistent wording and reorganization changes.  The 
series of changesets could look like this:

- Update and improve Doc/install (the end-user guide, a few files)
- Update and improve the commands reference in Doc/packaging
- Improve introduction material in Doc/packaging
- Fix X in Doc/library/packaging.foo
- Add missing doc for packaging.spam in Doc/library
- etc.

I think that will make more sense to review.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13420] newer() function in dep_util.py discard changes in the same second

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

> I've a project, in the setup.py file, I've a function called update_prefix, 
> that updates the
> 'path_project' variable with prefix arguments from setup.py
> If you runs setup.py with --prefix=/usr, then the file in 
> 'projectname/projectnameconfig.py' is
> modified changing the 'path_project' variable from 
> @PREFIX@+"share/projectname" to
> '/usr/share/projectname'. If you runs setup.py without prefix arguments, the 
> prefix is '/usr/local'.

Did you write a custom 'install' class or are you for example looking at 
sys.argv to decide whether to run your function?  If it’s not implemented as a 
distutils command, it’s not surprising that it does not integrate well.

> [...]
> That is cause of the issue, that I explain in the early comment, I fixed it 
> rounding to two decimals
> instead of rounding to integer.

Okay.  Can you make sure that this is the source of the problem, for example by 
adding time.sleep(1) between build and install?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4442] document immutable type subclassing via __new__

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4395] Document auto __ne__ generation; provide a use case for non-trivial __ne__

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13322] buffered read() and write() does not raise BlockingIOError

2011-11-18 Thread sbt

sbt  added the comment:

> Thanks again. Just a nit: the tests should be in MiscIOTest, since 
> they don't directly instantiate the individual classes. Also, perhaps 
> it would be nice to check that the exception's "errno" attribute is 
> EAGAIN.


Done.

--
Added file: http://bugs.python.org/file23724/write_blockingioerror.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13388] document hg commit hooks in the devguide

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

> The commit details (including its changeset, branch and commit message)

In Mercurial terminology, a changeset *is* a commit (or if you really want to 
make a distinction, a commit is the action that creates a changeset).  I think 
you meant “diff”.  Moreover, only the first line of the commit message is 
added, which is IMO worth mentioning.  Finally, I think we should recommend the 
“#12345” style: For one thing, it makes our hgweb application create links.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13343] Lambda keyword-only argument not updating co_freevars

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

> It's made my day. I get to boast at school now!
You could do more of that if you got a patch committed!  See 
http://docs.python.org/devguide and 
http://mail.python.org/mailman/listinfo/core-mentorship for more info if you’re 
interested.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13292] missing versionadded for bytearray

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for cleaning up the reports.  I’m not a numbers person :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 7262f8f276ff by Ezio Melotti in branch '2.7':
#4147: minidom's toprettyxml no longer adds whitespace around a text node when 
it is the only child of an element.  Initial patch by Dan Kenigsberg.
http://hg.python.org/cpython/rev/7262f8f276ff

New changeset 5401daa96a21 by Ezio Melotti in branch '3.2':
#4147: minidom's toprettyxml no longer adds whitespace around a text node when 
it is the only child of an element.  Initial patch by Dan Kenigsberg.
http://hg.python.org/cpython/rev/5401daa96a21

New changeset cb6614e3438b by Ezio Melotti in branch 'default':
#4147: merge with 3.2.
http://hg.python.org/cpython/rev/cb6614e3438b

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

I committed my patch with a few more tests.  This should be fixed now.
Thanks for the report and the patch!

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Stefan Behnel

New submission from Stefan Behnel :

In Python modules, the top-level module code sees the __file__ variable and can 
use it to refer to resources in package subdirectories, for example. This is 
not currently possible in extension modules, because __file__ is only set after 
running the module init function, and the module has no way to find out its 
runtime location.

CPython should set __file__ directly in PyModule_Create2(), based on 
information provided by the shared library loader. This would let 
PyModule_GetFilenameObject() work immediately with the newly created module 
object.

The relevant python-dev thread is here:

http://mail.python.org/pipermail/python-dev/2011-November/114476.html

A patch will follow soon.

--
components: Extension Modules, Interpreter Core
messages: 147881
nosy: scoder
priority: normal
severity: normal
status: open
title: provide __file__ to extension init function
type: feature request
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Marko Nervo

New submission from Marko Nervo :

I think it would be very usefull to add a curry function to the functools 
module. It should be like this.


def curry(func, *args, **kwargs):

if (len(args) + len(kwargs)) >= func.__code__.co_argcount:

return func(*args, **kwargs)

return (lambda *x, **y: curry(func, *(args + x), **dict(kwargs, **y)))


This function allows you to create curried functions or methods in two main 
ways:


(1)


>>> def adder(x, y, z):
... return (x + y + z)
>>> adder = curry(adder)


(2)


>>> @curry
... def adder(x, y, z):
... return (x + y + z)


Curried functions could be used as follow.


>>> adder(2, 3, 4)
>>> adder(2, 3)(4)
>>> adder(2)(3)(4)
>>> adder(z = 4)(2, 3)  # etc, etc, etc...


Best regards,
Marco.

--
components: Library (Lib)
messages: 147882
nosy: collinwinter, eric.araujo, gregory_p, markonervo, rhettinger, serprex
priority: normal
severity: normal
status: open
title: Add a curry function to the functools module
type: feature request
versions: Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 91163aa3d5b4 by Ezio Melotti in branch '2.7':
#13358: HTMLParser now calls handle_data only once for each CDATA.
http://hg.python.org/cpython/rev/91163aa3d5b4

New changeset 0a32e7e3aa1f by Ezio Melotti in branch '3.2':
#13358: HTMLParser now calls handle_data only once for each CDATA.
http://hg.python.org/cpython/rev/0a32e7e3aa1f

New changeset e12d2b9c88ef by Ezio Melotti in branch 'default':
#13358: merge with 3.2.
http://hg.python.org/cpython/rev/e12d2b9c88ef

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13358] HTMLParser incorrectly handles cdata elements.

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

This should be fixed now, let me know if you find other problems with the 
parser.

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

This sounds similar to 
http://wiki.python.org/moin/PythonDecoratorLibrary#Pseudo-currying

Do you have a concrete use case for this?

--
nosy: +ezio.melotti
versions: +Python 3.3 -Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You can use functools.partial for similar effect. Not sure what a dedicated 
curry() primitive would improve.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Alex Gaynor

Alex Gaynor  added the comment:

This already exists, as functools.partial: 
http://docs.python.org/library/functools.html#functools.partial

--
nosy: +alex
resolution:  -> invalid
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Stefan Behnel

Changes by Stefan Behnel :


--
keywords: +patch
nosy: +loewis
Added file: http://bugs.python.org/file23725/ext_module_init_file_path.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue9614] _pickle is not entirely 64-bit safe

2011-11-18 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +brian.curtin
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Stefan Behnel

Stefan Behnel  added the comment:

Here is an extension to the patch that implements the protocol also for 
extension module reinitialisation, so that the module creation can also set 
__file__ and the proper package in that case. Currently without tests (and 
users, I guess).

--
Added file: http://bugs.python.org/file23726/ext_module_reinit_context.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3430] httplib.HTTPResponse documentations inconsistent

2011-11-18 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
resolution: accepted -> 
versions: +Python 3.3 -Python 2.6, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10469] test_socket fails using Visual Studio 2010

2011-11-18 Thread Sébastien Sablé

Sébastien Sablé  added the comment:

I can also confirm that this patch corrects the problem with test_asyncore for 
Python 2.7 built with VS2010.

--
nosy: +sable

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11112] UDPTimeoutTest derives from SocketTCPTest

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 0fdf7f7c353d by Ezio Melotti in branch '2.7':
#2: Fix typo in a base class in test_socket.
http://hg.python.org/cpython/rev/0fdf7f7c353d

New changeset b410bcd300a1 by Ezio Melotti in branch '3.2':
#2: Fix typo in a base class in test_socket.
http://hg.python.org/cpython/rev/b410bcd300a1

New changeset 116ed0ce5756 by Ezio Melotti in branch 'default':
#2: merge with 3.2.
http://hg.python.org/cpython/rev/116ed0ce5756

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10469] test_socket fails using Visual Studio 2010

2011-11-18 Thread Brian Curtin

Brian Curtin  added the comment:

FYI: this would likely be handled through #13210. I have a conversion sandbox 
started at http://hg.python.org/sandbox/vs2010port/ and am working through 
fixing test failures after the initial conversion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11112] UDPTimeoutTest derives from SocketTCPTest

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed, thanks for the report!

--
assignee:  -> ezio.melotti
nosy: +ezio.melotti
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
versions:  -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11107] Cache constant "slice" instances

2011-11-18 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13210] Support Visual Studio 2010

2011-11-18 Thread Brian Curtin

Brian Curtin  added the comment:

I mentioned this on another issue, but I created a clone at 
http://hg.python.org/sandbox/vs2010port/. I've already gone through the port in 
the past but wasn't able to release the code at the time. As I work through it, 
I'll occasionally announce large milestones here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13210] Support Visual Studio 2010

2011-11-18 Thread Tim Golden

Tim Golden  added the comment:

Thanks. I was going to ask about this to see if anyone had already done 
the legwork.

--
nosy: +tim.golden

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10980] http.server Header Unicode Bug

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Now it's too late for 3.1, should this still go to 2.7?

--
nosy: +ezio.melotti
versions:  -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10980] http.server Header Unicode Bug

2011-11-18 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Please.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Marko Nervo

Marko Nervo  added the comment:

In [1]: import functools

In [2]: def adder(x, y, z):
   ...: return (x + y + z)
   ...: 

In [3]: adder = functools.partial(adder)

In [4]: adder(2)(3)(4)
---
TypeError Traceback (most recent call last)

/home/marko/ in ()

TypeError: adder() takes exactly 3 arguments (1 given)


No, it can't be replaced using functools.partial.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13387] suggest assertIs(type(obj), cls) for exact type checking

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed.

--
assignee: docs@python -> ezio.melotti
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
versions: +Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

To go back to your original message:

> I think it would be very usefull to add a curry function to the functools 
> module.

For what use cases?

> Curried functions could be used as follow.
>>> adder(2, 3, 4)
>>> adder(2, 3)(4)
>>> adder(2)(3)(4)
>>> adder(z = 4)(2, 3)  # etc, etc, etc...

I don’t know the curry concept from other languages, but I’m experienced with 
Python and don’t like this idea at all.  A function returns something; the 
returned value being callable or not is a property of that value, not of the 
function.  The examples above look confusing to me.

I think you should discuss your use cases on the python-ideas mailing list.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13387] suggest assertIs(type(obj), cls) for exact type checking

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset fd9d7a8e45bc by Ezio Melotti in branch '2.7':
#13387: add note about checking the exact type in assertIsInstance doc.
http://hg.python.org/cpython/rev/fd9d7a8e45bc

New changeset 583aff635ce1 by Ezio Melotti in branch '3.2':
#13387: add note about checking the exact type in assertIsInstance doc.
http://hg.python.org/cpython/rev/583aff635ce1

New changeset 196d485ed26d by Ezio Melotti in branch 'default':
#13387: merge with 3.2.
http://hg.python.org/cpython/rev/196d485ed26d

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2286] Stack overflow exception caused by test_marshal on Windows x64

2011-11-18 Thread Sébastien Sablé

Sébastien Sablé  added the comment:

I had the exact same problem when compiling the Python 2.7 branch with Visual 
Studio 2010.

In debug mode and 64 bits, python will crash on test_loads_recursion in 
test_marshal and on the code provided in msg63536.

Could you please reopen this issue?

--
nosy: +sable
versions: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10227] Improve performance of MemoryView slicing

2011-11-18 Thread Stefan Behnel

Stefan Behnel  added the comment:

Updated single slice caching patch for latest Py3.3 hg tip.

--
Added file: http://bugs.python.org/file23727/slice-object-cache.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13387] suggest assertIs(type(obj), cls) for exact type checking

2011-11-18 Thread Éric Araujo

Éric Araujo  added the comment:

+ To check for a specific type (without including superclasses) use
+ :func:`assertIs(type(obj), cls) `.

Don’t you mean “without accepting subclasses”, not superclasses?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

FWIW there is a somewhat related thread that proposed a new syntax for curried 
functions: http://mail.python.org/pipermail/python-ideas/2009-March/003220.html

--
stage:  -> committed/rejected

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I suppose that the value of _Py_ModuleImportContext is protected by the import 
lock?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13387] suggest assertIs(type(obj), cls) for exact type checking

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

> + To check for a specific type (without including superclasses) use
> + :func:`assertIs(type(obj), cls) `.
>
> Don’t you mean “without accepting subclasses”, not superclasses?

I mean:
>>> class MyInt(int): pass # my specific type
...
>>> isinstance(MyInt(5), int)  # int superclass included
True
>>> type(MyInt(5)) is int  # int superclass not included
False
>>> type(MyInt(5)) is MyInt# check for specific type
True

Do you think I should rephrase it (or maybe just remove the (...))?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10980] http.server Header Unicode Bug

2011-11-18 Thread Armin Ronacher

Armin Ronacher  added the comment:

2.7 does not suffer from this since 2.7 does not support unicode in headers.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13404] Add support for system.methodSignature() to XMLRPC Server

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2286] Stack overflow exception caused by test_marshal on Windows x64

2011-11-18 Thread Sébastien Sablé

Sébastien Sablé  added the comment:

I don't have the issue anymore when bumping the stack size to 230.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13397] Option for XMLRPC clients to automatically transform Fault exceptions into standard exceptions

2011-11-18 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2286] Stack overflow exception caused by test_marshal on Windows x64

2011-11-18 Thread Brian Curtin

Changes by Brian Curtin :


--
components: +Windows
nosy: +brian.curtin
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Stefan Behnel

Stefan Behnel  added the comment:

I don't know how the import lock applies here. Would it have to be protected by 
it? The lifetime is restricted to the call of the extension module init 
function, and its value is saved recursively if the init function triggers 
further imports.

It works exactly like the existing _Py_PackageContext variable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13429] provide __file__ to extension init function

2011-11-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

But the GIL can be released in many places (e.g. a Py_DECREF), and another 
thread can enter the same function and update the same static variable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Marko Nervo

Marko Nervo  added the comment:

I totally disagree with the syntax for curried function, but I think a curry 
function is perfect for the functools module and I also think it could be 
useful at least as functools.partial. In addition, a lot of languages support 
currying, such as Haskell, Scala, Javascript...

However, here an example less confusional

>>> adder = curry(lambda (x, y): (x + y))
>>> adder3 = adder(3)
>>> adder3(4)
7
>>> adder3(5)
8

Currying let you defining new functions on other functions. This is a common 
practice in functional programming (point-free style). So, why not?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> However, here an example less confusional
> 
> >>> adder = curry(lambda (x, y): (x + y))
> >>> adder3 = adder(3)
> >>> adder3(4)
> 7
> >>> adder3(5)
> 8
> 
> Currying let you defining new functions on other functions.

But so does functools.partial. So the question is, what use case does it
help that functools.partial doesn't?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Ezio Melotti

Ezio Melotti  added the comment:

In that thread Guido said:
"""
Haskell has this too, perhaps even more extreme: there's not really
such a thing in Haskell as a function of N arguments (N > 1). "f a b =
..." defines a function f of one argument a which returns another
function ("f a") of one argument b. And so on.

That doesn't mean we need to copy this idea in Python.
"""

New features require a valid use case before being included, and I'm afraid 
"why not?" is not valid :)
(Also nothing prevents you to define your own curry function/decorator and use 
it where you need it.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10227] Improve performance of MemoryView slicing

2011-11-18 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset fa2f8dd077e0 by Antoine Pitrou in branch 'default':
Issue #10227: Add an allocation cache for a single slice object.
http://hg.python.org/cpython/rev/fa2f8dd077e0

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10227] Improve performance of MemoryView slicing

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks Stefan. I'm leaving the issue open since the original topic is a bit 
different.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13322] buffered read() and write() does not raise BlockingIOError

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks. Who should I credit? "sbt"?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9614] _pickle is not entirely 64-bit safe

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This issue is obsolete, there are no 64-bit warnings in _pickle.c anymore.
See issue 11564.

--
resolution:  -> out of date
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Marko Nervo

Marko Nervo  added the comment:

> But so does functools.partial. So the question is, what use case does it
> help that functools.partial doesn't?

Sure, it's common `defining new functions on other functions`... more times. 
Here a stupid example with fold (our reduce).


@curry
def fold(function, start, sequence):
if len(sequence) == 0:
return start
else:
return fold(function, function(start, sequence[0]), sequence[1:])


Now, someone could be define a generic summer function by fold.


import operator as op

summer = fold(op.add)


Now, an other programmer could be use summer for defining listsummer (a 
function which sum only list), as follow.


listsummer = summer([])


In addition, curry is cleaver than functools.partial. 


summer = functools.partial(fold, op.add)
listsummer = functools.partial(summer, [])


However, it is an additional feature. Nobody forces you to use it, but if you 
need it... Yeah, you could rewrite it each time, but why? It is perfect in 
functools (:

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13430] Add a curry function to the functools module

2011-11-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Sure, it's common `defining new functions on other functions`... more
> times. Here a stupid example with fold (our reduce).
> 
> @curry
> def fold(function, start, sequence):
> if len(sequence) == 0:
> return start
> else:
> return fold(function, function(start, sequence[0]), sequence[1:])
> 
> Now, someone could be define a generic summer function by fold.
> 
> import operator as op
> 
> summer = fold(op.add)

Right... so you defined these helper functions (curry, fold) just to...
define a generic summer function? Really?

I understand that fold() and curry() may look pretty to functional
languages people, but they don't solve any real-world problems that
Python doesn't already solve in a neater way. You will have to try a bit
harder and showcase examples of *useful* code that are made
significantly easier through the use of curry().

(no, generic summer functions are *not* real-world use cases. They are
homework exercises for CS students, at best)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >