assigning a custom mapping type to __dict__

2005-03-01 Thread Steven Bethard
I tried to Google for past discussion on this topic, but without much luck. If this has been discussed before, I'd be grateful for a pointer. Does anyone know why you can't assign a custom mapping type to an object's __dict__? py> class M(object): ... def __getitem__(self, key): ...

Re: Google Technology

2005-03-01 Thread Daniel Yoo
[EMAIL PROTECTED] wrote: : I am just wondering which technologies google is using for gmail and : Google Groups??? Hello Vijay, You may want to look at: http://adaptivepath.com/publications/essays/archives/000385.php which appears to collect a lot of introductory material about the client-s

Re: os.stat('')[stat.ST_INO] on Windows

2005-03-01 Thread Tim Roberts
Patrick Useldinger <[EMAIL PROTECTED]> wrote: > >What does the above yield on Windows? 0. >Are inodes supported on Windows NTFS, FAT, FAT32? No. Inodes are strictly a Unix filesystem concept. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailm

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-01 Thread martijn
oyea, I must convert it to numbers ;) -- http://mail.python.org/mailman/listinfo/python-list

Need direction to kill a virus

2005-03-01 Thread Anthra Norell
Hi all,     Here's an operator who instantantly destroys all messages he cannot identify within two seconds, saves and inspects all attachments before opening them and who thought himself immune from viruses for it. Years of trouble-free operation reinforced the perception.   I recen

Re: zlib.decompress cannot, gunzip can

2005-03-01 Thread enrio
Thanks, now the code is from cStringIO import StringIO from gzip import GzipFile ... body = GzipFile('','r',0,StringIO(body)).read() Regards, Enrique -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Daniel Cer
Why not just inherit from dict? That seems to work. >>> class M(dict): ... def __getitem__(self,key): ... return 42 ... def __setitem__(self,key,value): ... pass ... >>> class C(object): ...pass ... >>> c = C() >>> c.__dict__ = M() >>> c.__dict__['x'] 42 -Dan Steven Bethard wrote: I

Re: closing tabs in wxpython

2005-03-01 Thread Steve Holden
Raghul wrote: I think this need some more explanation.Pls help me to understand this by giving an example. Thanks in advance Raghul: I've seen several (hundred ;-) posts of yours in the past couple of weeks. It's obvious you are looking for help, but it also seems obvious that your level of prog

Re: TKinter

2005-03-01 Thread Steve Holden
anthonyberet wrote: Steve Holden wrote: anthonyberet wrote: So, is it pronounced 'Tee-Kinter', or 'Tee-Kay-Inter'? I don't want to appear as a dork down the pub. If anyone down your pub knows enough about Python to understand what TKinter is I very much doubt they'll be rude enough to call you a

Re: class factory example needed (long)

2005-03-01 Thread Gary Ruben
OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are instance methods. This means that every time a foo object is created, a whole lot of code is being run. It would be bett

Re: best XSLT processor?

2005-03-01 Thread Steve Holden
[EMAIL PROTECTED] wrote: This is a good way to kick off a tussle among interested parties, but hinestly, at this point, most packages work fine. In my opinion your rade-off right now is raw speed (e.g. libxslt) versus flexibility (e.g. 4Suite). All are bug-free enough that you'd have to be doing

Re: Why do descriptors (and thus properties) only work on attributes.

2005-03-01 Thread Steve Holden
Steven Bethard wrote: Antoon Pardon wrote: Can anyone explain why descriptors only work when they are an attribute to an object or class. I think a lot of interesting things one can do with descriptors would be just as interesting if the object stood on itself instead of being an attribute to an o

Re: naming convention for scalars, lists, dictionaries ...

2005-03-01 Thread Paul Boddie
[EMAIL PROTECTED] wrote in message news:<[EMAIL PROTECTED]>... > Since Python does not have declarations, I wonder if people think it is > good to name function arguments according to the type of data structure > expected, with names like "xlist" or "xdict". Your suggestion coincides partly with a

Re: Scoping issue with import

