Re: Unit Testing: a couple of questions

2008-10-28 Thread Antoine De Groote
I'm wondering if don't want your class to look something like this: class myClass(): def __init__(self, data): self.__data = data def getData(self): return self.__data def setData(self, data): self.__data = data For the rest I'll let the experts argue, I

ruby %w equivalent

2006-09-24 Thread Antoine De Groote
Hi everybody, is there a python equivalent for the ruby %w operator? %w{a b c} creates an array with strings a, b, and c in ruby... Thanks a lot Regards, antoine -- http://mail.python.org/mailman/listinfo/python-list

Re: ruby %w equivalent

2006-09-26 Thread Antoine De Groote
Antoine De Groote wrote: Thorsten Kampe wrote: * John Machin (24 Sep 2006 15:32:20 -0700) Antoine De Groote wrote: is there a python equivalent for the ruby %w operator? %w{a b c} creates an array with strings a, b, and c in ruby... | a b c.split() | ['a', 'b', 'c'] ... appears to match

Re: ruby %w equivalent

2006-09-26 Thread Antoine De Groote
Thorsten Kampe wrote: * John Machin (24 Sep 2006 15:32:20 -0700) Antoine De Groote wrote: is there a python equivalent for the ruby %w operator? %w{a b c} creates an array with strings a, b, and c in ruby... | a b c.split() | ['a', 'b', 'c'] ... appears to match your single example

Re: a different question: can you earn a living with *just* python?

2006-09-26 Thread Antoine De Groote
John Salerno wrote: It's a nice thought that a person can earn a living programming with Python, which is fun enough to use just for its own sake. But for someone like me (i.e. no programming experience) it's always a little disheartening to see that most (if not all) job descriptions that

Re: ruby %w equivalent

2006-09-27 Thread Antoine De Groote
Thorsten Kampe wrote: * Antoine De Groote (Tue, 26 Sep 2006 12:06:38 +0200) Thorsten Kampe wrote: * John Machin (24 Sep 2006 15:32:20 -0700) Antoine De Groote wrote: is there a python equivalent for the ruby %w operator? %w{a b c} creates an array with strings a, b, and c in ruby... | a b

retry in exception

2006-09-29 Thread Antoine De Groote
Hi, I hope I don't upset anybody by comparing Python to Ruby (again). Is there something like Ruby's retry keyword in Python? I couldn't find any thing... Regards, antoine -- http://mail.python.org/mailman/listinfo/python-list

builtin regular expressions?

2006-09-30 Thread Antoine De Groote
Hello, Can anybody tell me the reason(s) why regular expressions are not built into Python like it is the case with Ruby and I believe Perl? Like for example in the following Ruby code line = 'some string' case line when /title=(.*)/ puts Title is #$1 when /track=(.*)/ puts

Re: builtin regular expressions?

2006-09-30 Thread Antoine De Groote
Just to get it clear at the beginning, I started this thread. I'm not a newbie (don't get me wrong, I don't see this as an insult whatsoever, after all, you couldn't know, and I appreciate it being so nice to newbies anyway). I'm not an expert either, but I'm quite comfortable with the

Re: builtin regular expressions?

2006-09-30 Thread Antoine De Groote
Jorge Godoy wrote: Antoine De Groote [EMAIL PROTECTED] writes: Just to get it clear at the beginning, I started this thread. I'm not a newbie Sorry :-) I got to this wrong conclusion because of the way I read your message. no problem ;-) maybe my formulation was a bit naive, too

Re: Dive Into Java?

