EPD (Enthought Python Distribution) 4.0.300 Beta 3 available

2008-09-27 Thread Dave Peterson
Hello, We've recently posted the third beta release of EPD (the Enthought Python Distribution) with Python 2.5 version 4.0.300. You may download the beta from here: http://www.enthought.com/products/epdbeta.php Please help us test it out and provide feedback on the EPD Trac instance:

ANN: TakeNote 0.4.2 - Note taking and organization

2008-09-27 Thread rasmus
TakeNote 0.4.2 - Note taking and organization In this release: * faster loading * bullet point lists * more customization * bug fixes TakeNote is a simple cross-platform note taking program implemented in Python. I have been using it for my research and class notes, but it should be

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread r0g
process wrote: ' '.join([`x * x` for x in range(1, 6)]) exactly what does this symbol do and what does it stand for? Which symbol, the '*' ??? Are you kidding? -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread r0g
process wrote: ' '.join([`x * x` for x in range(1, 6)]) exactly what does this symbol do and what does it stand for? Ah, just spotted the backticks - they just return whatever's inside them as a string. -- http://mail.python.org/mailman/listinfo/python-list

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-27 Thread r0g
Diez B. Roggisch wrote: that is a very valid point, but it seemed that Scott has homogeneous environment: Debian/Ubuntu so my post was relative to the original request. I agree that when you throw Windows/MacOS into the mix things become interesting. But then it's better when your developers

Re: How to get the filename in the right case ?

2008-09-27 Thread r0g
Steven D'Aprano wrote: On Fri, 26 Sep 2008 01:46:15 +0200, Stef Mientki wrote: Secondly thoughtless copying of current behavior, doesn't bring any progress, and I think that's one of the reasons why we're still burdened by inventions done 20 years ago, e.g. do you want to save your changes

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Steven D'Aprano
On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: In article [EMAIL PROTECTED], Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 25 Sep 2008 21:17:14 -0700, Aahz wrote: Seems to me that if all the module is used for is to store state, you're wasting a file on disk. I personally prefer to use

Re: how to search multiple textfiles ? (Python is slow ?)

2008-09-27 Thread M�ta-MCI (MVP)
Hi ! Thanks for return. Some infos: from a long time, I found that it's often more fast to use windows's command, instead of develop in high level language (and also, low level...) FINDSTR is fast. OK. But internal commands are more fast. Example : DIR (with all his options) And it's

Negative block sizes with file-like objects

2008-09-27 Thread Steven D'Aprano
I have a proxy class that wraps an arbitrary file-like object fp and reads blocks of data from it. Is it safe to assume that fp.read(-1) will read until EOF? I know that's true for file.read() and StringIO.read(), but is it a reasonable assumption to make for arbitrary file-like objects? To

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Bob Cortopassi
On 2008-09-26, nntpman68 [EMAIL PROTECTED] wrote: - I'm annoyed by any spam. It's tough to find good rules, but the incoming spams that I see currently on comp.lang.python have certain criteas. - most email addresses from gmail. ...snip rest of good filter criteria... Killing all messages

Re: Negative block sizes with file-like objects

2008-09-27 Thread Peter Otten
Steven D'Aprano wrote: I have a proxy class that wraps an arbitrary file-like object fp and reads blocks of data from it. Is it safe to assume that fp.read(-1) will read until EOF? I know that's true for file.read() and StringIO.read(), but is it a reasonable assumption to make for arbitrary

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Dotan Cohen
2008/9/26 nntpman68 [EMAIL PROTECTED]: It's tough to find good rules, but the incoming spams that I see currently on comp.lang.python have certain criteas. - most email addresses from gmail. - all never posted before and then they have multiple posts within a few minutes / seconds - the

python for *nix system admins

2008-09-27 Thread Lars Stavholm
Hi All, I'm new to this list and hoping that this is not off-topic. If it is, please point me in the right direction. I seem to recollect a python module or library for *nix sysadmins, but I can't for the life of me find it again. The module (or library) somehow added unix command capabilities

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Ben Finney
Steven D'Aprano [EMAIL PROTECTED] writes: On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: An ordinary singleton is instantiating the class multiple times yet returning the same instance object; a class singleton is simply using the class directly (like a module). Where is this class