2005-03-01 Thread Steve Holden
James Stroud wrote: Say I have a module, we'll call it "my_imported_mod". It contains a function in it that calls another function, "myfun". The "myfun" function is in the module "my_main_mod", that imports "my_imported_mod". The code of "my_main_mod" might look like this: == from my

Re: yield_all needed in Python

2005-03-01 Thread Steve Holden
Terry Reedy wrote: "Douglas Alan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] We can shorten the code--and make it run in O(N) time--by adding a new keyword to replace the "for v in ...: yield v" pattern: Maybe. Until you define the semantics of yield_all and at least out

Re: How do you control _all_ items added to a list?

2005-03-01 Thread Nick Coghlan
Xif wrote: Overiding all those methods is too much of an effort. I don't really need them. Hmm, it might be nice if there was a UserList.ListMixin that was the counterpart to UserDict.DictMixin that let's you provide the full dictionary API with just __getitem__, __setitem__, __delitem__ and keys

Re: accessor/mutator functions

2005-03-01 Thread Nick Craig-Wood
Dan Sommers <[EMAIL PROTECTED]> wrote: > On 28 Feb 2005 10:30:03 GMT, > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > Actually I would say just access the attribute directly for both get > > and set, until it needs to do something special in which case use > > property(). > > > The reason wh

Re: accessor/mutator functions

2005-03-01 Thread Steve Holden
Andrew Dalke wrote: Me: What's wrong with the use of attributes in this case and how would you write your interface? Dan Sommers: I think I'd add a change_temperature_to method that accepts the target temperature and some sort of timing information, depending on how the rest of the program and/or

Re: accessor/mutator functions

2005-03-01 Thread Steve Holden
Carl Banks wrote: [EMAIL PROTECTED] wrote: [...] My questions are: a) Are the three things above considered pythonic? No. It's not good programming practice in C++, either. If you have a class that's nothing but a big data structure, you ought to use it as a data structure. Writing accessor and

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Nick Coghlan
Daniel Cer wrote: Why not just inherit from dict? That seems to work. Because that isn't the question - Steven knows how to make it work, what he's curious about is why things are the way they are :) Anyway, a quick look suggests that it is due to typeobject.c using the concrete PyDict_* API cal

Re: closing tabs in wxpython

2005-03-01 Thread Raghul
Thanx Steve for ur kind advise.And I am in hurry to finish my project. If this make someone irritating I am sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Blake T. Garretson wrote: If Decimal objects prematurely throw a TypeError before trying the __rop__, is Decimal broken, or was it designed this way? I suspect the former, since I can't recall this subject coming up at any point during the PEP approval or implementation process. And I was one of

Re: python-dev Summary for 2005-01-16 through 2005-01-31

2005-03-01 Thread Steve Holden
Michele Simionato wrote [on c.l.py]: Brett Cannon: [... python-dev summary ... boilerplate change ...] +1 for this idea. The summary looks much better now :) Keep the good work going, Sorry, but i have to disagree. I hope you won't take this reply personally, Michele, since it's directed to all c.

Re: enter key event in wxpython

2005-03-01 Thread Kartic
Raghul said the following on 2/28/2005 11:59 PM: hi, I am developing a jabber client.What I need is whrn i enter text in the text area and when I press return key. The following text should be send.I found the way to send the message, the only thing is I want to handle the enter key event.how to

Re: Why do descriptors (and thus properties) only work on attributes.

2005-03-01 Thread Antoon Pardon
Op 2005-02-28, Dima Dorfman schreef <[EMAIL PROTECTED]>: > On 2005-02-28, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> Op 2005-02-28, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >>> I still don't see how that is supposed to work for "a lot of interesting >>> things". Can you provide examples for o

Re: ZoDB's capabilities

