Re: suggestions, comments on an is_subdict test

2011-04-23 Thread Raymond Hettinger
On Apr 22, 8:18 am, MRAB pyt...@mrabarnett.plus.com wrote: On 22/04/2011 15:57, Irmen de Jong wrote: On 22-4-2011 15:55, Vlastimil Brom wrote: Hi all, I'd like to ask for comments or advice on a simple code for testing a subdict, i.e. check whether all items of a given dictionary

Re: suggestions, comments on an is_subdict test

2011-04-23 Thread Paul Rubin
Irmen de Jong irmen.nos...@xs4all.nl writes: I would use: test_dct.items() = base_dct.items() I think you need an explicit cast: set(test_dct.items()) = set(base_dct.items()) -- http://mail.python.org/mailman/listinfo/python-list

When is PEP necessary?

2011-04-23 Thread Disc Magnet
Is PEP necessary to add a new package to the standard library? What if the community just wants to add a new module to an existing package? What if only a new function has to be added to a module in the standard library? What if only a line or two are to be added to a function in the standard

Re: Vectors

2011-04-23 Thread Algis Kabaila
On Saturday 23 April 2011 14:13:31 sturlamolden wrote: On Apr 23, 2:32 am, Algis Kabaila akaba...@pcug.org.au wrote: Thanks for that. Last time I looked at numpy (for Python3) it was available in source only. I know, real men do compile, but I am an old man... I will compile if it is

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread flebber
On Apr 23, 4:28 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Fri, 22 Apr 2011 17:08:53 +1000, Chris Angelico ros...@gmail.com declaimed the following in gmane.comp.python.general: I'm not so sure that all strings should autopromote to integer (or numeric generally). However, adding

Re: When is PEP necessary?

2011-04-23 Thread Steven D'Aprano
On Sat, 23 Apr 2011 17:46:26 +0530, Disc Magnet wrote: Is PEP necessary to add a new package to the standard library? See http://www.python.org/dev/peps/pep-0001/ What if the community just wants to add a new module to an existing package? Just? Adding a new module is a big step. How do

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Wed, Apr 20, 2011 at 20:15, Ron ron.rei...@gmail.com wrote: Hey everyone. I've written an online interactive Python tutorial atop Google App Engine: http://www.learnpython.org. All you need to do is log in using your Google account and edit the wiki to add your tutorials. Read more

Re: Vectors

2011-04-23 Thread sturlamolden
On Apr 23, 2:26 pm, Algis Kabaila akaba...@pcug.org.au wrote: I do understand that many people prefer Win32 and appreciate their right to use what they want.  I just am at a loss to understand *why* ... For the same reason some people prefered OS/2 or DEC to SunOS or BSD. For the same reason

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 23, 1:28 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: But what if /I/ want                 A + 1 to return                 B No problem! Python even allows you to create your own functions! I know, amazing! 8-O def succ(s): return chr(ord(s) + 1) succ('a') 'b'

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 22, 1:38 am, harrismh777 harrismh...@charter.net wrote: Strings should auto-type-promote to numbers if appropriate. No they should not! We do not want a language to guess our intentions. We are big boys and girls and should be responsible for own actions. This behavior should occur in

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Fri, Apr 22, 2011 at 09:38, harrismh777 harrismh...@charter.net wrote: If an operation like (+) is used to add  1 + '1' then the string should be converted to int and the addition should take place, returning a reference to object int (2). No, the int 1 should be cast to a string, and the

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Tim Chase
On 04/23/2011 11:51 AM, Dotan Cohen wrote: harrismh777harrismh...@charter.net wrote: If an operation like (+) is used to add 1 + '1' then the string should be converted to int and the addition should take place, returning a reference to object int (2). No, the int 1 should be cast to a

detecting newline character

2011-04-23 Thread Daniel Geržo
Hello guys, I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self): with contextlib.closing(codecs.open(self.path, rU)) as fobj: fobj.readlines() if isinstance(fobj.newlines, tuple):

Re: detecting newline character

2011-04-23 Thread Chris Rebert
On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo dan...@rulez.sk wrote: Hello guys, I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self):    with contextlib.closing(codecs.open(self.path, rU)) as fobj:    

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self): with contextlib.closing(codecs.open(self.path, rU)) as fobj: fobj.readlines() if

Re: Input() in Python3

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 10:08:20AM -0400, Mel wrote: Westley Martínez wrote: On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: U NO. NO NO NO. What if someone enters os.exit() as their number? You shouldn't eval() unchecked user input! Chris Angelico Right,

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Chris Rebert wrote: On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo dan...@rulez.sk wrote: I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self): with contextlib.closing(codecs.open(self.path, rU)) as

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 04:48:39PM -0700, Dan Stromberg wrote: On Thu, Apr 21, 2011 at 11:38 PM, harrismh777 harrismh...@charter.netwrote: Yes. And you have managed to point out a serious flaw in the overall logic and consistency of Python, IMHO. Strings should auto-type-promote to