2006-10-09 Thread Antoine De Groote
erikcw wrote: DiveIntoPython.org was the first book I read on python, and I really got a lot out of it. I need to start learning Java (to maintain a project I've inherited), and was wondering if anyone knew of any similar books for Java? Maybe once I know my way around the language, I can

Re: Is a list static when it's a class member?

2006-10-10 Thread Antoine De Groote
glue wrote: I have a class with a list member and the list seems to behave like it's static while other class members don't. The code... class A: name = data = [] def __init__(self, name): self.name = name def append(self, info): self.data.append(info)

Re: How to write Smart Python programs?

2006-10-11 Thread Antoine De Groote
Googling for python is not java may be a good start. Also, here are 2 common C-style smells: Ok, the first Google result (http://dirtsimple.org/2004/12/python-is-not-java.html) says this somewhere: Getters and setters are evil. Evil, evil, I say! Python objects are not Java beans. Do not

Re: How to write Smart Python programs?

2006-10-11 Thread Antoine De Groote
Bruno Desthuilliers wrote: And what does property mean anyway? See above. A property is a computed attribute : you access it like a 'data' attribute, but it really uses getters/setters. The point here is that client code doesn't know nor need to know if it's a plain attribute or a computed

Re: Experiences with Py2Exe

2006-10-11 Thread Antoine De Groote
Isaac Rodriguez wrote: Hi, I am looking for feedback from people that has used or still uses Py2Exe. I love to program in python, and I would like to use it to write support tools for our development team, but I cannot require everyone to install python in their machines, so I was thinking

Re: Experiences with Py2Exe

2006-10-11 Thread Antoine De Groote
Isaac Rodriguez wrote: I did a project with wxPython and py2exe. Just great :-) I also used Inno Setup (http://www.jrsoftware.org/isinfo.php) to create an installer. You should be able to learn/use both in one day. Do you have a specific reason for using Inno Setup and not a Windows

Re: How to write Smart Python programs?

2006-10-12 Thread Antoine De Groote
Antoine De Groote wrote: class C(object): def __init__(self): self.__x = None def getx(self): return self._x def setx(self, value): self._x = value def delx(self): del self._x x = property(getx, setx, delx, I'm the 'x' property.) Altough I'm not the OP, thanks a lot

Re: How to write Smart Python programs?

2006-10-12 Thread Antoine De Groote
Paul Rubin wrote: Antoine De Groote [EMAIL PROTECTED] writes: In the snippet above (taken from the Python doc http://docs.python.org/lib/built-in-funcs.html), self.__x is initialized, but never used. I would appreciate any explanation for this. Looks like a typo, should say self._x . Ok

can't open word document after string replacements

2006-10-24 Thread Antoine De Groote
Hi there, I have a word document containing pictures and text. This documents holds several 'ABCDEF' strings which serve as a placeholder for names. Now I want to replace these occurences with names in a list (members). I open both input and output file in binary mode and do the

Re: can't open word document after string replacements

2006-10-24 Thread Antoine De Groote
Thank you all for your comments. I ended up saving the word document in XML and then using (a slightly modified version of) my script of the OP. For those interested, there was also a problem with encodings. Regards, antoine -- http://mail.python.org/mailman/listinfo/python-list

Re: can't open word document after string replacements

2006-10-24 Thread Antoine De Groote
Bruno Desthuilliers wrote: Antoine De Groote wrote: Hi there, I have a word document containing pictures and text. This documents holds several 'ABCDEF' strings which serve as a placeholder for names. Now I want to replace these occurences with names in a list (members). Do you know

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Antoine De Groote
frankie_85 wrote: Hi everyone, I just made a simple code which is part of my assignment but I can't figure it out what's wrong with it. (always give me error messages) What the code basically does is: a function that takes one floating point number x as its argument and returns (the

shutil: permission denied errors on windows

2006-11-06 Thread Antoine De Groote
Google tells quite some things about it, but none of them are satisfactory. I'm on Windows, and shutil operations (e.g. move, copy) throw [Errno 13] Permission denied all the time, for the source files. It seems that this is the case for all my files. But what I don't understand is that

Re: shutil: permission denied errors on windows

2006-11-07 Thread Antoine De Groote
function a lot and never have problem. I suggest that you write a no brainer standalone test code and if it still fails there, then you have a problem with your installation. Antoine De Groote wrote: Google tells quite some things about it, but none of them are satisfactory. I'm on Windows

Re: shutil: permission denied errors on windows

2006-11-07 Thread Antoine De Groote
folder? Not individual file? Antoine De Groote wrote: Yes it's strange, I never had the problem before, either. It seems now to be only the case for folders. A very simple shutil.copy('a', 'b') already fails with the error message. I reinstalled Python, but that didn't change anything

Re: shutil: permission denied errors on windows

2006-11-07 Thread Antoine De Groote
use the copy function a lot and never have problem. I suggest that you write a no brainer standalone test code and if it still fails there, then you have a problem with your installation. Antoine De Groote wrote: Google tells quite some things about it, but none of them are satisfactory

for x in... x remains global

2006-11-08 Thread Antoine De Groote
for x in range(3): pass After this statement is executed x is global variable. This seems very unnatural to me and caused me 3 three days of debugging because I was unintentionally using x further down in my program (typo). I would have thought that variables like this are local to the for

Re: synching with os.walk()

2006-11-24 Thread Antoine De Groote
Andre Meyer wrote: Hi all os.walk() is a nice generator for performing actions on all files in a directory and subdirectories. However, how can one use os.walk() for walking through two hierarchies at once? I want to synchronise two directories (just backup for now), but cannot see how I

Re: why would anyone use python when java is there?

2006-11-29 Thread Antoine De Groote
+1 Éric Daigneault wrote: wtf a reasonable question... But before I run circle yelling the trolls are here, the trolls are here I got one for you... why would anyone use java when python is there?? ;-) .^_^. Eric :D, --

looking for Java final/Ruby freeze functionality in Python

2007-03-04 Thread Antoine De Groote
Hello, I've been googling for quite a while now but can't find anything about a function/keyword to make a list (or something else) immutable. Could anybody point me to docs about this matter or give me a reason why this (apparently) doesn't exist in Python? Kind regards, antoine --

Re: looking for Java final/Ruby freeze functionality in Python

2007-03-04 Thread Antoine De Groote
yes thanks, that is quite what I was looking for. Arnaud Delobelle wrote: On Mar 4, 7:38 pm, Antoine De Groote [EMAIL PROTECTED] wrote: Hello, I've been googling for quite a while now but can't find anything about a function/keyword to make a list (or something else) immutable. Could

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
try this: import this and look at the 15th line... I agree that for newcomers to Python, the class method definition might seem strange. I certainly had problems with it when starting with Python, coming from Java. But in the meantime it feels right. I don't know if it is because I'm used to

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Allowing $ as a substitute for self wouldn't require this new syntax. class C: def method($, arg): $.value = arg I'm strongly against this. This looks ugly and reminds me of Perl and Ruby. (I don't have anything against these languages, but there's a reason I use Python). Russ P.

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
[EMAIL PROTECTED] wrote: Antoine De Groote: Allowing $ as a substitute for self wouldn't require this new syntax. class C: def method($, arg): $.value = arg I think this (that is just sugar) may be a little better: class C: def method($, arg): $value = arg

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Aaron Brady wrote: On Dec 5, 8:21 pm, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Russ P. wrote: On Dec 6, 1:02 am, Antoine De Groote [EMAIL PROTECTED] wrote: Allowing $ as a substitute for self wouldn't require this new syntax. class C: def method($, arg): $.value = arg I'm strongly against this. This looks ugly and reminds me of Perl and Ruby. (I don't

Re: Guido's new method definition idea

2008-12-07 Thread Antoine De Groote
Bruno Desthuilliers wrote: Daniel Fetchinson a écrit : (snip) It doesn't add anything but makes something that exists a bit clearer Err... I fail to see how magically transforming def self.foo(...) into def foo(self, ...) makes anything clearer about what really happens and how Python's

Re: Guido's new method definition idea

2008-12-09 Thread Antoine De Groote
[EMAIL PROTECTED] wrote: On Dec 6, 4:15 pm, Carl Banks [EMAIL PROTECTED] wrote: [...] This brings up another question, what would one use when referencing method names inside the class definition?: class C: def self.method(arg): self.value = arg def

primera

2008-12-09 Thread Antoine De Groote
zalli, du spills jo net mat am volley oder? mengs de du kinns dann mat mengem auto an den MCM an eventuell op sandweiler fueren? well méindes ass volley, densdes fussball, an mettwochs ass schon hellejen owend... nuecht antoine -- http://mail.python.org/mailman/listinfo/python-list

Re: primera

2008-12-09 Thread Antoine De Groote
Oops, sorry, this message was not intended for the group. Apologies Antoine De Groote wrote: zalli, du spills jo net mat am volley oder? mengs de du kinns dann mat mengem auto an den MCM an eventuell op sandweiler fueren? well méindes ass volley, densdes fussball, an mettwochs ass schon

pylab.ylabel: put label on the other side

2008-12-15 Thread Antoine De Groote
Hey everybody, I'm plotting graphs with 2 y-axes, which I created using ax_left = pylab.subplot(111) ax_right = pylab.twinx() Then I switch the sides of the ticks: ax_left.yaxis.tick_right() ax_right.yaxis.tick_left() This works, the ticks are on the opposite sides (left axis ticks are on the

Re: Clearing the keyboard buffer (wxPython)

2009-02-11 Thread Antoine De Groote
yes, the server seems to have been down :-( MarcusD wrote: Whow. Thanks for the fast and comprehensive answer. To be honest I would have posted to wxpython.org but the server seems to be down for the last couple of days. I'll check this wx.Yield thing that I never heard of. And let's see