2005-03-01 Thread Lars
Quote Larry Bates: > There is a VERY large website that uses Zope/ZODB that takes up to > 9000 hits per second when it gets busy. What's the url? I just got curious to see it a big site on Zope in action. - Lars "Pythonfan stuck with c sharp" -- http://mail.python.org/mailman/listinfo/pyt

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Nick Coghlan wrote: a) Checking that replacing the relevant "raise TypeError" calls in Lib/Decimal.py with "return NotImplemented" gives you friendlier behaviour. It turns out this isn't really practical - there's too much code in the module relying on those TypeErrors being raised. So this may

MDaemon Warning - virus found: Returned mail: see transcript for details

2005-03-01 Thread Mail Delivery Subsystem
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken ---

Re: Google Technology

2005-03-01 Thread Gurpreet Sachdeva
>>> : I am just wondering which technologies google is using for gmail and >>> : Google Groups??? Check this: http://tools.devshed.com/c/a/Search%20Engine%20Tricks/To-the-next-level-with-Google-Groups-2 Regards, Garry http://garrythegambler.blogspot.com/ -- http://mail.python.org/mailman/listi

Faster way to do this...

2005-03-01 Thread Harlin Seritt
I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Thanks, Harlin -- http://mail.python.org/mailman/listinfo/python-list

Re: python-dev Summary for 2005-01-16 through 2005-01-31

2005-03-01 Thread Gerrit Muller
Brett, <...snip...> -- New format -- I have done a thorough restructuring of the boilerplate and the Summary Announcements section for the Summaries. The purpose of this is to make finding information in the boilerplate much easier. It also keeps consistency by sectioning off e

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Duncan Booth
Daniel Cer wrote: > Why not just inherit from dict? That seems to work. > > >>> class M(dict): > ... def __getitem__(self,key): > ... return 42 > ... def __setitem__(self,key,value): > ... pass > ... > >>> class C(object): > ...pass > ... > >>> c = C() > >>> c.__dict__ = M() > >>>

Re: Faster way to do this...

2005-03-01 Thread Will McGugan
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Isn't that equivalent to simply.. nums= range(100) Will McGugan -- http://mail.python.org/mailman/listinfo/

Delete first line from file

2005-03-01 Thread Tor Erik Sønvisen
Hi How can I read the first line of a file and then delete this line, so that line 2 is line 1 on next read? regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Faster way to do this...

2005-03-01 Thread Steve Holden
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Why not the simplest solution? a = range(100) regards Steve -- http://mail.python.org/mailman/listinfo/p

Re: accessor/mutator functions

2005-03-01 Thread Dan Sommers
On Tue, 01 Mar 2005 05:37:44 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: > Indeed, but it also comes down to control paradigm. I don't *know*, > but I'll make a guess that Dan, who admits to being "old school", > hasn't done a lot of work with GUIs, which are inherently event-based. Not a lot

Re: accessor/mutator functions

2005-03-01 Thread Dan Sommers
On 01 Mar 2005 10:30:01 GMT, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > However in python, there is no harm in accessing the attributes > directly. You can change the implementation whenever you like, and > change the attributes into property()s and the users will never know. [ ... ] > Read o

Re: Delete first line from file

2005-03-01 Thread Peter Nuttall
On Tue, Mar 01, 2005 at 01:27:27PM +0100, Tor Erik S?nvisen wrote: > Hi > > How can I read the first line of a file and then delete this line, so that > line 2 is line 1 on next read? > > regards > > I think you can do something like: n=false f=file.open("") #stuff here g=[] for line in f.re

Re: yield_all needed in Python

2005-03-01 Thread Antoon Pardon
Op 2005-03-01, Steve Holden schreef <[EMAIL PROTECTED]>: > Terry Reedy wrote: >> "Douglas Alan" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>>We can shorten the code--and make it run in O(N) time--by adding a >>>new >>>keyword to replace the "for v in ...: yield v"

Re: ZoDB's capabilities

2005-03-01 Thread Almad
Larry Bates wrote: > There is a VERY large website that uses Zope/ZODB that takes up to > 9000 hits per second when it gets busy. ZODB is very fast and > holds up well under load. If it's true, I'm glad. Other side of think is, on what hardware is this site running :o) > You should probably l

list of all type names