Re: detecting newline character

2011-04-23 Thread Daniel Geržo
On 23.4.2011 21:33, Thomas 'PointedEars' Lahn wrote: Chris Rebert wrote: On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržodan...@rulez.sk wrote: I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self):

Re: A question about Python Classes

2011-04-23 Thread chad
On Apr 22, 12:47 pm, Carl Banks pavlovevide...@gmail.com wrote: On Thursday, April 21, 2011 11:00:08 AM UTC-7, MRAB wrote: On 21/04/2011 18:12, Pascal J. Bourguignon wrote: chadcda...@gmail.com  writes: Let's say I have the following class BaseHandler:      def foo(self):  

Re: When is PEP necessary?

2011-04-23 Thread Martin v. Loewis
Am 23.04.2011 14:16, schrieb Disc Magnet: Is PEP necessary to add a new package to the standard library? A PEP is necessary if the proposed change is contentious. If there is widespread agreement that the change is desirable, no PEP is needed. What if the community just wants to add a new

Re: When is PEP necessary?

2011-04-23 Thread Daniel Kluev
On Sat, Apr 23, 2011 at 11:16 PM, Disc Magnet discmag...@gmail.com wrote: Is PEP necessary to add a new package to the standard library? *skip* Don't forget that Python is not limited to CPython. Other implementations need these PEPs to provide compliant packages. While its not that important

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: Thomas 'PointedEars' Lahn wrote: Chris Rebert wrote: Daniel Geržo wrote: [f.newlines is None after f.readlines() when f = codecs.open(…, mode='rU', encoding='ascii'), but not when f = codecs.open(…, mode='rU')] […] I would speculate that the upshot of this is that

Re: A question about Python Classes

2011-04-23 Thread Steven D'Aprano
On Sat, 23 Apr 2011 13:30:02 -0700, chad wrote: On Apr 22, 12:47 pm, Carl Banks pavlovevide...@gmail.com wrote: On Thursday, April 21, 2011 11:00:08 AM UTC-7, MRAB wrote: On 21/04/2011 18:12, Pascal J. Bourguignon wrote: chadcda...@gmail.com  writes: Let's say I have the following

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Chris Angelico wrote: Wow, someone else who knows REXX and OS/2! REXX was the first bignum language I met, and it was really cool after working in BASIC and 80x86 assembly to suddenly be able to work with arbitrary-precision numbers! Yes, my big num research stuff was initially done in REXX,

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Steven D'Aprano
On Fri, 22 Apr 2011 01:38:21 -0500, harrismh777 wrote: Heiko Wundram wrote: The difference between strong typing and weak typing is best described by: Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] on cygwin Type help, copyright, credits or license for

Re: Input() in Python3

2011-04-23 Thread harrismh777
Chris Rebert wrote: Well, it pretty much*was* totally removed; it was prone to misuse and had very few legitimate uses. It's just that raw_input() also got renamed simultaneously. What were you using it for? There are often much better alternatives. For the purpose pretty much described in

Re: When is PEP necessary?

2011-04-23 Thread Jean-Paul Calderone
On Apr 23, 5:09 pm, Daniel Kluev dan.kl...@gmail.com wrote: On Sat, Apr 23, 2011 at 11:16 PM, Disc Magnet discmag...@gmail.com wrote: Is PEP necessary to add a new package to the standard library? *skip* Don't forget that Python is not limited to CPython. Other implementations need these

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Chris Angelico
On Sun, Apr 24, 2011 at 10:42 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: This is much like my experience with Apple's Hypertalk, where the only data structure is a string. I'm very fond of Hypertalk, but it is hardly designed with machine efficiency in mind. If you think

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Cameron Simpson
On 23Apr2011 19:37, harrismh777 harrismh...@charter.net wrote: [...] | Yes, my big num research stuff was initially done in REXX, on | VM/CMS. I later ported my libraries over to OS/2 and continued with | that well into the '90s, when I discovered Unix and 'bc'. Many | folks are not aware that

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Cameron Simpson wrote: | folks are not aware that 'bc' also has arbitrary precision floating | point math and a standard math library. Floating point math? I thought, historically at least, that bc is built on dc (arbitrary precision integer math, reverse polish syntax) and that consequently bc

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Steven D'Aprano wrote: If that's a serious flaw, it's a flaw shared by the vast majority of programming languages. Yes, agreed. As for the question of consistency, I would argue the opposite: that auto-promoting strings to numbers arguably is useful, but that is what is inconsistent, not

Re: Closing generators

