property confusion

2014-02-21 Thread K Richard Pixley
Could someone please explain to me why the two values at the bottom of this example are different? Python-3.3 if it makes any difference. Is this a difference in evaluation between a class attribute and an instance attribute? --rich class C: def __init__(self): self._x = None

[issue18744] pathological performance using tarfile

2013-08-16 Thread K Richard Pixley
K Richard Pixley added the comment: I see your point. The alternative would be to limit the size of archive that can be extracted from to the size of virtual memory, which is essentially what I'm doing manually. Either way, someone will be surprised. I'm not which which way will result

[issue18744] pathological performance using tarfile

2013-08-15 Thread K Richard Pixley
K Richard Pixley added the comment: New info... I see the degradation on most of the linux boxes I've tried: * ubuntu-13.04, (raring), 64-bit * rhel-5.4 64-bit * rhel-5.7 64-bit * suse-11 64-bit I see some degradation on MacOsX-10.8.4 but it's in the acceptable range, more like 2x than 60x

[issue18744] pathological performance using tarfile

2013-08-15 Thread K Richard Pixley
K Richard Pixley added the comment: Here's a script that tests for the problem. -- Added file: http://bugs.python.org/file31303/tarproblem.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18744

[issue18744] pathological performance using tarfile

2013-08-14 Thread K Richard Pixley
New submission from K Richard Pixley: There's a problem with tarfile. Write a program to traverse the contents of a modest sized tar archive. Make sure your tar archive is compressed. Then read the tar archive with your program. I'm finding that allowing tarfile to read a compressed

[issue13590] extension module builds fail with python.org OS X installers on OS X 10.7 and 10.6 with Xcode 4.2

2012-02-08 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: I think a better solution that declaring it to be apple's bug would be to release one binary for pre-10.7, (or maybe 10.6 with the current xcode), and a different binary for post-10.7. This isn't an apple bug in the sense that there's anything

Re: Is a with on open always necessary?

2012-01-25 Thread K Richard Pixley
On 1/20/12 07:44 , Andrea Crotti wrote: I normally didn't bother too much when reading from files, and for example I always did a content = open(filename).readlines() But now I have the doubt that it's not a good idea, does the file handler stays open until the interpreter quits? So maybe

Re: Is a with on open always necessary?

2012-01-25 Thread K Richard Pixley
On 1/21/12 03:38 , Lie Ryan wrote: It is only strictly necessary for programs that opens thousands of files in a short while, since the operating system may limit of the number of active file handlers you can have. The number you're looking for is 20 on many unix systems. That's all. 20

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread K Richard Pixley
On 1/23/12 21:57 , Rick Johnson wrote: Here is a grep from the month of September 2011 showing the rampantly egregious misuse of the following words and phrases: * pretty * hard * right * used to * supposed to Pretty is the most ludicrous of them all! As you will see, pretty is used

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread K. Richard Pixley
On 1/25/12 12:14 , Rick Johnson wrote: You don't even need pretty to get your point across. If that's your argument, then we can drop the verb to be, most articles, most verb conjugations, and nearly all adjectives and adverbs. For that matter, the vast majority of posts here can be dropped

Re: Two questions about logging

2012-01-12 Thread K Richard Pixley
On 1/11/12 18:19 , Matthew Pounsett wrote: Second, I'm trying to get a handle on how libraries are meant to integrate with the applications that use them. The naming advice in the advanced tutorial is to use __name__ to name loggers, and to allow log messages to pass back up to the using

Re: stable object serialization to text file

2012-01-12 Thread K Richard Pixley
On 1/11/12 12:16 , Máté Koch wrote: Hello All, I'm developing an app which stores the data in file system database. The data in my case consists of large python objects, mostly dicts, containing texts and numbers. The easiest way to dump and load them would be pickle, but I have a problem

Re: codecs in a chroot / without fs access

2012-01-10 Thread K Richard Pixley
On 1/9/12 16:41 , Philipp Hagemeister wrote: I want to forbid my application to access the filesystem. The easiest way seems to be chrooting and droping privileges. However, surprisingly, python loads the codecs from the filesystem on-demand, which makes my program crash: import os os.getuid()

[issue13749] socketserver can't stop

2012-01-09 Thread K Richard Pixley
New submission from K Richard Pixley r...@noir.com: Once I've instantiated my server class, along with a handler class, called server.serve_forever(), handler.handle() has been called, I've done my work, and I'm ready to shut the whole thing down... How do I do that? The doc says

[issue13749] socketserver can't stop

2012-01-09 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: It appears as though the problem is that shutdown() blocks waiting for the serve_forever loop to terminate, which won't happen as long as the process is blocked on shutdown. I'd like to propose that the library be changed to eliminate

[issue13749] socketserver can't stop

2012-01-09 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: On second thought, my proposal is likely to break existing code, so I withdraw it. I don't know how to exit the server in a way that both works in all conditions and also continues to support existing semantics. I expect we'll need to create