2005-03-01 Thread Klaus Neuner
Hello, Python has one feature that I really hate: There are certain special names like 'file' and 'dict' with a predefined meaning. Yet, it is allowed to redefine these special names as in dict = [1:'bla'] In order to avoid problems in the future, I tried to get the list of all those names, but

Re: Delete first line from file

2005-03-01 Thread Pieter Claerhout
what about the following? f = open( 'file.txt', 'r' ) lines = f.readlines() f.close() f = open( 'file.txt'.'w' ) f.write( '\n'.join( lines[1:] ) ) f.close() cheers, pieter On Tue, 1 Mar 2005 12:42:00 +, Peter Nuttall <[EMAIL PROTECTED]> wrote: > On Tue, Mar 01, 2005 at 01:27:27PM +0100, T

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Nick Coghlan wrote: Nick Coghlan wrote: a) Checking that replacing the relevant "raise TypeError" calls in Lib/Decimal.py with "return NotImplemented" gives you friendlier behaviour. It turns out this isn't really practical - there's too much code in the module relying on those TypeErrors being

Re: list of all type names

2005-03-01 Thread BJörn Lindqvist
> Python has one feature that I really hate: There are certain special > names like 'file' and 'dict' with a predefined meaning. Yet, it is > allowed to redefine these special names as in > > dict = [1:'bla'] dir(__builtins__) Yes, rebinding builtin names accidentally is an annoying and I think e

RE: Delete first line from file

2005-03-01 Thread Alex Stapleton
except them memory usage > file size at least make sure you do it all on disk :P # i so tested this first, honest f = open('file', 'r') fw = open('file.tmp' ,'w') lc = 0 for l in f: if lc != 0: fw.write(l) else: lc = 1 f.close() fw.close() import

RE: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Batista, Facundo
Title: RE: Decimal, __radd__, and custom numeric types... [Nick Coghlan] #- >> a) Checking that replacing the relevant "raise TypeError" #- calls in #- >> Lib/Decimal.py with "return NotImplemented" gives you friendlier #- >> behaviour. #- > #- > #- > It turns out this isn't really prac

RFC822/M400 Mail Network -- Delivery Report

2005-03-01 Thread Mail Delivery Subsystem
Not delivered to: [EMAIL PROTECTED] maximum time expired Original-Envelope-Id: in*vsnl*rfc987;422465891ce8000mimey2k X400-Content-Identifier: 050301182225+053 Reporting-MTA: x400; /PRMD=rfc987/ADMD=vsnl/C=in DSN-Gateway: smtp; terminator1.vsnl.net.in Final-Recipient: rfc822; S=pnv/G=venug

Re: Faster way to do this...

2005-03-01 Thread Aaron Bingham
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? You mean like this? nums = range(100) ;-) -- --

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Nick Coghlan
Batista, Facundo wrote: [Nick Coghlan] #- >> a) Checking that replacing the relevant "raise TypeError" #- calls in #- >> Lib/Decimal.py with "return NotImplemented" gives you friendlier #- >> behaviour. #- > #- > #- > It turns out this isn't really practical - there's too #- much code in the #- > m

Re: java crashes in python thread

2005-03-01 Thread Peter Hansen
Easeway wrote: I use os.system invoking java VM, when running in python thread, the java application crashes. Can you define "crash" more precisely? Isn't there any kind of error message/traceback that would reveal more information about the problem? Also, how quickly do you get this crash? In

windows bat file question