2011-04-23 Thread Thomas Rachel
Am 23.04.2011 04:15, schrieb Terry Reedy: .close() methods that release operating system resources are needed *because* there is no guarantee of immediate garbage collection. They were not needed when CPython was the only Python. The with statement was added partly to make it easier to make

Question about compiling python 30 from subversion repository on OSX

2011-04-23 Thread Anthony Kong
Hi, all, I have checked out source code from this url http://svn.python.org/projects/python/branches/py3k, then run ./configure --with-universal-archs=64-bit make First of all, I got this message: --- Modules/Setup.dist is newer than Modules/Setup;

[issue10932] distutils.core.setup - data_files misbehaviour ?

2011-04-23 Thread Prashant Kumar
Prashant Kumar contactprashan...@gmail.com added the comment: Certainly, a test is needed to check that ('config', ['cfg/data.cfg']) would create a file in config/data.cfg and not config/cfg/data.cfg. Though, I've added a patch 'test_command_sdist.diff' for the changes made in 'patch.diff'.

[issue11911] Interlink Python versions docs

2011-04-23 Thread anatoly techtonik
New submission from anatoly techtonik techto...@gmail.com: I want to be able to jump from latest Python 2 docs to the same page in stable Python 3 doc in one click. E.g. from http://docs.python.org/library/string.html to http://docs.python.org/py3k/library/strings.html -- assignee:

[issue11911] Interlink Python versions docs

2011-04-23 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: sorry, to http://docs.python.org/py3k/library/string.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11911 ___

[issue11907] SysLogHandler can't send long messages

2011-04-23 Thread Vinay Sajip
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- assignee: - vinay.sajip nosy: +vinay.sajip versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11907 ___

[issue11907] SysLogHandler can't send long messages

2011-04-23 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: The entire part of emit() which sends to the socket is wrapped in an except: which should catch all except KeyboardInterrupt and SystemExit. The except clause calls the handleError method of the handler. See

[issue11899] TarFile.gettarinfo modifies self.inodes

2011-04-23 Thread Michael Gold
Michael Gold mg...@ncf.ca added the comment: No, I don't have a working implementation. (I basically reimplemented TarFile.inodes to work around this; I was using TarFile.dereference, so I already had to do the hard-linking manually.) -- nosy: +mgold

[issue11911] Interlink Python versions docs

2011-04-23 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: This is a duplicated of #8040. -- nosy: +ezio.melotti resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - It would be nice if documentation pages linked to other versions of the same document

[issue11879] TarFile.chown: should use TarInfo.uid if user lookup fails

2011-04-23 Thread Michael Gold
Michael Gold mg...@ncf.ca added the comment: The tests passed on Linux (with Python 3.2 under fakeroot): Ran 240 tests in 9.613s OK But I don't see any tests that check the uid/gid of extracted files. -- nosy: +mgold ___ Python tracker

[issue11889] 'enumerate' 'start' parameter documentation is confusing

2011-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: +1 to what David says. Terry’s patch is a good starting point; I think Raymond will commit something along its lines. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org

[issue11884] Argparse calls ngettext but doesn't import it

2011-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Confirmed. It’s a Debian-specific problem, please use “reportbug python3.2” to report it to them. -- nosy: +doko resolution: - invalid stage: - committed/rejected status: open - closed ___ Python

[issue11382] some posix module functions unnecessarily release the GIL

2011-04-23 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset eb7297fd5840 by Antoine Pitrou in branch 'default': Issue #11382: Trivial system calls, such as dup() or pipe(), needn't http://hg.python.org/cpython/rev/eb7297fd5840 -- nosy: +python-dev

[issue11382] some posix module functions unnecessarily release the GIL

2011-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Sorry for the delay, I had forgotten about this issue. Thank you for the patch! -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue444582] Finding programs in PATH, adding shutil.which

2011-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Can someone remove obsolete files from the file list and post an up-to-date patch? -- keywords: -easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue444582

[issue482531] python directory not added to PATH

2011-04-23 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- superseder: - Windows installer should add Python and Scripts directories to the PATH environment variable ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue482531

[issue9325] Add an option to pdb/trace/profile to run library module as a script

2011-04-23 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9325 ___

[issue10154] locale.normalize strips - from UTF-8, which fails on Mac

2011-04-23 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- stage: - needs patch title: locale.normalize strips - from UTF-8, which fails on Mac - locale.normalize strips - from UTF-8, which fails on Mac versions: +Python 3.3 -Python 2.5, Python 2.6 ___ Python

[issue9228] Make changes in the PATH and PATHEXT on installation

2011-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: This is rejected every few months by Martin. -- nosy: +eric.araujo resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Windows installer should add Python and Scripts directories to the PATH

[issue11340] test_distutils fails because of borked compress program