Re: help me get excited about python 3

2012-01-05 Thread K Richard Pixley
You get some of the good stuff by importing future, unicode literals which essentially means you're working in unicode by default most of the time, and print function, (a small fix but long overdue). I try to write python3 whenever I can. It's rare that dependencies keep me back. More often

socketserver question

2012-01-05 Thread K Richard Pixley
Once I've instantiated my server class, along with a handler class, called server.serve_forever(), handler.handle() has been called, I've done my work, and I'm ready to shut the whole thing down... How do I do that? The doc says server.shutdown(), but if I call self.server.shutdown() from

Re: readline for mac python? (really, reproducing mac python packages)

2012-01-02 Thread K Richard Pixley
On 1/1/12 19:04 , K Richard Pixley wrote: On 1/1/12 16:49 , K Richard Pixley wrote: I'm having trouble finding a reasonable python environment on mac. The supplied binaries, (2.7.2, 3.2.2), are built with old versions of macosx and are not capable of building any third party packages

Python3 on MacOsX Lion?

2012-01-02 Thread K Richard Pixley
Where would I look to find the current expected status of python3 on MacOsX Lion? The distributed binaries aren't capable of allowing extensions that use gcc. I can build the source naked, but then it lacks some libraries, notably, readline. Attempting to build the full Mac packages fails,

Re: Python3 on MacOsX Lion?

2012-01-02 Thread K Richard Pixley
On 1/2/12 13:03 , Benjamin Kaplan wrote: On Mon, Jan 2, 2012 at 2:32 PM, K Richard Pixleyr...@noir.com wrote: Where would I look to find the current expected status of python3 on MacOsX Lion? The distributed binaries aren't capable of allowing extensions that use gcc. I can build the source

readline for mac python? (really, reproducing mac python packages)

2012-01-01 Thread K Richard Pixley
I'm having trouble finding a reasonable python environment on mac. The supplied binaries, (2.7.2, 3.2.2), are built with old versions of macosx and are not capable of building any third party packages that require gcc. The source builds easily enough out of the box, (./configure

Re: readline for mac python? (really, reproducing mac python packages)

2012-01-01 Thread K Richard Pixley
On 1/1/12 16:49 , K Richard Pixley wrote: I'm having trouble finding a reasonable python environment on mac. The supplied binaries, (2.7.2, 3.2.2), are built with old versions of macosx and are not capable of building any third party packages that require gcc. The source builds easily enough

Re: Which library for audio playback ?

2011-12-30 Thread K Richard Pixley
On 12/29/11 05:55 , Jérôme wrote: I'm writing a small application that plays sound through the speakers. The sounds are juste sine waves of arbitrary frequency I create in the code, not sample .wav files. I didn't expect the choice for an audio library to be that complicated. There are several

Re: Generating sin/square waves sound

2011-12-30 Thread K Richard Pixley
On 12/29/11 23:17 , Paulo da Silva wrote: Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in python? Thanks for any answers/suggestions. I just

Re: confused about __new__

2011-12-27 Thread K Richard Pixley
On 12/26/11 21:48 , Fredrik Tolf wrote: On Mon, 26 Dec 2011, K. Richard Pixley wrote: I don't understand. Can anyone explain? I'm also a bit confused about __new__. I'd very much appreciate it if someone could explain the following aspects of it: * The manual (http://docs.python.org

Re: Python education survey

2011-12-27 Thread K Richard Pixley
On 12/19/11 19:51 , Raymond Hettinger wrote: Do you use IDLE when teaching Python? If not, what is the tool of choice? If your goal is to quickly get new users up and running in Python, what IDE or editor do you recommend? I would: a) let the students pick their own editor. b) encourage

Re: confused about __new__

2011-12-27 Thread K Richard Pixley
On 12/27/11 10:28 , Ian Kelly wrote: On Tue, Dec 27, 2011 at 10:41 AM, K Richard Pixleyr...@noir.com wrote: The conceptual leap for me was in recognizing that a class is just an object. The best way, (imo, so far), to create a singleton in python is to use the class itself as the singleton

Re: Python education survey

2011-12-27 Thread K Richard Pixley
On 12/27/11 10:21 , Rick Johnson wrote: On Dec 27, 11:59 am, K Richard Pixleyr...@noir.com wrote: The problem is that IDLE is hard to set up. (I've never managed it and I'm a well seasoned veteran). Can you qualify that statement? Do you mean difficult to set up on certain OS's? Because

Re: Python education survey

2011-12-27 Thread K Richard Pixley
On 12/27/11 10:26 , Andrew Berg wrote: On 12/27/2011 11:59 AM, K Richard Pixley wrote: You'd do better to encourage eclipse, but setting that up isn't trivial either. IIRC, all I had to do to set up PyDev was copy a URL to Eclipse's Install New Software wizard, and have Eclipse download

