Re: [Python-Dev] PEP 366 - Relative imports from main modules

2007-07-10 Thread Nick Coghlan
Brett Cannon wrote:
 On 7/9/07, Nick Coghlan [EMAIL PROTECTED] wrote:
 Given the above limitations, I propose that we document the new
 attribute as follows:

 If the module global __package__ exists when executing an import
 statement, it is used to determine the base for relative imports,
 instead of the __name__ and __path__ attributes.
 
 That's fine.  __path__ actually isn't used to resolve relative imports
 into absolute ones anyway; it's used only as a substitute to sys.path
 when importing within a package.

I was referring to the fact that if __path__ is present (indicating a 
package), then the relative import is based directly on __name__, 
otherwise it is based on __name__.rpartition('.')[0].

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
 http://www.boredomandlaziness.org
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Should r53624 be applied to release branches?

2007-07-10 Thread Aaron Bingham
Hello,

We recently had a production failure caused by the issue fixed in r53624 
on the trunk [1].   I see that this patch has also been applied to 
py3k-struni.  Should this patch be merged to the release branches?  In 
the meantime we will have to patch subprocess.py ourselves.

[1] 
http://mail.python.org/pipermail/python-checkins/2007-February/058421.html

Thanks,

-- 
Aaron Bingham
Senior Software Engineer
[EMAIL PROTECTED]
Tel. +49 (0)351 4173-146
Fax +49 (0)351 4173-109

Cenix BioScience GmbH
Tatzberg 47
01307 Dresden, Germany
www.cenix-bioscience.com

-
Sitz der Gesellschaft (Place of Business): Dresden
Geschäftsführer (CEO): Dr. Christophe J. Echeverri
Amtsgericht (Local Court): Dresden, HRB 19964
Ust-ID (VAT-No.): DE205824437
-

WICHTIGE INFORMATION: Diese Email, inklusive der Anhänge, ist 
ausschließlich für den Gebrauch durch die hierzu berechtigten 
Empfänger bestimmt. Sollten Sie nicht der für diese Email bestimmte 
Adressat sein, ist Ihnen jede Veröffentlichung, Vervielfältigung oder 
Weitergabe dieses Dokuments untersagt. Bitte senden Sie eine Email an 
[EMAIL PROTECTED], falls Sie diese Email versehentlich erhalten
haben. Vielen Dank!

IMPORTANT NOTICE:  This message, including any attached documents, is
intended only for the use of the individual or entity to which it is
addressed, and may contain information that is privileged, confidential 
and exempt from disclosure under applicable law.  If the reader of this 
Message is not the intended recipient, or the employee or agent 
responsible for delivering the message to the intended recipient, you 
are hereby notified that any dissemination, distribution or copying of 
this communication is strictly prohibited. If you have received this 
communication in error, please notify Cenix BioScience immediately by 
email at [EMAIL PROTECTED] Thank you.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should r53624 be applied to release branches?

2007-07-10 Thread skip

Aaron We recently had a production failure caused by the issue fixed in
Aaron r53624 on the trunk [1].  I see that this patch has also been
Aaron applied to py3k-struni.  Should this patch be merged to the
Aaron release branches?  In the meantime we will have to patch
Aaron subprocess.py ourselves.

In theory, I'm in favor of backporting, but how far back do you need/want to
apply it?  There will clearly be more 2.5 releases.  I don't think any more
2.4 releases are planned.

Skip
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Should r53624 be applied to release branches?

2007-07-10 Thread Aaron Bingham
[EMAIL PROTECTED] wrote:
 Aaron We recently had a production failure caused by the issue fixed in
 Aaron r53624 on the trunk [1].  I see that this patch has also been
 Aaron applied to py3k-struni.  Should this patch be merged to the
 Aaron release branches?  In the meantime we will have to patch
 Aaron subprocess.py ourselves.

 In theory, I'm in favor of backporting, but how far back do you need/want to
 apply it?  There will clearly be more 2.5 releases.  I don't think any more
 2.4 releases are planned.
   
We will only be supporting 2.4 for a few months more, so as far as we 
are concerned a backport to 2.5 would be sufficient.

Thanks,

-- 
Aaron Bingham
Senior Software Engineer
[EMAIL PROTECTED]
Tel. +49 (0)351 4173-146
Fax +49 (0)351 4173-109

Cenix BioScience GmbH
Tatzberg 47
01307 Dresden, Germany
www.cenix-bioscience.com

-
Sitz der Gesellschaft (Place of Business): Dresden
Geschäftsführer (CEO): Dr. Christophe J. Echeverri
Amtsgericht (Local Court): Dresden, HRB 19964
Ust-ID (VAT-No.): DE205824437
-

WICHTIGE INFORMATION: Diese Email, inklusive der Anhänge, ist 
ausschließlich für den Gebrauch durch die hierzu berechtigten 
Empfänger bestimmt. Sollten Sie nicht der für diese Email bestimmte 
Adressat sein, ist Ihnen jede Veröffentlichung, Vervielfältigung oder 
Weitergabe dieses Dokuments untersagt. Bitte senden Sie eine Email an 
[EMAIL PROTECTED], falls Sie diese Email versehentlich erhalten
haben. Vielen Dank!

IMPORTANT NOTICE:  This message, including any attached documents, is
intended only for the use of the individual or entity to which it is
addressed, and may contain information that is privileged, confidential 
and exempt from disclosure under applicable law.  If the reader of this 
Message is not the intended recipient, or the employee or agent 
responsible for delivering the message to the intended recipient, you 
are hereby notified that any dissemination, distribution or copying of 
this communication is strictly prohibited. If you have received this 
communication in error, please notify Cenix BioScience immediately by 
email at [EMAIL PROTECTED] Thank you.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Need help fixing failing Py3k Unittests in py3k-struni