2011-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Okay. It’s not a very beautiful check, but it will do. Do you want to make a patch to disable compress if it’s a fake compress program? -- ___ Python tracker rep...@bugs.python.org

[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-04-23 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 19d9f0a177de by Antoine Pitrou in branch 'default': Issue #11258: Speed up ctypes.util.find_library() under Linux by a factor http://hg.python.org/cpython/rev/19d9f0a177de -- nosy: +python-dev

[issue11258] ctypes: Speed up find_library() on Linux by 500%

2011-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I committed a modified patch. Hopefully the buildbots won't break this time :) -- resolution: - fixed stage: patch review - committed/rejected status: open - pending ___ Python tracker

[issue11889] 'enumerate' 'start' parameter documentation is confusing

2011-04-23 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: I've got it from here. Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11889 ___

[issue11907] SysLogHandler can't send long messages

2011-04-23 Thread Lukáš Lalinský
Lukáš Lalinský lalin...@gmail.com added the comment: It seems that I was wrong, the exception is indeed not propagated to the application, but handled by the handleError() method. I was confused by seeing the traceback in my uWSGI log file. I'm unable to find a way to determine the maximum

[issue11907] SysLogHandler can't send long messages

2011-04-23 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I've managed to get access to a FreeBSD system and done some investigation. The system is working as designed, and the error message is being printed by the handleError() method of the handler. To handle the exception differently, you

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Nils Breunese
New submission from Nils Breunese n...@breun.nl: When I try to run iotop [0] on CentOS 5.6 on a kernel with grsecurity [1] then iotop won't start because grsecurity is blocking Python because of its use of the mprotect() system call. Please see

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Where have you seen that Python is calling mprotect()? There's no sign of it in the whole source tree. -- nosy: +neologix, pitrou ___ Python tracker rep...@bugs.python.org

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Nils Breunese
Nils Breunese n...@breun.nl added the comment: I got this error message in /var/log/messages when trying to start iotop: Apr 13 08:49:37 hostname kernel: grsec: From xxx.xxx.xxx.xxx: denied RWX mprotect of /lib64/ld-2.5.so by /usr/bin/iotop[iotop:9836] uid/euid:0/0 gid/egid:0/0, parent

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: /usr/bin/iotop is a Python script and according to that log message grsecurity detected a call to mprotect(). Well, does Python itself run ok? That Python script could use third-party extension modules which issue the offending mprotect() call.

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Nils Breunese
Nils Breunese n...@breun.nl added the comment: I haven't had any problems with other Python applications like this, Python seems fine otherwise. I just noticed that iotop has a dependency on python-ctypes, which sounds like it could be iotop doing the mprotect() calls via ctypes. Does that

[issue4608] urllib.request.urlopen does not return an iterable object

2011-04-23 Thread Rafael Zanella
Rafael Zanella rafael.zane...@yahoo.com.br added the comment: The patch that makes addinfourl() iterable was not commited due to the change to HTTP request see: msg86365 (http://bugs.python.org/issue4608#msg86365). Since urllib is protocol agnostic it should behave the same with FTP, right?

[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Andreas Stührk
Andreas Stührk andy-pyt...@hammerhartes.de added the comment: glibc's `dlopen()` can call `mprotect()`, which is used for loading C extensions. -- nosy: +Trundle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11912

[issue6780] startswith error message is incomplete

2011-04-23 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Attached an updated patch for 2.7 with tests that check that UnicodeErrors are still raised and that the error message mentions 'str', 'unicode' and 'tuple'. -- Added file: http://bugs.python.org/file21762/issue6780-2.diff

[issue11913] sdist should allow for README.rst

2011-04-23 Thread Ingy dot Net
New submission from Ingy dot Net i...@ingy.net: When I upload modules to PyPI, distutils is clucking about a missing README, even though PyPI accepts README.rst, and I am providing that. Registering pyplay to http://pypi.python.org/pypi Server response (200): OK python setup.py sdist upload

[issue11914] pydoc modules/help('modules') crash in dirs with unreadable subdirs

2011-04-23 Thread Ben Okopnik
New submission from Ben Okopnik b...@okopnik.com: Long-standing problem (happens in every Python version I've tested). The usual situation is when invoking Python (and then help('modules')) or pydoc modules in /tmp, but also happens when located anywhere with unreadable subdirs:

[issue9269] Cannot pickle self-referencing sets

2011-04-23 Thread Alex Gaynor
Changes by Alex Gaynor alex.gay...@gmail.com: -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9269 ___ ___ Python-bugs-list mailing

[issue11907] SysLogHandler can't send long messages

2011-04-23 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I'll write a LocalSysLogHandler for me that uses the syslog module. Sure, but bear in mind that on some Linux systems at least, the syslog module has thread safety issues because the underlying C APIs are not thread-safe. (I'm not sure