Re: python for *nix system admins

2008-09-27 Thread km
import os HTH KM ~~ On Sat, Sep 27, 2008 at 1:35 PM, Lars Stavholm [EMAIL PROTECTED] wrote: Hi All, I'm new to this list and hoping that this is not off-topic. If it is, please point me in the right direction. I seem to recollect a python module or library for *nix sysadmins,

Re: Running IDLE on 3.0rc1

2008-09-27 Thread Terry Reedy
Allan wrote: Terry Reedy [EMAIL PROTECTED] writes: I have not seen this posted, so... To run IDLE with Python3.0rc1, edit Python30/Libs/idlelib/run.py, and change set_daemon(True) to daemon = True and save. (This is about line 75, and the only appearance of 'daemon'.) Otherwise, you get error

Re: python for *nix system admins

2008-09-27 Thread Lars Stavholm
km wrote: import os Thanks, but I'm aware of the standard libraries like os, sys, commands, and whatnot. I'm looking for a non-standard library that acts like a wrapper for the unix commands. I have seen it, I just can't find it again. /L On Sat, Sep 27, 2008 at 1:35 PM, Lars Stavholm [EMAIL

Using the 'with' statement with cStringIO objects

2008-09-27 Thread peppergrower
I've been experimenting with the 'with' statement (in __future__), and so far I like it. However, I can't get it to work with a cStringIO object. Here's a minimum working example: ### from __future__ import with_statement import cStringIO teststring='this is a test' with

Re: python for *nix system admins

2008-09-27 Thread Ben Finney
Lars Stavholm [EMAIL PROTECTED] writes: The module (or library) somehow added unix command capabilities to the python language. It seemed like a lesser known, perhaps new, python library or module. Which particular Unix commands? Perhaps you're thinking of the 'shutil' module

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Steven D'Aprano
On Sat, 27 Sep 2008 18:20:17 +1000, Ben Finney wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: An ordinary singleton is instantiating the class multiple times yet returning the same instance object; a class singleton is simply using the

Re: Using the 'with' statement with cStringIO objects

2008-09-27 Thread Fredrik Lundh
peppergrower wrote: teststring='this is a test' with cStringIO.StringIO(teststring) as testfile: pass umm. what exactly do you expect that code to do? /F -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read a jpg bytearray from a Flash AS3 file