Re: confused about __new__

2011-12-27 Thread K Richard Pixley
On 12/27/11 12:34 , Ian Kelly wrote: On Tue, Dec 27, 2011 at 1:31 PM, K Richard Pixleyr...@noir.com wrote: On 12/27/11 10:28 , Ian Kelly wrote: On Tue, Dec 27, 2011 at 10:41 AM, K Richard Pixleyr...@noir.comwrote: The conceptual leap for me was in recognizing that a class is just an

confused about __new__

2011-12-26 Thread K. Richard Pixley
I'm confused about the following. The idea here is that the set of instances of some class are small and finite, so I'd like to create them at class creation time, then hijack __new__ to simply return one of the preexisting classes instead of creating a new one each call. This seems to work

Re: confused about __new__

2011-12-26 Thread K Richard Pixley
On 12/26/11 20:53 , Steven D'Aprano wrote: On Mon, 26 Dec 2011 20:28:26 -0800, K. Richard Pixley wrote: I'm confused about the following. The idea here is that the set of instances of some class are small and finite, so I'd like to create them at class creation time, then hijack __new__

[issue13590] Prebuilt python-2.7.2 binaries for macosx can not compile c extensions

2011-12-12 Thread K Richard Pixley
New submission from K Richard Pixley r...@noir.com: Install the Python-2.7.2 mac installer for Lion on Lion. Then attempt easy_install -U psutil. I get: za-dc-dev/bin/easy_install -U psutil install_dir /Users/rich/projects/za-packages/za-dependency-checker/za-dc-dev/lib/python2.7/site

[issue11203] gzip doc is behind

2011-06-07 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: My point was for python-2.7. I haven't stumbled into the buffer protocol yet. So no, it doesn't really. I still think the documentation, especially the 2.7 doc, could be more explicit. My concern here is with the use of close() becoming

[issue11203] gzip doc is behind

2011-06-07 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: An interesting point, although I think that's only relevant if the documentation lists the ABC and a reference to it. (python-3 doc essentially does this.) I see no such reference in the 2.7 gzipfile doc, which leads me to believe, (from

[issue11203] gzip doc is behind

2011-06-07 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: I didn't miss it. I think the close call needs equal treatment to the open call. The mention is certainly present, but seems implicit to me. I would prefer to see it listed explicitly. But I also don't think it's important enough in the 2.7

[issue11203] gzip doc is behind

2011-06-07 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: I'm now convinced this isn't worth fixing in 2.x. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11203

[issue12021] mmap.read requires an argument

2011-05-06 Thread K Richard Pixley
New submission from K Richard Pixley r...@noir.com: mmap.read requires a argument. Since most file-like objects do not, this breaks the file-like object illusion. mmap.read argument should be optional, presumably defaulting to the entire mmap'd area. -- messages: 135362 nosy: rich

[issue3860] GzipFile and BZ2File should support context manager protocol

2011-02-12 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: Documentation needs to be updated to state that these are now context managers. This is important since they aren't in python-2.x. I'm not sure whether this should be added to the new in python blurbs. -- nosy: +teamnoir

[issue11203] gzip doc is behind

2011-02-12 Thread K Richard Pixley
New submission from K Richard Pixley r...@noir.com: The documentation for gzip should include the close method. It's use in the 2.7 documentation implies it's existence but it should also be stated explicitly that it exists. In the 3.x documentation, the use of close not in the examples since

ANN: elffile-0.001

2011-01-04 Thread K. Richard Pixley
Announcing the first release of elffile! Elffile is a pure python implementation of a library which reads and writes ELF format object files Current features: * Elffile is pure python so installation is easy. * Elffile has been tested on python versions 2.[67] and 3.[012]. * Reads both 32

@property; @classmethod; def f()

2011-01-01 Thread K. Richard Pixley
Can anyone explain to me why this doesn't work? class Foo(object): @property @classmethod def f(cls): return 4 I mean, I think it seems to be syntactically clear what I'm trying to accomplish. What am I missing? --rich --

ANN: Coding class v0.001

2010-12-29 Thread K. Richard Pixley
Announcing the first release of my Coding class. This is a simple utility class that answers the question of how to implement enums in python. I know there have been many other answers as well, many of them quite fine, but this is the answer that I've been wanting so I'm sharing it.

[issue4489] shutil.rmtree is vulnerable to a symlink attack

2010-12-21 Thread K Richard Pixley
K Richard Pixley r...@noir.com added the comment: How does rm -rf address this issue? Or does it? shutils.rmtree should probably do the same thing. -- nosy: +teamnoir ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4489

emacs, pdb, python3, ubuntu

2009-11-30 Thread K. Richard Pixley
Does anyone have this combination working? And if so, which version of ubuntu and what did you have to do to get it to work? --rich -- http://mail.python.org/mailman/listinfo/python-list