How to deepcopy a list of user defined lists?

2009-01-08 Thread srinivasan srinivas
Hi, I have a class which is a subclass of builtin-type list. #-- class clist(list):     def __new__(cls, values, ctor):     val = []     for item in values:     item = ctor(item)     val.append(item

Re: How to deepcopy a list of user defined lists?

2009-01-08 Thread Chris Rebert
On Wed, Jan 7, 2009 at 11:59 PM, srinivasan srinivas wrote: > Hi, > I have a class which is a subclass of builtin-type list. > > #-- > class clist(list): > def __new__(cls, values, ctor): > val = [] > f

RE: listdir reports [Error 1006] The volume for a file has been externally altered so that the opened file is no longer valid

2009-01-08 Thread Per Olav Kroka
FYI: the '/*.*' is part of the error message returned. -Original Message- From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris Rebert Sent: Wednesday, January 07, 2009 6:40 PM To: Per Olav Kroka Cc: python-list@python.org Subject: Re: listdir reports [Error 1006] The vo

Re: why cannot assign to function call

2009-01-08 Thread Steven D'Aprano
On Wed, 07 Jan 2009 03:45:00 -0800, sturlamolden wrote: > On Jan 7, 2:02 am, Steven D'Aprano > wrote: > >> In Python code, there are no references and no dereferencing. > > The why does CPython keep track of reference counts? Two different levels of explanation. At the level of Python code, yo

Re: mmap only supports string

2009-01-08 Thread Aaron Brady
On Jan 7, 8:14 pm, Neal Becker wrote: > Problem is, AFAIK a string can only be created as a copy of some other data.   > Say I'd like to take some large object and read/write to/from mmap object.  A > good way to do this would be the buffer protocol.  Unfortunately, mmap only > supports string.

Re: How to deepcopy a list of user defined lists?

2009-01-08 Thread srinivasan srinivas
--> 964 self.__tmp_data = copy.deepcopy(self.__data)     965 /usr/local/python-2.5.1/lib/python2.5/copy.py in deepcopy(x, memo, _nil)     160 copier = _deepcopy_dispatch.get(cls)     161 if copier: --> 162 y = copier(x, memo)     163 else:     164 try: /usr/local

Re: How to deepcopy a list of user defined lists?

2009-01-08 Thread Steven D'Aprano
On Thu, 08 Jan 2009 13:29:37 +0530, srinivasan srinivas wrote: > Hi, > I have a class which is a subclass of builtin-type list. > > #-- > class clist(list): >     def __new__(cls, values, ctor): >     val = [] >

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-08 Thread Eric Brunel
On Wed, 07 Jan 2009 20:31:23 +0100, excord80 wrote: Does Python work with Tk 8.5? I'm manually installing my own Python 2.6.1 (separate from my system's Python 2.5.2), and am about to install my own Tcl/Tk 8.5 but am unsure how to make them talk to eachother. Should I install Tk first? If I put

Re: Multiprocessing takes higher execution time

2009-01-08 Thread Nick Craig-Wood
Sibtey Mehdi wrote: > I use multiprocessing to compare more then one set of files. > > For comparison each set of files (i.e. Old file1 Vs New file1) > I create a process, > > Process(target=compare, args=(oldFile, newFile)).start() > > It takes 61 seconds execution time. > > When I do the sam

Re: Creating new instances of subclasses.

2009-01-08 Thread Nick Craig-Wood
J. Cliff Dyer wrote: > I want to be able to create an object of a certain subclass, depending > on the argument given to the class constructor. > > I have three fields, and one might need to be a StringField, one an > IntegerField, and the last a ListField. But I'd like my class to > delega

eval('07') works, eval('08') fails, why?

2009-01-08 Thread Alex van der Spek
I am baffled by this: IDLE 1.2.2 No Subprocess >>> input() 07 7 >>> input() 08 Traceback (most recent call last): File "", line 1, in input() File "", line 1 08 ^ SyntaxError: invalid token of course, I can work around this using raw_input() but I want to underst

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Thomas Guettler
Hi, 07 is octal. That's way 08 is invalid. Try this: ===> python >>> print 011 9 >>> print int('011') 11 -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Force exception on attribute write access only one object