2005-03-01 Thread Tom Willis
I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. rem = """-*-Python-*- script @echo off rem DOS section rem You could set PYTHONPATH or TK environment variables

Module RE, Have a couple questions

2005-03-01 Thread [EMAIL PROTECTED]
(1) How do I perform a search for "word" and have it return every line that this instance is found? (2) How do I perform a search for "word" and "wordtwo" at the same time to return every line these instances are found so that the order in which these lines are in are left intact. If there's anot

Re: [Tutor] printing out a box of O's

2005-03-01 Thread Rainer Mansfeld
Kevin wrote: I just started getting in to python and for taking a look at the for loop. I want to print out a box of O's 10o chars long by 10 lines long this is what I came up with. Is there a better way to do this: j = 'O' for i in j*10: print i * 100 Thanks Kevin Hi Kevin, I don't know, i

Re: canvassing for assistance

2005-03-01 Thread [EMAIL PROTECTED]
Sean, nice work on canvasser! One question: what is the purpose of 'scale'? I notice that if you have already drawn a line on the canvas, then 'scale' can be used to draw a straight-line element extending from the end of the previous freehand line, but if you start with a blank screen, 'scale' ha

Tkinter and Text() widget interactivity ?

2005-03-01 Thread Tonino
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the ability to stop the text at any point. What I want to be able todo is select a line from the Text() window an

[Twisted] potential bug in the reactor's handling events loop

2005-03-01 Thread Andy Leszczynski
Python 2.3, one of the latest Twisted version: I noted that under Linux there is not way to Control-C the reactor loop. After digging a little I found that following change helpes: [EMAIL PROTECTED] internet]# diff base.py{,.ori} > 302d301 < print "1",sysEvtTriggers 305d303 < print "2

Re: windows bat file question

2005-03-01 Thread Peter Hansen
Tom Willis wrote: I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. ... All I get is the python prompt, the lines starting at import sys don't run. If I throw the lines in a python script, I run into pat

Re: problem installing wxPython 2.5.3, wxWidgets installed ok

2005-03-01 Thread timothy . williams
Luc wrote: > [EMAIL PROTECTED] a écrit: > > > I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 > > machine. > > > > I have python in a non-standard place, but I'm using --prefix with the > > configure script to point to where I have everything. The make install > > in $WXDIR

Re: list of all type names

2005-03-01 Thread Peter Maas
Klaus Neuner schrieb: Python has one feature that I really hate: There are certain special names like 'file' and 'dict' with a predefined meaning. Yet, it is allowed to redefine these special names as in This is not a specific Python feature: If you include a header file in C that redefines fopen()

Re: Faster way to do this...

2005-03-01 Thread Roy Smith
Harlin Seritt <[EMAIL PROTECTED]> wrote: >I've got the following code: > >nums = range(0) >for a in range(100): > nums.append(a) > >Is there a better way to have num initialized to a list of 100 >consecutive int values? Step one would be to change the first line to nums = [] which is simpler a

Re: Validating A User/Password Pair + Getting Groups On Unix

2005-03-01 Thread Skip Montanaro
>> 1) Validate that the password is correct for that user *without >>actually logging in*. >> Kanenas> The 'pwd' module probably won't be able (and won't try) to read Kanenas> the shadow password file, so 'pwd' won't be of use. Note that an spwd module was recently added

Re: windows bat file question

2005-03-01 Thread Tom Willis
On Tue, 01 Mar 2005 10:12:29 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Tom Willis wrote: > > I'm trying to get pylint running on windows and the bat file for it > > seems a little screwy. I'm hoping someone may have figured this out > > already. > > ... > > All I get is the python prompt, th

Re: Module RE, Have a couple questions

2005-03-01 Thread Marc Huffnagle
Dasacc There is a better (faster/easier) way to do it than using the re module, the find method of the string class. [EMAIL PROTECTED] wrote: (1) How do I perform a search for "word" and have it return every line that this instance is found? [line for line in document if line.find('a') != -1] (2)

Re: Module RE, Have a couple questions

2005-03-01 Thread Marc Huffnagle
Oops, made a mistake. Marc Huffnagle wrote: Dasacc There is a better (faster/easier) way to do it than using the re module, the find method of the string class. [EMAIL PROTECTED] wrote: (1) How do I perform a search for "word" and have it return every line that this instance is found? [line for

Re: list of all type names

2005-03-01 Thread Calvin Spealman
Of course, remember that there are benefits to this, as well. Redefining the built-ins can be useful in some interesting cases. Klaus Neuner wrote: > Hello, > > Python has one feature that I really hate: There are certain special > names like 'file' and 'dict' with a predefined meaning. Yet, it

Initializing subclasses of tuple

2005-03-01 Thread Dave Opstad
I'm hoping someone can point out where I'm going wrong here. Here's a snippet of a Python interactive session (2.3, if it makes a difference): -- >>> class X(list): ... def __init__(self, n): ... v = range(n) ... list.__init__(self, v) ... >>> x = X(

Re: PyAC 0.1.0

2005-03-01 Thread gry
Premshree Pillai wrote: > PyAC 0.1.0 (http://sourceforge.net/projects/pyac/) > > * ignores non-image files > * optional arg is_ppt for ordering presentation images (eg., > Powerpoint files exported as images) > * misc fixes > > Package here: http://sourceforge.net/project/showfiles.php?group_id=10

ANN: xsdbXML python release with C#/.NET port

2005-03-01 Thread aaronwmail-usenet
ANN: xsdbXML release with C#/.NET port Part I: Announcement There is a new release of xsdbXML which provides bugfixes to the Python implementation and also provides a completely separate implementation in C#/.NET. The xsdb framework provides a flexible and well defined infras

Re: Faster way to do this...

2005-03-01 Thread Warren Postma
Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Rebirth. Then there was the phase of the python-newbie so enamored of map and lambda.

Re: windows bat file question

2005-03-01 Thread Steve Holden
Tom Willis wrote: On Tue, 01 Mar 2005 10:12:29 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: Tom Willis wrote: I'm trying to get pylint running on windows and the bat file for it seems a little screwy. I'm hoping someone may have figured this out already. ... All I get is the python prompt, the li

Re: Initializing subclasses of tuple

2005-03-01 Thread Steve Holden
Dave Opstad wrote: I'm hoping someone can point out where I'm going wrong here. Here's a snippet of a Python interactive session (2.3, if it makes a difference): -- class X(list): ... def __init__(self, n): ... v = range(n) ... list.__init__(self, v)

Re: Initializing subclasses of tuple

2005-03-01 Thread Just
In article <[EMAIL PROTECTED]>, Dave Opstad <[EMAIL PROTECTED]> wrote: > I'm hoping someone can point out where I'm going wrong here. Here's a > snippet of a Python interactive session (2.3, if it makes a difference): > > -- > >>> class X(list): > ... def _

Re: cannot open file in write mode, no such file or directory

2005-03-01 Thread David Bolen
[EMAIL PROTECTED] writes: > I'm having a problem where when trying to open a file in write mode, I > get an IOError stating no such file or directory. I'm calling an > external program which takes an input file and produces an output file > repeatedly, simulating the input file separately for eac

Re: Initializing subclasses of tuple

2005-03-01 Thread gry
To inherit from an immutable class, like string or tuple, you need to use the __new__ member, not __init__. See, e.g.: http://www.python.org/2.2.3/descrintro.html#__new__ -- http://mail.python.org/mailman/listinfo/python-list

memory leaks with ctypes LoadLibrary ?

2005-03-01 Thread chris
What is the proper way to use ctypes to access an exported Function in a dll file on windows? I must be missing something because I get memory leaks when I use it: import ctypes import gc gc.enable() gc.set_debug(gc.DEBUG_LEAK) lib = ctypes.windll.LoadLibrary("H:\lib\mylib.dll") fn = lib.myfn f

smtplib Segfaults Python under Debian

2005-03-01 Thread Alex Stapleton
localhost:~alex#python Python 2.3.3 (#2, Feb 24 2004, 09:29:20) [GCC 3.3.3 (Debian)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import smtplib Segmentation fault (core dumped) This happens under python 2.2 and 2.3 and 2.4 argh! everything else seems to b

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Daniel Cer
> > Why not just inherit from dict? That seems to work. > > Because that isn't the question - Steven knows how to make it work, what he's > curious about is why things are the way they are :) Sorry, didn't mean to be a pest :) I guess I assumed Steve already knew that he could inherit from dict.

Re: smtplib Segfaults Python under Debian

2005-03-01 Thread Skip Montanaro
Alex> localhost:~alex#python Alex> Python 2.3.3 (#2, Feb 24 2004, 09:29:20) Alex> [GCC 3.3.3 (Debian)] on linux2 Alex> Type "help", "copyright", "credits" or "license" for more information. import smtplib Alex> Segmentation fault (core dumped) Can you file a bug repor

(no subject)

2005-03-01 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1106 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wns13feed!worldnet.att.net!12.120.4.37!attcg2!ip.att.net!xyzzy!nntp From: Jeff Sandys <[EMAIL PROTECTED]> Subject: Re: Delete first line f

Re: Pyallegro status (is it dead?). What about pygame.

2005-03-01 Thread PrzemysÅaw RÃÅycki
Thanks for your answers. I wanted to programme in pyallegro, because it seems that allegro has much more followers than SDL (on which pygame is based). I had also the feeling that the former (allegro) is more convenient in high level game programming. But due to the state of pyallegro maturity I

Re: any Python equivalent of Math::Polynomial::Solve?

2005-03-01 Thread Cousin Stanley
Alex Thanks for posting your generalized numarray eigenvalue solution It's been almost 30 years since I've looked at any characteristic equation, eigenvalue, eignevector type of processing and at this point I don't recall many of the particulars Not being sure about the

Re: yield_all needed in Python

2005-03-01 Thread Douglas Alan
Andrew Dalke <[EMAIL PROTECTED]> writes: > On Mon, 28 Feb 2005 18:25:51 -0500, Douglas Alan wrote: >> While writing a generator, I was just thinking how Python needs a >> "yield_all" statement. With the help of Google, I found a >> pre-existing discussion on this from a while back in the >> Ligh

Re: yield_all needed in Python

2005-03-01 Thread Douglas Alan
"Terry Reedy" <[EMAIL PROTECTED]> writes: > Cetainly, if iterator> == , I don't see how anything > is gained except for a few keystrokes. What's gained is making one's code more readable and maintainable, which is the one of the primary reasons that I use Python. |>oug -- http://mail.python.or

Re: list of all type names

2005-03-01 Thread Peter Hansen
Peter Maas wrote: I would avoid the use of generic names for variables but rather use dict1 or aDict etc. If you want to avoid a name collision without the use of naming conventions you could rename __builtins__: bi = __builtins__ del __builtins__ Then you can define what you like but you will have

Re: Canonical way of dealing with null-separated lines?

2005-03-01 Thread Douglas Alan
"John Machin" <[EMAIL PROTECTED]> writes: >>lines = (partialLine + charsJustRead).split(newline) > The above line is prepending a short string to what will typically be a > whole buffer full. There's gotta be a better way to do it. If there is, I'm all ears. In a previous post I provide

Re: windows bat file question

2005-03-01 Thread Peter Hansen
Tom Willis wrote: I figured it out. I just took the embedded python code that was in the batch file distributed with it and put it in it's own module. Really my question was how would this ever work? It seems to me to be a little screwy, but it would be handy to know if this was some sort of conven

Re: accessor/mutator functions

2005-03-01 Thread Nick Craig-Wood
Dan Sommers <[EMAIL PROTECTED]> wrote: > We used to have holy wars over the appropriate level of comments in > source code. Well according to the refactoring book I just read (by Martin Fowler) the appropriate level of comments is None. If you see a comment you should extract the complicated co

Re: accessor/mutator functions

2005-03-01 Thread Carl Banks
Steve Holden wrote: > Carl Banks wrote: > > Don't use getattr and setattr unless you have to construct the name of > > the attribute at run time. That's what they're for. > > > Well, they are surely helpful in delegation contexts as well, or do I > misunderstand? I consider that a degenerate fo

Re: assigning a custom mapping type to __dict__

2005-03-01 Thread Steven Bethard
Daniel Cer wrote: Why not just inherit from dict? That seems to work. Because that isn't the question - Steven knows how to make it work, what he's curious about is why things are the way they are :) Sorry, didn't mean to be a pest :) I guess I assumed Steve already knew that he could inherit from

reuse validation logic with descriptors

2005-03-01 Thread David S.
I am looking for a way to implement the same simple validation on many instance attributes and I thought descriptors (http://users.rcn.com/python/download/Descriptor.htm) looked like the right tool. But I am confused by their behavior on instance of my class. I can only get the approximate be

What's the cost of using hundreds of threads?

2005-03-01 Thread Przemysław Różycki
Hello, I have written some code, which creates many threads for each connection ('main connection'). The purpose of this code is to balance the load between several connections ('pipes'). The number of spawned threads depends on how many pipes I create (= 2*n+2, where n is the number of pipes).

Re: smtplib Segfaults Python under Debian

2005-03-01 Thread Cousin Stanley
| localhost:~alex#python | Python 2.3.3 (#2, Feb 24 2004, 09:29:20) | [GCC 3.3.3 (Debian)] on linux2 | Type "help", "copyright", "credits" or "license" | for more information. | | >>> import smtplib | | Segmentation fault (core dumped) | | This happens under python 2.2 and 2.3 and 2.4 | Alex .

Problem in Dictionaries

2005-03-01 Thread Glauco Silva
I´m with problem in Dictionaries ! I would like to know if the dictionary can sort with a function that i give to then! Because i need to have a dictionary sort by key ! For exemple : dict  = {} dict[50] = "fifty" dict[129] = "a hundred twenty nine" print dict {129: "a hundred twenty nine", 50: "f

Re: class factory example needed (long)

2005-03-01 Thread Steven Bethard
Gary Ruben wrote: OK, I've managed to get this to work with Rainer's method, but I realised it is not the best way to do it, since the methods are being added by the constructor, i.e. they are instance methods. This means that every time a foo object is created, a whole lot of code is being run

Re: yield_all needed in Python

2005-03-01 Thread Duncan Booth
Douglas Alan wrote: > "Terry Reedy" <[EMAIL PROTECTED]> writes: > >> Cetainly, if > iterator> == , I don't see how anything >> is gained except for a few keystrokes. > > What's gained is making one's code more readable and maintainable, > which is the one of the primary reasons that I use Python

Re: Why do descriptors (and thus properties) only work on attributes.

2005-03-01 Thread Steven Bethard
Steve Holden wrote: Steven Bethard wrote: Antoon Pardon wrote: Can anyone explain why descriptors only work when they are an attribute to an object or class. I think a lot of interesting things one can do with descriptors would be just as interesting if the object stood on itself instead of being

ListMixin (WAS: How do you control _all_ items added to a list?)

2005-03-01 Thread Steven Bethard
Nick Coghlan wrote: > Hmm, it might be nice if there was a UserList.ListMixin that was the > counterpart to UserDict.DictMixin I've thought this occasionally too. One of the tricky issues though is that often you'd like to define __getitem__ for single items and have ListMixin add the code for s

Re: Decimal, __radd__, and custom numeric types...

2005-03-01 Thread Blake T. Garretson
Thanks for the suggestions and modified module. I will probably just use this "fixed" module to solve my immediate problem. I appreciate your post to python-dev as well; it looks like this may be addressed in a future release. :) Thanks, Blake -- http://mail.python.org/mailman/listinfo/python-

Re: reuse validation logic with descriptors

2005-03-01 Thread Steven Bethard
David S. wrote: I am looking for a way to implement the same simple validation on many instance attributes and I thought descriptors (http://users.rcn.com/python/download/Descriptor.htm) looked like the right tool. But I am confused by their behavior on instance of my class. I can only get th

Re: yield_all needed in Python

2005-03-01 Thread Douglas Alan
Duncan Booth <[EMAIL PROTECTED]> writes: > Douglas Alan wrote: >> "Terry Reedy" <[EMAIL PROTECTED]> writes: >>> Cetainly, if >> iterator> == , I don't see how anything >>> is gained except for a few keystrokes. >> What's gained is making one's code more readable and maintainable, >> which is th

  1   2   3   >