2007-07-10 Thread Guido van Rossum
One of the most daunting tasks remaining for Python 3.0a1 (to be
released by the end of August) is fixing the remaining failing unit
tests in the py3k-struni branch
(http://svn.python.org/view/python/branches/py3k-struni/).

This is the branch where I have started the work on the
string/unification branch. I want to promote this branch to become the
main Py3k branch ASAP (by renaming it to py3k), but I don't want to
do that until all unit tests pass. I've been working diligently on
this task, and I've got it down to about 50 tests that are failing on
at least one of OSX and Ubuntu (the platforms to which I have easy
access). Now I need help.

To facilitate distributing the task of getting the remaining tests to
pass, I've created a wiki page:
http://wiki.python.org/moin/Py3kStrUniTests . Please help! It's easy
to help: (1) check out the py3k-struni branch; (2) build it; (3) pick
a test and figure out why it's failing; (4) produce a fix; (5) submit
the fix to SF (or check it in, if you have submit privileges and are
confident enough).

In order to avoid duplicate work, I've come up with a simple protocol:
you mark a test in the wiki as MINE (with your name) when you start
looking at it. You mark it as FIXED [IN SF] once you fix it, adding
the patch# if the fix is in SF. If you give up, remove your lock,
adding instead a note with what you've found (even just the names of
the failing subtests is helpful).

Please help!

There are other tasks, see PEP 3100. Mail me if you're interested in
anything specifically. (Please don't ask me do you think I could do
this -- you know better than I whether you're capable of coding at a
specific level. If you don't understand the task, you're probably not
qualified.)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need help fixing failing Py3k Unittests in py3k-struni

2007-07-10 Thread Christian Heimes
Guido van Rossum wrote:
 Please help!

I've made a meta patch that makes debugging the bugs a lot easier. It
replaces assert_(foo == bar) and failUnless(foo == bar) with
failUnlessEqual(foo, bar). failUnlessEqual shows the value of foo and
bar when they are not equal.

http://www.python.org/sf/1751515

sed -r s/self\.assert_\((.*)\ ==/self.failUnlessEqual\(\1,/ -i *.py
sed -r s/self\.failUnless\((.*)\ ==/self.failUnlessEqual\(\1,/ -i *.py

By the way the ctypes unit tests are causing a segfault on my machine:
test_ctypes
Warning: could not import ctypes.test.test_numbers: unpack requires a
string argument of length 1
Segmentation fault

Ubunutu 7.04 on i386 machine with an Intel P3.

Christian

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need help fixing failing Py3k Unittests in py3k-struni

2007-07-10 Thread Steven Bethard
On 7/10/07, Christian Heimes [EMAIL PROTECTED] wrote:
 Guido van Rossum wrote:
  Please help!

 I've made a meta patch that makes debugging the bugs a lot easier. It
 replaces assert_(foo == bar) and failUnless(foo == bar) with
 failUnlessEqual(foo, bar). failUnlessEqual shows the value of foo and
 bar when they are not equal.

 http://www.python.org/sf/1751515

 sed -r s/self\.assert_\((.*)\ ==/self.failUnlessEqual\(\1,/ -i *.py
 sed -r s/self\.failUnless\((.*)\ ==/self.failUnlessEqual\(\1,/ -i *.py

Some of these look questionable, e.g.:

-self.assert_(d == self.spamle or d == self.spambe)
+self.failUnlessEqual(d == self.spamle or d, self.spambe)
...
-self.assert_((a == 42) is False)
+self.failUnlessEqual((a, 42) is False)

I'd probably go with something a little more restrictive, maybe:

r'self.assert_\(\S+ == \S+\)'

Something like that ought to have fewer false positives.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] itertools addition: getitem()

2007-07-10 Thread Giovanni Bajo
On 09/07/2007 21.23, Walter Dörwald wrote:

   from ll.xist import parsers, xfind
   from ll.xist.ns import html
   e = parsers.parseURL(http://www.python.org;, tidy=True)
   print e.walknode(html.h2  xfind.hasclass(news))[-1]
 Google Adds Python Support to Google Calendar Developer's Guide
 
 
 Get the first comment line from a python file:
 
   getitem((line for line in open(Lib/codecs.py) if 
 line.startswith(#)), 0)
 '### Registry and builtin stateless codec functions\n'
 
 
 Create a new unused identifier:
 
   def candidates(base):
 ... yield base
 ... for suffix in count(2):
 ... yield %s%d % (base, suffix)
 ...
   usedids = set((foo, bar))
   getitem((i for i in candidates(foo) if i not in usedids), 0)
 'foo2'

You keep posting examples where you call your getitem() function with 0 as 
index, or -1.

getitem(it, 0) already exists and it's spelled it.next(). getitem(it, -1) 
might be useful in fact, and it might be spelled last(it) (or it.last()). Then 
one may want to add first() for simmetry, but that's it:

first(i for i in candidates(foo) if i not in usedids)
last(line for line in open(Lib/codecs.py) if line[0] == '#')

Are there real-world use cases for getitem(it, n) with n not in (0, -1)? I 
share Raymond's feelings on this. And by the way, if you wonder, I have these 
exact feelings as well for islice... :)
-- 
Giovanni Bajo


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need help fixing failing Py3k Unittests in py3k-struni

2007-07-10 Thread Christian Heimes
Steven Bethard wrote:
 I'd probably go with something a little more restrictive, maybe:
 
 r'self.assert_\(\S+ == \S+\)'
 
 Something like that ought to have fewer false positives.

Woops! You are right. Even your pattern has caused some false positives
but I've reread the patch and removed the offending lines. I'm going to
upload another patch as soon as I have verified mine again.

Christian

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com