2009-01-08 Thread Thomas Guettler
Hi, for debugging I want to raise an exception if an attribute is changed on an object. Since it is only for debugging I don't want to change the integer attribute to a property. This should raise an exception: myobj.foo=1 Background: Somewhere this value gets changed. But I don't now where.

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Mark Dickinson
On Jan 8, 9:31 am, Alex van der Spek wrote: > >>> eval('07') > 7 > >>> eval('08') > > Traceback (most recent call last): >   File "", line 1, in >     eval('08') >   File "", line 1 >     08 >      ^ > SyntaxError: invalid token An integer literal with a leading zero is interpreted as an octal

Re: Multiprocessing takes higher execution time

2009-01-08 Thread James Mills
On Thu, Jan 8, 2009 at 7:31 PM, Nick Craig-Wood wrote: (...) > How many projects are you processing at once? And how many MB of zip > files is it? As reading zip files does lots of disk IO I would guess > it is disk limited rather than anything else, which explains why doing > many at once is a

Re: Force exception on attribute write access only one object

2009-01-08 Thread Chris Rebert
On Thu, Jan 8, 2009 at 1:38 AM, Thomas Guettler wrote: > Hi, > > for debugging I want to raise an exception if an attribute is > changed on an object. Since it is only for debugging I don't want > to change the integer attribute to a property. > > This should raise an exception: > > myobj.foo=1 >

Re: Traceback in Logging

2009-01-08 Thread Kottiyath
The issue is that I am on Python 2.4 which doesnt support func name. I am using filename and lineno now. That does serve the purpose. Thank you, I had not checked all the parameters. Regards K Vinay Sajip wrote: > On Jan 6, 4:17 pm, Kottiyath wrote: > > I dont want the whole traceback. I just wa

Reading C# serialized objects into Python?

2009-01-08 Thread Alex van der Spek
Is there a way to read C# serialized objects into Python? I know the definition and structure of the C# objects. The Python docs say that pickle is specific to Python, which does not give me much hope. There may be a library however that I haven't come across yet. Thanks much, Alex van der Spek

Re: using subprocess module in Python CGI

2009-01-08 Thread ANURAG BAGARIA
Dear Matt, Thank you for your answer. This script is just a kind of test script so as to actually get it started on doing any simple job. The actual process would be much more complicated where in I would like to extract the tar file and search for a file with certain extension and this file would

Re: Reading C# serialized objects into Python?

2009-01-08 Thread Diez B. Roggisch
Alex van der Spek wrote: > Is there a way to read C# serialized objects into Python? > > I know the definition and structure of the C# objects. The Python docs > say that pickle is specific to Python, which does not give me much hope. > There may be a library however that I haven't come across ye

Re: why cannot assign to function call

2009-01-08 Thread Aaron Brady
On Jan 8, 1:45 am, Steven D'Aprano wrote: > On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: snip > > The `they're just objects' model is very simple, but gets tied up in > > knots explaining things.  The `it's all references' model is only a > > little more complicated, but explains everyt

Re: Generator metadata/attributes

2009-01-08 Thread acooke . org
Thanks folks. Will write my own class Andrew PS So for the record, this works and isn't as ugly/verbose as I was expecting: class TaggedWrapper(): def __init__(self, generator, logMixin, stream): self.__generator = generator self.__tag = '%...@%s' % (logMixin.describe()

Re: why cannot assign to function call

