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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
+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,
--
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
--
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
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
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.
[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
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
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
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
[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
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
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
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
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
42 matches
Mail list logo