2008-09-27 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I'm trying to save an image from a Flash AS3 to my server as a jpg file. I found some PHP code to do this, but I want to do this in Python. I'm not quite sure how to convert the following code to Python. It's mainly the $GLOBALS[HTTP_RAW_POST_DATA] part I don't know how

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread alex23
On Sep 27, 3:58 pm, r0g [EMAIL PROTECTED] wrote: Ah, just spotted the backticks - they just return whatever's inside them as a string. No, they return the repr() of the object inside. The output of __repr__ -has- to be a string, but typecasting into string isn't the intention of repr() (or the

Re: How to get the filename in the right case ?

2008-09-27 Thread Fredrik Lundh
Stef Mientki wrote: I don't think your suggestion is a good one. If a filename has uppercase characters in it, the END-USER has done that for some kind of reason. I explain how pdb works and show you how to solve the specific comparison problem you mentioned in your post, and you start

Re: How to get the filename in the right case ?

2008-09-27 Thread Michael Torrie
Steven D'Aprano wrote: On Fri, 26 Sep 2008 01:46:15 +0200, Stef Mientki wrote: Secondly thoughtless copying of current behavior, doesn't bring any progress, and I think that's one of the reasons why we're still burdened by inventions done 20 years ago, e.g. do you want to save your changes

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Aaron Castironpi Brady
On Sep 26, 1:04 pm, Aaron \Castironpi\ Brady [EMAIL PROTECTED] wrote: On Sep 26, 11:43 am, Tim Rowe [EMAIL PROTECTED] wrote: 2008/9/26 Steven D'Aprano [EMAIL PROTECTED]: I don't have any objective numbers, but subjectively it seems to me that the number of spams is significantly higher,

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Dotan Cohen
2008/9/27 Aaron Castironpi Brady [EMAIL PROTECTED]: I think in June and July they were selling watches a lot which I haven't noticed recently. Gucci 104 G-Bandeau Watches - Gucci Watches Discount Rolex Oyster Perpetual Lady Datejust Pearlmaster 18kt Yellow Gold Diamond Ladies Watch 80318C

Regular expression help: unable to search ' # ' character in the file

2008-09-27 Thread dudeja . rajat
Hi, Can some help me with the regular expression. I'm looking to search # character in my file? My file has contents: ### Hello World ### length = 10 breadth = 20 height = 30 ###

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread Roy Smith
In article [EMAIL PROTECTED], alex23 [EMAIL PROTECTED] wrote: ' '.join((str(x * x) for x in range(1,6))) Aren't the outer set of parens redundant? This works just as well: ' '.join(str(x * x) for x in range(1,6)) -- http://mail.python.org/mailman/listinfo/python-list

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Aaron Castironpi Brady
On Sep 27, 5:33 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 27 Sep 2008 18:20:17 +1000, Ben Finney wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: An ordinary singleton is instantiating the class multiple times

Re: Build-in 'repr' function (was: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?)

2008-09-27 Thread MRAB
On Sep 27, 4:16 am, Ben Finney [EMAIL PROTECTED] wrote: process [EMAIL PROTECTED] writes: ' '.join([`x * x` for x in range(1, 6)]) exactly what does this symbol do and what does it stand for? It's an obsolete, deprecated syntactic sugar for (what is now implemented as) the built-in 'repr'

Re: Regular expression help: unable to search ' # ' character in the file

2008-09-27 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: import re fd = open(file, 'r') line = fd.readline pat1 = re.compile(\#*) while(line): mat1 = pat1.search(line) if mat1: print line line = fd.readline() I strongly doubt that this is

Re: python for *nix system admins

2008-09-27 Thread George Boutsioukis
On Sat, 27 Sep 2008 10:05:01 +0200, Lars Stavholm wrote: Hi All, I'm new to this list and hoping that this is not off-topic. If it is, please point me in the right direction. I seem to recollect a python module or library for *nix sysadmins, but I can't for the life of me find it again.

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Aaron Castironpi Brady
On Sep 27, 7:28 am, Dotan Cohen [EMAIL PROTECTED] wrote: 2008/9/27 Aaron Castironpi Brady [EMAIL PROTECTED]: I think in June and July they were selling watches a lot which I haven't noticed recently. Gucci 104 G-Bandeau Watches - Gucci Watches Discount Rolex Oyster Perpetual Lady

Re: is decorator the right thing to use?

2008-09-27 Thread George Sakkis
On Sep 27, 1:44 am, Dmitry S. Makovey [EMAIL PROTECTED] wrote: George Sakkis wrote: Although this works, the second argument to ProxyMethod shouldn't be necessary, it's semantically redundant; ideally you would like to write it as bmethod = ProxyMethod('b'). since I'm already on

Re: Using the 'with' statement with cStringIO objects

2008-09-27 Thread George Boutsioukis
So, I'm guessing you can't use the 'with' statement with cStringIO objects? Is this a bug, or do I need to use the 'with' statement differently to get this to work? Thanks, peppergrower Neither, just not implemented. Only classes with __enter__ and __exit__ methods(ie context manager

Re: Regular expression help: unable to search ' # ' character in the file

2008-09-27 Thread dudeja . rajat
On Sat, Sep 27, 2008 at 1:58 PM, Fredrik Lundh [EMAIL PROTECTED]wrote: [EMAIL PROTECTED] wrote: import re fd = open(file, 'r') line = fd.readline pat1 = re.compile(\#*) while(line): mat1 = pat1.search(line) if mat1: print

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Aahz
In article [EMAIL PROTECTED], Ben Finney [EMAIL PROTECTED] wrote: Steven D'Aprano [EMAIL PROTECTED] writes: On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: An ordinary singleton is instantiating the class multiple times yet returning the same instance object; a class singleton is simply

Re: how to replace and string in a SELECT ... IN ()

2008-09-27 Thread Tino Wildenhain
Hi, Michael Mabin wrote: so you wouldn't object then to something like ' in (%)' % ','.join([str_edit_for_exploit(x) for x in aList]) if str_edit_for_exploit applied security edits? Whats an security edit btw? If it is something meant to turn possibly insecure data into

Re: Time.sleep(0.0125) not available within Linux

2008-09-27 Thread Grant Edwards
On 2008-09-27, Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: In message [EMAIL PROTECTED], Grant Edwards wrote: On 2008-09-26, Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: In message [EMAIL PROTECTED], Grant Edwards wrote: Never assume somebody reading the article and attempting to help

Re: EPD (Enthought Python Distribution) 4.0.300 Beta 3 available

2008-09-27 Thread Christopher Brewster
I have always thought this idea very good, but if I download it and install it (on my MacBook pro) will any conflicts occur with existing bits and pieces of Python and its libraries? Thank you, Christopher Brewster * Department of

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Aahz) wrote: One cute reason to prefer class singletons to module singletons is that subclassing works well for creating multiple singletons. But really, the main reason I use class singletons is that they are the absolute simplest way to get

Re: Using the 'with' statement with cStringIO objects

2008-09-27 Thread Hrvoje Niksic
George Boutsioukis [EMAIL PROTECTED] writes: Neither, just not implemented. Only classes with __enter__ and __exit__ methods(ie context manager types) can be used in with statements. And, correct me if I'm wrong, I think it's pointless for a StringIO object to have those. It's definitely

Re: is decorator the right thing to use?

2008-09-27 Thread George Sakkis
On Sep 27, 9:23 am, George Sakkis [EMAIL PROTECTED] wrote: On Sep 27, 1:44 am, Dmitry S. Makovey [EMAIL PROTECTED] wrote: I guess my bias is towards more explicit declarations thus bmethod=ProxyMethod('b',B.bmethod) looks more attractive to me, but I stand to be corrected/educated why

Re: text processing SOLVED

2008-09-27 Thread [EMAIL PROTECTED]
Thanks Black Jack Working -- http://mail.python.org/mailman/listinfo/python-list

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Skip Montanaro
CMIIW correct me if I'm wrong.  Google Groups is a Usenet/c-l-py gateway.  Other gateways aren't contributing to spam.  What are they doing that G-Groups is not? Actually Google Groups appears to be just displaying the Usenet newsgroup comp.lang.python. The spam filtering which is the topic

Re: is decorator the right thing to use?

2008-09-27 Thread George Sakkis
On Sep 27, 11:27 am, George Sakkis [EMAIL PROTECTED] wrote: If you want to eliminate completely specifying attributes with strings, it's easy to modify the above so that you write instead: class A(Proxy): ... bmethod = ProxyMethod(lambda self: self.b1) bmethod2 =

Re: how to replace and string in a SELECT ... IN ()

2008-09-27 Thread Michael Mabin
If the inputs are edited prior to the construction of the string and these fields are used for more than one update then it's not an exploit. It's simply a matter not repeating yourself when coding. In this particular case too, we're talking about a list of integers that gets inserted into a

Borg vs Singleton vs OddClass

2008-09-27 Thread Lie
This is probably unrelated to Python, as this is more about design pattern. I'm asking your comments about this design pattern that is similar in functionality to Singleton and Borg: to share states. I'm thinking about this design pattern (I don't know if anyone has ever thought of this pattern

Re: python for *nix system admins

2008-09-27 Thread Michael Mabin
import commands ? On Sat, Sep 27, 2008 at 8:06 AM, George Boutsioukis [EMAIL PROTECTED]wrote: On Sat, 27 Sep 2008 10:05:01 +0200, Lars Stavholm wrote: Hi All, I'm new to this list and hoping that this is not off-topic. If it is, please point me in the right direction. I seem to

Re: python for *nix system admins

2008-09-27 Thread Eric Wertman
I've been growing a library of my own functions, that use the names of unix commands. They are just conveniences, of course, but I'd suggest the same for sysadmins, it's handy. -- http://mail.python.org/mailman/listinfo/python-list

Re: python for *nix system admins

2008-09-27 Thread Sebastian Bassi
On Sat, Sep 27, 2008 at 3:32 PM, Eric Wertman [EMAIL PROTECTED] wrote: I've been growing a library of my own functions, that use the names of unix commands. They are just conveniences, of course, but I'd suggest the same for sysadmins, it's handy. Can you share it? Best, SB. --

File modifications

2008-09-27 Thread aditya shukla
Hello folks , I have a file like this /T_0_size=105((-bin-ulockmgr_server:0.99[NHX:C=0.195.0],(((-bin-hostname:0.00 [NHX:C=200.0.0],

Re: how to replace and string in a SELECT ... IN ()

2008-09-27 Thread Tino Wildenhain
Hi, Michael Mabin wrote: If the inputs are edited prior to the construction of the string and these fields are used for more than one update then it's not an exploit. It's simply a matter not repeating yourself when coding. In python we do not fear that. In this particular case too, we're

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Terry Reedy
Aahz wrote: In article [EMAIL PROTECTED], Ben Finney [EMAIL PROTECTED] wrote: Steven D'Aprano [EMAIL PROTECTED] writes: I'd like to be able to call [a class] as if it were a function. Normally calling a class object returns an instance -- I wish to return something else. In that case, you

check if file is MS Word or PDF file

2008-09-27 Thread A. Joseph
What should I look for in a file to determine whether or not it is a MS Word file or an Excel file or a PDF file, etc., etc.? including Zip files I don`t want to check for file extension. os.path.splitext('Filename.jpg') will produce a tuple of filename and extension, but some file don`t even

Abstract Base Class register function

2008-09-27 Thread Mikolai Fajer
I have been experimenting with the abc module in py3k and thought about using the register method of an ABC as a class decorator: code import abc class MyABC(metaclass=abc.ABCMeta): pass @MyABC.register class MySub(): pass /code This doesn't work because the register method returns

Hello boys!

2008-09-27 Thread Milenko Stojadinovic Cvrcko
Hello, this is Milenko Stojadinovic from town Banjaluka, Bosnia and Herzegovina, also known as Cvrcko Does anyone know of any bars in town where I can swallow a bucket of cum? It can be either dog, horse or human cum. Also, does anyone know of any sex bars where people will shit in your mouth? I

Configuring pyc directory

2008-09-27 Thread Robert Moore
Is there a way to configure python to read/write compiled pyc files for modules in a directory other than the directory containing the original py files? I'm trying trying to secure an Apache server running mod_python and don't want the process compiling the pyc files to have write access to the

Re: check if file is MS Word or PDF file

2008-09-27 Thread Chris Rebert
On Sat, Sep 27, 2008 at 2:43 PM, A. Joseph [EMAIL PROTECTED] wrote: What should I look for in a file to determine whether or not it is a MS Word file or an Excel file or a PDF file, etc., etc.? including Zip files I don`t want to check for file extension. os.path.splitext('Filename.jpg')

Re: Using the 'with' statement with cStringIO objects

2008-09-27 Thread peppergrower
Thanks for the help. I'm fairly new to programming (which you probably could have guessed...). When I realized that you could use a StringIO instance as if it were a file, I wanted to try some of the same techniques on it as I would with a file. In this case, I wanted to use a for line in

Re: multiprocessing eats memory

2008-09-27 Thread redbaron
When processing data in parallel you will use up as muchmemoryas many datasets you are processing at any given time. Worker processes eats 2-4 times more than I pass to them. If you need to reducememoryuse then you need to start fewer processes and use some mechanism to distribute the work

Re: check if file is MS Word or PDF file

2008-09-27 Thread Michael Crute
On Sat, Sep 27, 2008 at 5:43 PM, A. Joseph [EMAIL PROTECTED] wrote: What should I look for in a file to determine whether or not it is a MS Word file or an Excel file or a PDF file, etc., etc.? including Zip files I don`t want to check for file extension. os.path.splitext('Filename.jpg')

Re: Hello boys!

2008-09-27 Thread default
On Sat, 27 Sep 2008 14:56:07 -0700 (PDT), Milenko Stojadinovic Cvrcko [EMAIL PROTECTED] wrote: Hello, this is Milenko Stojadinovic from town Banjaluka, Bosnia and Herzegovina, also known as Cvrcko Does anyone know of any bars in town where I can swallow a bucket of cum? It can be either dog,

Re: Hello boys!

2008-09-27 Thread Jim Thompson
On Sat, 27 Sep 2008 18:47:16 -0400, default [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 14:56:07 -0700 (PDT), Milenko Stojadinovic Cvrcko [EMAIL PROTECTED] wrote: Hello, this is Milenko Stojadinovic from town Banjaluka, Bosnia and Herzegovina, also known as Cvrcko Does anyone know of any bars

Re: check if file is MS Word or PDF file

2008-09-27 Thread Chris Rebert
On Sat, Sep 27, 2008 at 3:42 PM, Michael Crute [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 5:43 PM, A. Joseph [EMAIL PROTECTED] wrote: What should I look for in a file to determine whether or not it is a MS Word file or an Excel file or a PDF file, etc., etc.? including Zip files I

Re: Hello boys!

2008-09-27 Thread default
On Sat, 27 Sep 2008 15:56:39 -0700, Jim Thompson [EMAIL PROTECTED] wrote: Now you know why I blanket kill-file googlegroups. ...Jim Thompson I knew that! Every now and then one groper will make it back to the scene of his crime - but, granted, there was

Re: EPD (Enthought Python Distribution) 4.0.300 Beta 3 available

2008-09-27 Thread Robert Kern
Disclosure: I work for Enthought. Christopher Brewster wrote: I have always thought this idea very good, but if I download it and install it (on my MacBook pro) will any conflicts occur with existing bits and pieces of Python and its libraries? For the Mac distribution, we have tried very

Re: Hello boys!

2008-09-27 Thread Cydrome Leader
In rec.crafts.metalworking Jim Thompson [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 18:47:16 -0400, default [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 14:56:07 -0700 (PDT), Milenko Stojadinovic Cvrcko [EMAIL PROTECTED] wrote: Hello, this is Milenko Stojadinovic from town Banjaluka,

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Terry Reedy
Aaron Castironpi Brady wrote: class A(type): ... def __call__( self, *ar ): ... print 'call', self, ar ... class B(object): ... __metaclass__= A ... B(3) call class '__main__.B' (3,) Overriding the __call__ method of 'type' has the effect of giving you a static

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Aaron Castironpi Brady
On Sep 27, 6:16 pm, Terry Reedy [EMAIL PROTECTED] wrote: Aaron Castironpi Brady wrote: class A(type): ...     def __call__( self, *ar ): ...             print 'call', self, ar ... class B(object): ...     __metaclass__= A ... B(3) call class '__main__.B' (3,) Overriding the

Re: check if file is MS Word or PDF file

2008-09-27 Thread Sean DiZazzo
On Sep 27, 4:01 pm, Chris Rebert [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 3:42 PM, Michael Crute [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 5:43 PM, A. Joseph [EMAIL PROTECTED] wrote: What should I look for in a file to determine whether or not it is a MS Word file or an Excel

Re: how to replace and string in a SELECT ... IN ()

2008-09-27 Thread Michael Mabin
I'm exhausted, so I'll just shut up about this after a few final words. 1. edits is used in data warehousing to describe data scrubbing or filtering of fields in records that are used as input sources for loading into data warehouses. It's a term that goes way back to batch processing on the

Re: Not fully OO ?

2008-09-27 Thread Tim Rowe
2008/9/27 Aaron Castironpi Brady [EMAIL PROTECTED]: No way. It's *zero* instead of one, if so, because the only thing C# has is a bunch of handcuffs and implicit 'self'. You have a line like: You don't follow what I said, and from your tone I get the feeling you don't *want* to follow what

Re: check if file is MS Word or PDF file

2008-09-27 Thread Michael Crute
On Sat, Sep 27, 2008 at 7:01 PM, Chris Rebert [EMAIL PROTECTED] wrote: Looking at the docs for the mimetypes module, it just guesses based on the filename (and extension), not the actual contents of the file, so it doesn't really help the OP, who wants to make sure their program isn't misled

Re: Borg vs Singleton vs OddClass

2008-09-27 Thread Miles
Lie wrote: This is probably unrelated to Python, as this is more about design pattern. I'm asking your comments about this design pattern that is similar in functionality to Singleton and Borg: to share states. I'm thinking about this design pattern (I don't know if anyone has ever thought

Re: Not fully OO ?

2008-09-27 Thread Aaron Castironpi Brady
On Sep 27, 6:55 pm, Tim Rowe [EMAIL PROTECTED] wrote: 2008/9/27 Aaron Castironpi Brady [EMAIL PROTECTED]: No way.  It's *zero* instead of one, if so, because the only thing C# has is a bunch of handcuffs and implicit 'self'.  You have a line like: You don't follow what I said, and from

Re: Hello boys!

2008-09-27 Thread default
On Sat, 27 Sep 2008 23:12:59 + (UTC), Cydrome Leader [EMAIL PROTECTED] wrote: In rec.crafts.metalworking Jim Thompson [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 18:47:16 -0400, default [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 14:56:07 -0700 (PDT), Milenko Stojadinovic Cvrcko

Docstrings for attributes?

2008-09-27 Thread Roy Smith
Is there any way to attach a docstring to an attribute? I see that PEP-257 talks about attribute docstrings, but it references PDP-258, which was rejected. I suppose I could eschew plain attributes in favor of getter functions, because those give me a place to hang a docstring, but that feels

what's difference usage?

2008-09-27 Thread momobear
while as I try to wrap a function using boost-python, I find a strange situation. #include iostream #include string #include vector #include boost/python/list.hpp #include boost/python.hpp using namespace boost::python; int printlist(list l){ std::vectorstd::string a;

Re: Docstrings for attributes?

2008-09-27 Thread alex23
On Sep 28, 11:50 am, Roy Smith [EMAIL PROTECTED] wrote: Is there any way to attach a docstring to an attribute?  I see that PEP-257 talks about attribute docstrings, but it references PDP-258, which was rejected. I suppose I could eschew plain attributes in favor of getter functions, because

Re: Borg vs Singleton vs OddClass

2008-09-27 Thread Steven D'Aprano
On Sat, 27 Sep 2008 11:12:00 -0700, Lie wrote: This is probably unrelated to Python, as this is more about design pattern. I'm asking your comments about this design pattern that is similar in functionality to Singleton and Borg: to share states. I'm thinking about this design pattern (I

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Steven D'Aprano
On Sat, 27 Sep 2008 17:41:42 -0400, Terry Reedy wrote: In 3.0, at least, one does not need a disk file to create a module. import types me = types.ModuleType('me') # type(__builtins__) works, no import me module 'me' (built-in) me.a = 1 me.a 1 me.a + 1 2 Seems to work for

Re: Hello boys!

2008-09-27 Thread Jim Thompson
On Sat, 27 Sep 2008 23:12:59 + (UTC), Cydrome Leader [EMAIL PROTECTED] wrote: In rec.crafts.metalworking Jim Thompson [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 18:47:16 -0400, default [EMAIL PROTECTED] wrote: On Sat, 27 Sep 2008 14:56:07 -0700 (PDT), Milenko Stojadinovic Cvrcko

design pattern: MVC in python

2008-09-27 Thread 甜瓜
Howdy, I am working on a small PC game by using pygame. Since there are many graphical objects to display and intensive user interactions, I would like to employ MVC pattern to keep the system maintainable. However, I cannot find a good article which discussing the general knowledge about MVC,

Re: Abstract Base Class register function

2008-09-27 Thread Benjamin
On Sep 27, 4:50 pm, Mikolai Fajer [EMAIL PROTECTED] wrote: I have been experimenting with the abc module in py3k and thought about using the register method of an ABC as a class decorator: code import abc class MyABC(metaclass=abc.ABCMeta):     pass @MyABC.register class MySub():    

Re: is decorator the right thing to use?

2008-09-27 Thread Dmitry S. Makovey
George Sakkis wrote: It's funny how often you come with a better solution a few moments after htting send! The snippet above can (ab)use the decorator syntax so that it becomes: class A(Proxy): @ProxyMethod def bmethod(self): return self.b1 @ProxyMethod def

closures and dynamic binding

2008-09-27 Thread Aaron Castironpi Brady
Hello all, To me, this is a somewhat unintuitive behavior. I want to discuss the parts of it I don't understand. f= [ None ]* 10 for n in range( 10 ): ... f[ n ]= lambda: n ... f[0]() 9 f[1]() 9 I guess I can accept this part so far, though it took a little getting used to. I'm

how to make smtplib.SMTP('localhost') work on window xp

2008-09-27 Thread zxo102
Hi, I am trying to use python module smtplib to send my email out on window xp (localhost). import smtplib server = smtplib.SMTP('localhost') but I got the error information as follows: Traceback (most recent call last): File interactive input, line 1, in ? File c:\python24\lib\smtplib.py,

str() should convert ANY object to a string without EXCEPTIONS !

2008-09-27 Thread est
From python manual str( [object]) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to

[issue3892] bsddb: test01_basic_replication fails on Windows sometimes

2008-09-27 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: I reproduce the test failure very consistently, on both win2k and winXP, and may be of some help to test stuff. -- nosy: +amaury.forgeotdarc ___ Python tracker [EMAIL PROTECTED]

[issue3187] os.listdir can return byte strings

2008-09-27 Thread STINNER Victor
Changes by STINNER Victor [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file11189/filename.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3187 ___

[issue3187] os.listdir can return byte strings

2008-09-27 Thread STINNER Victor
Changes by STINNER Victor [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file11210/invalid_filename.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3187 ___

[issue3978] ZipFileExt.read() can be incredibly slow

2008-09-27 Thread Antoine Pitrou
Antoine Pitrou [EMAIL PROTECTED] added the comment: Very interesting, but it will have to wait for 2.7/3.1. 2.6 and 3.0 are in the final phases of the release process. -- nosy: +pitrou priority: - normal versions: +Python 3.1 -Python 2.6 ___ Python

[issue3872] Python 2.6rc2: Tix ComboBox error

2008-09-27 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] added the comment: Thanks for the patch. I have now integrated this patch into externals/tix-8.4.3.1 (along with a patch to compile it for AMD64). Demo installers including this code are available at

[issue3981] Python 3, IDLE does not start

2008-09-27 Thread bahiminin
New submission from bahiminin [EMAIL PROTECTED]: I have Windows XP with Live OneCare as protection. Python 3 IDLE won't start because of sub-process issues while Python 2.5.2 IDLE does start without any problem. -- messages: 73923 nosy: dah severity: normal status: open title: Python 3,

[issue3665] Support \u and \U escapes in regexes

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs [EMAIL PROTECTED]: -- nosy: +timehorse ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3665 ___ ___ Python-bugs-list mailing

[issue3482] re.split, re.sub and re.subn should support flags

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs [EMAIL PROTECTED]: -- nosy: +timehorse ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3482 ___ ___ Python-bugs-list mailing

[issue3482] re.split, re.sub and re.subn should support flags

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs [EMAIL PROTECTED]: -- versions: +Python 2.7, Python 3.1 -Python 2.6, Python 3.0 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3482 ___

[issue3299] invalid object destruction in re.finditer()

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs [EMAIL PROTECTED]: -- versions: +Python 2.7 -Python 2.6 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3299 ___ ___

  1   2   >