2009-01-08 Thread Mark Wooding
ru...@yahoo.com wrote: > I thought you were objecting to Python's use of the term "binding" > when you wrote: [snip] > in response to someone talking about "...all those who use the term > \"name binding\" instead of variable assignment...". Oh, that. Well, the terms are `binding' and `assign

Re: Force exception on attribute write access only one object

2009-01-08 Thread Peter Otten
Thomas Guettler wrote: > for debugging I want to raise an exception if an attribute is > changed on an object. Since it is only for debugging I don't want > to change the integer attribute to a property. Why? > This should raise an exception: > > myobj.foo=1 > > Background: > Somewhere this v

Python Community Service Awards

2009-01-08 Thread Steve Holden
Ben Finney recently wrote: > Paul McNett writes: [...] >> I always end up sending the first reply to the sender, then going >> "oops, forgot to hit reply-all'", and sending another copy to the >> list.] [...] > Thanks to the Python mailing list administrators for conforming to the > standards and

Re: why cannot assign to function call

2009-01-08 Thread Steve Holden
Aaron Brady wrote: > On Jan 8, 1:45 am, Steven D'Aprano > wrote: >> On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: > snip >>> The `they're just objects' model is very simple, but gets tied up in >>> knots explaining things. The `it's all references' model is only a >>> little more compli

Re: Reading C# serialized objects into Python?

2009-01-08 Thread Steve Holden
Alex van der Spek wrote: > Is there a way to read C# serialized objects into Python? > > I know the definition and structure of the C# objects. The Python docs > say that pickle is specific to Python, which does not give me much hope. > There may be a library however that I haven't come across y

Re: Is it ok to type check a boolean argument?

2009-01-08 Thread Bruno Desthuilliers
Adal Chiriliuc a écrit : On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: This being said, I can only concur with other posters here about the very poor naming. As far as I'm concerned, I'd either keep the argument as a boolean but rename it "ascending" (and use a default True value), or keep the

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Simon Cross
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton wrote: > secondly, i want a python25.lib which i can use to cross-compile > modules for poor windows users _despite_ sticking to my principles and > keeping my integrity as a free software developer. If this eventually leads to being a

RE: Multiprocessing takes higher execution time

2009-01-08 Thread Sibtey Mehdi
Thanks Nick. It processes 10-15 projects(i.e. 10-15 processes are started) at once. One Zip file size is 2-3 MB. When I used dual core system it reduced the execution time from 61 seconds to 55 seconds. My dual core system Configuration is, Pentium(R) D CPU 3.00GHz, 2.99GHz 1 GB RAM Regards, Go

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread David Cournapeau
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross wrote: > On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton > wrote: >> secondly, i want a python25.lib which i can use to cross-compile >> modules for poor windows users _despite_ sticking to my principles and >> keeping my integrity as a fr

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 12:42 PM, Simon Cross wrote: > On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton > wrote: >> secondly, i want a python25.lib which i can use to cross-compile >> modules for poor windows users _despite_ sticking to my principles and >> keeping my integrity as a f

Default __nonzero__ impl doesn't throw a TypeError exception

2009-01-08 Thread Sergey Kishchenko
In Python empty container equals False in 'if' statements: # prints "It's ok" if not []: print "It's ok" Let's create a simple Foo class: class Foo: pass Now I can use Foo objects in 'if' statements: #prints "Ouch!" f=Foo() if f: print "Ouch!" So, default __nonzero__ impl is to re

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau wrote: > On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross > wrote: >> On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton >> wrote: >>> secondly, i want a python25.lib which i can use to cross-compile >>> modules for poor windows users _despi

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread David Cournapeau
On Thu, Jan 8, 2009 at 11:02 PM, Luke Kenneth Casson Leighton wrote: > On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau wrote: >> On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross >> wrote: >>> On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton >>> wrote: secondly, i want a python25.l

Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Barak, Ron
Hi, I am getting the error TypeError: seek() takes exactly 2 arguments (3 given), namely: $ ./_LogStream.py Traceback (most recent call last): File "./_LogStream.py", line 47, in log_stream.last_line_loc_and_contents() File "./_LogStream.py", line 20, in last_line_loc_and_contents s

Re: How to set a cookie using Cookie Module

2009-01-08 Thread tryg . olson
On Jan 7, 9:35 am, tryg.ol...@gmail.com wrote: > Hello - > > This is my first attempt at python cookies. I'm using the Cookie > module and trying to set a cookie. Below is my code. The cookie does > not get set. What am I doing wrong? > > print "Cache-Control: max-age=0, must-revalidate, no-sto

Re: How to set a cookie using Cookie Module

2009-01-08 Thread tryg . olson
On Jan 7, 9:35 am, tryg.ol...@gmail.com wrote: > Hello - > > This is my first attempt at python cookies. I'm using the Cookie > module and trying to set a cookie. Below is my code. The cookie does > not get set. What am I doing wrong? > > print "Cache-Control: max-age=0, must-revalidate, no-sto

Re: Generator metadata/attributes

2009-01-08 Thread Rob Williscroft
wrote in news:053df793-9e8e-4855-aba1-f92482cd8922 @v31g2000vbb.googlegroups.com in comp.lang.python: > class TaggedWrapper(): > > def __init__(self, generator, logMixin, stream): > self.__generator = generator > self.__tag = '%...@%s' % (logMixin.describe(), stream) >

Tree views - Best design practices

2009-01-08 Thread Filip Gruszczyński
Hi! I have certain design problem, which I cannot solve elegantly. Maybe you know some good design patterns for this kind of tasks. Task: We have a model which has two kinds of objects: groups and elements. Groups can hold other groups (subgroups) and elements. It's a simple directory tree, for

Re: Creating new instances of subclasses.

2009-01-08 Thread Paul McGuire
On Jan 7, 12:00 pm, Paul McGuire wrote: > On Jan 7, 10:38 am, "J. Cliff Dyer" wrote: > > > I want to be able to create an object of a certain subclass, depending > > on the argument given to the class constructor. > > > I have three fields, and one might need to be a StringField, one an > > Integ

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
> anyway, i'm floundering around a bit and making a bit of a mess of the > code, looking for where LONG_MAX is messing up. fixed with this: PyObject * PyInt_FromSsize_t(Py_ssize_t ival) { if ((long)ival >= (long)LONG_MIN && (long)ival <= (long)LONG_MAX) { return PyInt_FromLong((l

Re: why cannot assign to function call

2009-01-08 Thread Dan Esch
Absolutely. Trivially and at a high level, teaching python to kids who are learning programming as introductory material teaching python to motivated college graduate students teaching python to adult non-professional programmers with a need to learn python (like for instance, frustrated account

Work with Open Office

2009-01-08 Thread Dan Esch
Okay, I'm currently stuck with VBA / Excel in work and the following paradigm: VB (6? .NET? not sure) ==> VBA ==> Excel 2003 and Access Where I'd like to be is this Python ==> X ==> Open Office / (MySQL or other) for some sufficiently useful value of X. Does it exist? Is it just a set of mod

Re: Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Mark Tolonen
"Barak, Ron" wrote in message news:7f0503cd69378f49be0dc30661c6ccf602494...@enbmail01.lsi.com... Hi, I am getting the error TypeError: seek() takes exactly 2 arguments (3 given), namely: $ ./_LogStream.py Traceback (most recent call last): File "./_LogStream.py", line 47, in log_str

Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
> next bug: distutils.sysconfig.get_config_var('srcdir') is returning None (!!) ok ... actually, that's correct. oops. sysconfig.get_config_vars() only returns these, on win32: {'EXE': '.exe', 'exec_prefix': 'Z:\\mnt\\src\\python2.5-2.5.2', 'LIBDEST': 'Z:\\mnt\\src\\python2.5-2.5.2\\Lib', 'pr

How to Delete a Cookie?

2009-01-08 Thread tryg . olson
Hello - I managed to get a cookie set. Now I want to delete it but it is not working. Do I need to do another 'set-cookie' in the HTTP header? I tried (code below setting expires to 0) and it didn't work. c = Cookie.SimpleCookie(os.environ["HTTP_COOKIE"]) c["mycook"]["expires"] = 0 print c In

Re: Generator metadata/attributes

2009-01-08 Thread Gerard Flanagan
On Thu, 08 Jan 2009 08:42:55 -0600, Rob Williscroft wrote: > > def mydecorator( f ): > def decorated(self, *args): > logging.debug( "Created %s", self.__class__.__name__ ) > for i in f(self, *args): > yield i > return decorated > can optionally be written as: def mydecorator

Re: Work with Open Office

2009-01-08 Thread Benjamin Kaplan
On Thu, Jan 8, 2009 at 10:07 AM, Dan Esch wrote: > Okay, I'm currently stuck with VBA / Excel in work and the following > paradigm: > > VB (6? .NET? not sure) ==> VBA ==> Excel 2003 and Access > > Where I'd like to be is this > > Python ==> X ==> Open Office / (MySQL or other) for some sufficie

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-08 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 7, 9:16 am, "Chris Mellon" wrote: >> >> The OP wants a Ruby-style DSL by which he means "something that lets >> me write words instead of expressions". The ruby syntax is amenable to >> this, python (and lisp, for that matter) syntax is not and you can't >> impl

Symposium “Image Processing and Visualization in S olid Mechanics Processes” within the ESMC2009 Conference – Announce & Call for Papers

2009-01-08 Thread tava...@fe.up.pt
- (Apologies for cross-posting) Symposium on “Visualization and Human-Computer” 7th EUROMECH Solid Mechanics Conference (ESMC2009) Instituto Superior Técnico

"python -3" not working as expected

2009-01-08 Thread Thorsten Kampe
[Python 2.6.1] Hi, to test existing Python code, I ran "python -3" ("warn about Python 3.x incompatibilities") against a test file that only contains "print 'test'". Unfortunately I saw no warnings about print becoming a function in Python 3 ("print()"). Where is the problem? Thorsten -- htt

RE: Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Barak, Ron
Hi Mark, I think my open_file() - that is called in __init__ - assures that self.input_file is a regular text file, regardless if filename is a gz or a regular text file. My Python is Python 2.5.2. Bye, Ron. -Original Message- From: Mark Tolonen [mailto:metolone+gm...@gmail.com] Sent:

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-08 Thread MRAB
Shane wrote: Consider a network of 3 fully-connected boxes i.e. every box as a TCP- IP connection to every other box. Suppose you start a python program P on box A. Is there a Python mechanism for P to send a copy of itself to box B or C then start that program P on B or C by running a method p

ask a question about richtextctrl

2009-01-08 Thread 徐炼新
I have countered a problem while using wx.RichTextCtrl. I want to do some check when user presss Ctrl+C to paste. But i found that i can not get the wx.EVT_CHAR event while Ctrl+C is pressed. And I have tried many methods but all failed. So anybody can tell me some tips?Thank you! -- http://mail.p

Re: formatted 'time' data in calculations

2009-01-08 Thread Ross
Scott David Daniels wrote: Ross wrote: There seems to be no shortage of information around on how to use the time module, for example to use time.ctime() and push it into strftime and get something nice out the other side, but I haven't found anything helpful in going the other way. As to a

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Grant Edwards
On 2009-01-08, Alex van der Spek wrote: > Thanks much, that makes sense! Well, that's the correct explanation. Whether that feature makes sense or not is debatable. Even I'm not old-school enough that I ever use octal literals -- and I used Unix on a PDP-11 for years (actually had my own PDP-1

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-08 Thread Kay Schluehr
On 8 Jan., 16:25, J Kenneth King wrote: > As another poster mentioned, eventually PyPy will be done and then > you'll get more of an "in-Python" DSL. May I ask why you consider it as important that the interpreter is written in Python? I see no connection between PyPy and syntactical Python exte

Re: Work with Open Office

2009-01-08 Thread Dan Esch
Have been browsing through this list and reading documentation and tutorials for python self-study. I have, apparently, teh stupid. Google is my friend. Off I go. Thanks. On 1/8/09, Benjamin Kaplan wrote: > > > > On Thu, Jan 8, 2009 at 10:07 AM, Dan Esch wrote: > >> Okay, I'm currently stuck

Re: Tree views - Best design practices

2009-01-08 Thread MRAB
Filip Gruszczyński wrote: Hi! I have certain design problem, which I cannot solve elegantly. Maybe you know some good design patterns for this kind of tasks. Task: We have a model which has two kinds of objects: groups and elements. Groups can hold other groups (subgroups) and elements. It's a

Re: When does python 3.1, 3.2 ve rsion out?

2009-01-08 Thread MVP
Hi! The mountain Python-3000 gave birth to a mouse Python-3. You must waiting for Python-4000... @+ MCI -- http://mail.python.org/mailman/listinfo/python-list

FTP example going through a FTP Proxy

2009-01-08 Thread jakecjacobson
Hi, I need to write a simple Python script that I can connect to a FTP server and download files from the server to my local box. I am required to go through a FTP Proxy and I don't see any examples on how to do this. The FTP proxy doesn't require username or password to connect but the FTP serv

Re: ftp seems to get a delayed reaction.

2009-01-08 Thread Antoon Pardon
On 2009-01-06, Jeremy.Chen wrote: > ftp.storbinary("STOR ftp-tst/ftp-file\n", fl) > -- > I think the params after STOR should't be a path,should be splited. > ftp.cwd("ftp-tst") > ftp.storbinary("STOR ftp-file\n", fl) No that isn't the problem. The problem is the '\n' at the end of the

Re: If your were going to program a game...

2009-01-08 Thread Steven D'Aprano
On Tue, 06 Jan 2009 10:44:39 -0700, Joe Strout wrote: > Not that I have anything against Flash; I've started learning it just > last week, and apart from the nasty C-derived syntax, it's quite nice. > It has a good IDE, good performance, great portability, and it's easy to > use. It just surprise

How do you write to the printer ?

2009-01-08 Thread David
Can find nothing in the on-line docs or a book. Groping in the dark I attempted : script24 import io io.open('stdprn','w') # accepted stdprn.write('hello printer') # fails < stdprn is not defined > Thanks to all responders I'm inching up on the snake. Dave WB3DWE -- http:

Re: formatted 'time' data in calculations

2009-01-08 Thread Ross
Thanks Chris and Diez for the quick pointers... Very helpful Ross. -- http://mail.python.org/mailman/listinfo/python-list

sftp with no password from python

2009-01-08 Thread loial
Is it possible to use sftp without a password from python? -- http://mail.python.org/mailman/listinfo/python-list

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Alex van der Spek
Thanks much, that makes sense! Alex van der Spek -- http://mail.python.org/mailman/listinfo/python-list

figuring week of the day....

2009-01-08 Thread tekion
Is there a module where you could figure week of the day, like where it starts and end. I need to do this for a whole year. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: #python IRC help - my internet provider is banned!

2009-01-08 Thread Mildew Spores
What? Sounds a bit unlikely unless its Virgin.. I'd imagine it might be that your isp needs to get itself off a black list. Brian -- My Hotmail Account mildew_spo...@hotmail.com "simonh" wrote in message news:fd0bd7d3-ad1d-43c2-b8e5-642a95c21...@t26g2000prh.googlegroups.com... > Hi. Not sure i

Re: Generator metadata/attributes

2009-01-08 Thread Ant
You could look at something like the following to turn the class iteslf into a decorator (changed lines *-ed): > class TaggedWrapper(): > *     def __init__(self, logMixin, stream): >         self.__tag = '%...@%s' % (logMixin.describe(), stream) >         logMixin._debug('Created %s' % self) > >

Re: figuring week of the day....

2009-01-08 Thread r
here are a few tuts that go into more detail http://effbot.org/librarybook/datetime.htm http://seehuhn.de/pages/pdate -- http://mail.python.org/mailman/listinfo/python-list

Re: Tree views - Best design practices

2009-01-08 Thread Filip Gruszczyński
class Element(object): >operations = "Element operations" > > class Group(object): >operations = "Group operations" > > e = Element() g = Group() e.operations > 'Element operations' g.operations > 'Group operations' But this is the same as asking

Re: compiling python2.5 on linux under wine

2009-01-08 Thread lkcl
> ... nd, that means disabling setup.py or hacking it significantly > to support a win32 build, e.g. to build pyexpat, detect which modules > are left, etc. by examining the remaining vcproj files in PCbuild. > > ok - i'm done for now. > if anyone wants to play with this further, source

Re: "python -3" not working as expected

2009-01-08 Thread Marc 'BlackJack' Rintsch
On Thu, 08 Jan 2009 16:38:53 +0100, Thorsten Kampe wrote: > [Python 2.6.1] > > Hi, > > to test existing Python code, I ran "python -3" ("warn about Python 3.x > incompatibilities") against a test file that only contains "print > 'test'". > > Unfortunately I saw no warnings about print becoming

Re: Tree views - Best design practices

2009-01-08 Thread MRAB
Filip Gruszczyński wrote: class Element(object): operations = "Element operations" class Group(object): operations = "Group operations" e = Element() g = Group() e.operations 'Element operations' g.operations 'Group operations' But this is the same as asking for a clas

Re: Tree views - Best design practices

2009-01-08 Thread Diez B. Roggisch
Filip Gruszczyński wrote: > Hi! > > I have certain design problem, which I cannot solve elegantly. Maybe > you know some good design patterns for this kind of tasks. > > Task: > > We have a model which has two kinds of objects: groups and elements. > Groups can hold other groups (subgroups) and

Re: FTP example going through a FTP Proxy

2009-01-08 Thread jakecjacobson
On Jan 7, 3:56 pm, jakecjacobson wrote: > On Jan 7, 2:11 pm, jakecjacobson wrote: > > > > > On Jan 7, 12:32 pm, jakecjacobson wrote: > > > > Hi, > > > > I need to write a simple Python script that I can connect to a FTP > > > server and download files from the server to my local box.  I am > > >

Re: linked list with cycle structure

2009-01-08 Thread Diez B. Roggisch
David Hláčik wrote: > Hi, > > so okay, i will create a helping set, where i will be adding elements > ID, when element ID will be allready in my helping set i will stop and > count number of elements in helping set. This is how long my cycled > linked list is. > But what if i have another condi

socket and thread

2009-01-08 Thread ZeeGeek
I'm writing a small program which uses different threads to monitor an IMAP mailbox and an RSS feed. If network is not available when the program starts, both threads will sleep for a while and try again. It seems that the first thread succeeds when the network becomes available will cause the othe

Re: How to Delete a Cookie?

2009-01-08 Thread Mike Driscoll
On Jan 8, 9:16 am, tryg.ol...@gmail.com wrote: > Hello - > > I managed to get a cookie set.  Now I want to delete it but it is not > working. > > Do I need to do another 'set-cookie' in the HTTP header?  I tried > (code below setting expires to 0) and it didn't work. > c = Cookie.SimpleCookie(os.en

Re: "python -3" not working as expected

2009-01-08 Thread Steve Holden
Thorsten Kampe wrote: > [Python 2.6.1] > > Hi, > > to test existing Python code, I ran "python -3" ("warn about Python 3.x > incompatibilities") against a test file that only contains "print > 'test'". > > Unfortunately I saw no warnings about print becoming a function in > Python 3 ("print()

Re: formatted 'time' data in calculations

2009-01-08 Thread Steve Holden
Ross wrote: > Scott David Daniels wrote: >> Ross wrote: >>> There seems to be no shortage of information around on how to use the >>> time module, for example to use time.ctime() and push it into >>> strftime and get something nice out the other side, but I haven't >>> found anything helpful in goi

Re: Extending Python with C or C++

2009-01-08 Thread Thomas Heller
Nick Craig-Wood schrieb: > Thomas Heller wrote: >> Nick Craig-Wood schrieb: >> > Interesting - I didn't know about h2xml and xml2py before and I've >> > done lots of ctypes wrapping! Something to help with the initial >> > drudge work of converting the structures would be very helpful. >> > >>

Re: #python IRC help - my internet provider is banned!

2009-01-08 Thread Jason Ribeiro
I am not a #python operator, but do note that #python is +r so you must be registered and identified to join the channel, see http://freenode.net/faq.shtml#userregistration . Otherwise, giving the exact ban that is affecting you or your hostmask would probably be helpful to the operators. On Wed

Re: How to Delete a Cookie?

2009-01-08 Thread mk
tryg.ol...@gmail.com wrote: Hello - I managed to get a cookie set. Now I want to delete it but it is not working. Why struggle with this manually? Isn't it better to learn a bit of framework like Pylons and have it all done for you (e.g. in Pylons you have response.delete_cookie method)?

Re: eval('07') works, eval('08') fails, why?

2009-01-08 Thread Ned Deily
In article , Unknown wrote: > On 2009-01-08, Alex van der Spek wrote: > > Thanks much, that makes sense! > Well, that's the correct explanation. > Whether that feature makes sense or not is debatable. The debate is over! In Py 3.0, octal literals changed from 07 to 0o7; the old format gets an

ftplib - 226 message not received

2009-01-08 Thread Brendan
I am trying to download a file within a very large zipfile. I need two partial downloads of the zipfile. The first to get the file byte offset, the second to get the file itself which I then inflate. I am implementing the partial downloads as follows: con = ftp.transfercmd('RETR ' + filename, res

Re: How to Delete a Cookie?

2009-01-08 Thread Jose C
> c["mycook"]["expires"] = 0 Set ["expires"] using the following format to any time less than current (which causes the browser to delete the cookie). Here's a function I use to return a cookie expiry timestamp, negative values passed in result in cookie being deleted. def cookie_expiry_date(numd

Re: del behavior 2

2009-01-08 Thread Eric Snow
On Jan 7, 3:23 pm, "Martin v. Löwis" wrote: > > Thanks for the responses.  What I mean is when a python process is > > interrupted and does not get a chance to clean everything up then what > > is a good way to do so?  For instance, I have a script that uses child > > ptys to facilitate ssh connec

Re: del behavior 2

2009-01-08 Thread Eric Snow
On Jan 7, 12:42 pm, Eric Snow wrote: > I was reading in the documentation about __del__ and have a couple of > questions.  Here is what I was looking at: > > http://docs.python.org/reference/datamodel.html#object.__del__ > > My second question is about the following: > > "It is not guaranteed that

Re: cPickle vs pickle discrepancy

2009-01-08 Thread Zac Burns
Thanks for your patience waiting for me to isolate the problem. | Package --__init__.py ->empty --Package.py ->empty --Module.py import cPickle class C(object): pass def fail(): return cPickle.dumps(C(), -1) import Package.Module Package.Module.fail() The failure s

Re: ftplib - 226 message not received

2009-01-08 Thread Brendan
Okay, found it on my own. ftp.voidresp() is what is needed, and it does _not_ seem to be in the Python documentation for ftplib. On Jan 8, 1:58 pm, Brendan wrote: > I am trying to download a file within a very large zipfile. I need two > partial downloads of the zipfile. The first to get the file

Re: How to Delete a Cookie?

2009-01-08 Thread tryg . olson
On Jan 8, 1:16 pm, Jose C wrote: > > c["mycook"]["expires"] = 0 > > Set ["expires"] using the following format to any time less than > current (which causes the browser to delete the cookie). > Here's a function I use to return a cookie expiry timestamp, negative > values passed in result in cooki

Re: Replying to list messages

2009-01-08 Thread Paul McNett
Ben Finney wrote: Paul McNett writes: But arguing about this here isn't going to change anything: opinions differ just like tabs/spaces and bottom-post/top-post. In cases like this, one side can simply be wrong :-) Best of luck getting your programs behaving as you want them to! BTW, I agr

Re: "python -3" not working as expected

2009-01-08 Thread Benjamin Peterson
Steve Holden holdenweb.com> writes: > Thorsten Kampe wrote: > > Unfortunately I saw no warnings about print becoming a function in > > Python 3 ("print()"). Where is the problem? > > > I *believe* that's not flagged because 2to3 will fix it automatically. This is correct; there's not much point

Re: why cannot assign to function call

2009-01-08 Thread Mark Wooding
[Steven's message hasn't reached my server, so I'll reply to it here. Sorry if this is confusing.] Aaron Brady wrote: > On Jan 8, 1:45 am, Steven D'Aprano > wrote: > > On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: > > > > > The `they're just objects' model is very simple, but gets tied

Re: Is it ok to type check a boolean argument?

2009-01-08 Thread Carl Banks
On Jan 7, 6:21 pm, Scott David Daniels wrote: > Adal Chiriliuc wrote: > > On Jan 7, 10:15 pm, Bruno Desthuilliers > > wrote: > >> ... I'd either keep the argument as a boolean but rename it "ascending" ... > > > Well, I lied a bit :-p   > > But what if we can't solve it as elegantly, and we n

Re: sftp with no password from python

2009-01-08 Thread Mike Hjorleifsson
On Jan 8, 10:39 am, loial wrote: > Is it possible to use sftp without a password from python? Yes you can use keys you preestablish between the server and client so you dont need passwords, i do this on all my servers then lock off the ability to accept passwords at all, this way no one can dicti

Making a decorator a staticmethod

2009-01-08 Thread Zac Burns
I have a decorator in a class to be used by that class and by inheriting classes ## class C(object): @staticmethod # With this line enabled or disabled usage in either C or D will be broken. To see that D works remember to remove usage in C def decorateTest(func):

  1   2   >