Ilias Lazaridis a écrit :
bruno modulix wrote:
Ilias Lazaridis wrote:
(snip)
impressive.
but things are much simpler.
Could you be more prolific ?
Please explain the word "prolific".
Say more
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Shannon a écrit :
bruno modulix wrote:
administrata wrote:
I wrote this, It's a bit lame though
(snip code - see other answers in this thread)
raw_input("\n\\t\t\t- The End -")
Why on earth are you using raw_input() here ?
This is a fairly common idiom, on Windows at least.
Windows only, I
Gary Nutbeam a écrit :
I've noticed that the Perl camp has a very nice web/database environment
called Maypole. Ruby has the Rails environment which on the surface seems
similar to Maypole. I can't find anything in Python that ties a database
to a web interface anywhere near as well as Ruby on Rail
andy2o a écrit :
Hi all,
Sorry if the post's title is confusing... I'll explain:
I have a class, called A say, and N>1 subclasses of A, called
A1, A2, A3, ..., AN say.
Instances of each subclass can sensibly be joined together with other
instances of the *same subclass*. The syntax of the join me
flamesrock a écrit :
Hi,
Basically, what I'm trying to do is store large amounts of data in a
list or dictionary and then convert that to a custom formatted xml
file.
My list looks roughly like this:
(d[],r[c[d[p[],p[R,C,I)
My question is, would it be faster to use a dictionary if the elements
news.sydney.pipenetworks.com a Ãcrit :
I looked for a new language for my hobby programming. I used to use
Turbo Pascal for 10 years and then C++ for 6 years. A couple of
weeks ago, I narrowed my decision to C#, Ruby, and Python. At the
moment, I want to go with Python, but you can definitely s
Valentino Volonghi aka Dialtone a écrit :
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
It is actually. Ruby's syntax is mostly consistent and coherent, and
there is much less special cases than in Python.
I'd be glad to know which special cases are you referring to.
A f
Martin Franklin a écrit :
Tim Daneliuk wrote:
In-Reply-To: <[EMAIL PROTECTED]>
(snip)
Of course we users will complain about removals, but we'll knuckle
down and take our medicine eventually ;-)
Except that in this case, removal will also complicate code in some
cases. Consider this fragment of Tk
Simon Percivall a écrit :
Start the attribute name with "_" and don't document it. If clients
mess with it, they're to blame.
The problem is that client code must *define* this attribute when
subclassing BaseClass - and that's (well, in most case that should be)
the only place where they have to
Bengt Richter a écrit :
On Tue, 15 Mar 2005 20:21:19 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:
Hi
How can I make a *class* attribute read-only ?
(snip)
Does this help, or did I misunderstand?
>>> class Base(object):
... class __metaclass__(type):
... def __setattr__(cls, name,
Tanteauguri a écrit :
Hi List, is there in python a variable variable like in PHP ($$var)?
Hopefully, no.
See other answers in that thread for pythonic idioms.
--
http://mail.python.org/mailman/listinfo/python-list
fraca7 a écrit :
Michael Hoffman wrote:
Enjoy ;)
That's not the exact word that first came to my mind :)
--
http://mail.python.org/mailman/listinfo/python-list
Ron a écrit :
(snip)
def dfv( arg = value):
return arg
>
>>> def dfv( arg = value):
... return arg
...
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'value' is not defined
And sorry, but -1 for using exec here.
--
http://mail.python.org/mailman/listinfo
Ron a écrit :
On 21 Mar 2005 22:37:42 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
Mappings like that:
((x,y),z) -> x+y-z
((x,y=0),z) -> None
should be valid actions too.
What is the audience thinking about that?
I think that there's too much implied, and that in the long run it,
if we k
Diez B. Roggisch a écrit :
(snip)
You are right, but for lambda in its current limited form short, named
functions are a good replacement.
-inf on this !-)
--
http://mail.python.org/mailman/listinfo/python-list
Erwan VITIERE a écrit :
Hello,
I want to convert the contents of a string into name of variable.
For example:
var1="toto"
...
toto=5
print toto
exec "toto = 5"
print toto
But I would use another solution if possible.
--
http://mail.python.org/mailman/listinfo/python-list
Tian a écrit :
I want to create a object directory called Context in my program, which
is based on a dict to save and retrieve values/objects by string-type
name. I have the definition like this:
utils.py
global sysctx
class Context:
def __init__(self):
def set(self, na
Tian a écrit :
I googled about how to write singleton in python, but even if I use
Singleton, in which module's namespace should I keep the instance of
this singleton?
You found the doc but I'm afraid you did not grasp the concept.
You don't have to 'keep the instance' anywhere - it's the job of t
'@'.join([..join(['fred','dixon']),..join(['gmail','com'])]) a écrit :
noob warning:
what is so wonderful about the NEW class over the old ?
A whole lot of things. But the main thing to know is that old-style
classes are deprecated, and will disappear in the future.
--
http://mail.python.org/mailm
[EMAIL PROTECTED] a écrit :
Reading the language tututorial would help you a lot :(
=== what is the difference between pc and pc()?
pc = getToolByName() - returnes a refference to a method
Nope.
pc is a refference to a method,
Nope.
pc is not 'a reference to a method', it's a callable object
Jim a écrit :
Hello,
I am trying to debug a Python SOAP
What about unit tests ?
--
http://mail.python.org/mailman/listinfo/python-list
Mothra a écrit :
(snip)
I checked out the above link (thanks!!) I need to look deeper
at the docs for creating a "module"
Well, start with wrting the code - you'll take care of
how-to-distribute-it later.
Thanks all for the responses!!
You're welcome.
--
http://mail.python.org/mailman/listinfo/p
Philippe C. Martin a écrit :
Hi,
I have a python script I wish to call from various browsers (IE; Mozilla,
Firefox ..) on Windows & Linux.
What do you mean ? Is that a client-side or server-side script ?
I read that IE had the capability to embedd Python scripts,
Where ?
--
http://mail.python.o
Mage a écrit :
I can tell:
- python is more *pythonic* than php
Keyboard !-)
--
http://mail.python.org/mailman/listinfo/python-list
Lad a trollé :
Is anyone capable of providing Python advantages over PHP if there are
any?
Why don't you check by yourself ?
--
http://mail.python.org/mailman/listinfo/python-list
monkey a écrit :
Read through python site for programming tool, really plenty of choices :-)
(For c++, I just can't breath with very very limited choices)
Tried Spe, it come with wxGlade built-in very nice(is Spe still actively
develop?). But seem that Boa Constructor and PyDev(the plug-in for Ecli
Matthias Kaeppler a écrit :
> Hi,
>
> sorry for my ignorance, but after reading the Python tutorial on
> python.org, I'm sort of, well surprised about the lack of OOP
> capabilities in python.
I beg your pardon ???
> Honestly, I don't even see the point at all of
> how OO actually works in P
Matthias Kaeppler a écrit :
(snip)
> I stumbled over this paragraph in "Python is not Java", can anyone
> elaborate on it:
>
> "In Java, you have to use getters and setters because using public
> fields gives you no opportunity to go back and change your mind later to
> using getters and sette
Edgar A. Rodriguez a écrit :
> Hi everybody,
>
> Im newbie to Python (I found it three weeks ago) , in fact Im newbie to
> programming. I'm being reading and training with the language, but I
> still wondering about what Classes are used to.
A class is the definition of a type of object, and let
Mr.Rech a écrit :
(snip)
>
> My class's init method takes a list of lists as input argument and I'd
> like to create
> several attributes each one referencing one item of the passed list.
>
> Easy-of-use arguments
> has led me to call these attributes as x0, x1, x2 and so on.
This is a very wro
xceptions
hierarchy in the fine manual - you'll notice some exception you perhaps
don't want to catch or at least don't want to display (hint: look for
the warnings hierarchy and for SysExit...)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] a écrit :
> Hi,
> I want to generate all non-empty substrings of a string of length >=2.
> Also,
> each substring is to be paired with 'string - substring' part and vice
> versa.
> Thus, ['abc'] gives me [['a', 'bc'], ['bc', 'a'], ['ab', 'c'], ['c',
> 'ab'], ['b', 'ac'], ['ac',
nate a écrit :
> I'd like a module than I'm importing to be able to use objects in the
> global namespace into which it's been imported. is there a way to do
> that?
It's a very bad idea. Instead of asking how to implement a bad solution,
tell us about the real problem.
NB : FWIW, the clean sol
olution. I also wonder how (if...) you intend to address
concurrent R/W access and transactions...
A few observations and questions :
- you should avoid tests on concrete types as much as possible - at
least use isinstance
- tuples are immutable containers. What about them ?
- what about multiple
Dennis Lee Bieber wrote:
> On Wed, 12 Jul 2006 02:48:44 +0200, Bruno Desthuilliers
> <[EMAIL PROTECTED]> declaimed the following in
> comp.lang.python:
>
>
>>nate a écrit :
>>
>>>I'd like a module than I'm importing to be able to use obj
ted 'tmp' to be part of the API, then you're responsible for
the bad naming. If you didn't, then you're responsible for breaking the
encapsulation - FWIW, following the convention (single leading
underscore) could have make it clearer to you. In both cases, you
happily used a bad name in 27 KLOC - so you really had a lot of time and
occasions to notice something wrong with this.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
times).
Well, actually one can do MVC without OO. It's more a matter of
separating concerns. Now I agree that it's not always obvious to know
for sure which part should be responsible for what...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
t; Is there some way of using Shelve like this, or should I just move to a
> more typical database solution?
You may want to try with the ZODB. Or with SQLite.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]
s around instead of having a big global datastructure.
Classes are handy when many functions needs to share state (work on a
same dataset), but there's no way to have one call the other and pass it
the dataset.
> but it's hard to get out of that mentality.
Seems you're on the right
raise
>>a exception.
>
>
> In general, not doable. The assignment operator is not overloadable.
>
> Only if you use assignments of the form
>
> a.foo = bar
>
> you could overwrite the __setattribute__-method
(Or use a Descriptor)
> to achieve what you want.
lopper problem
- put closely related symbols in a same module
- put closely related modules in a same package
> a single import and you are able to use
> all the classes?
Python as packages:
http://docs.python.org/tut/node8.html#SECTION00840
> Is there anything wr
d attributes ?
> 90% of public APIs in almost all
> languages are methods or functions.
"allmost all languages" lacks computed attributes.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
on and
> never changed. Stuff happens.
>
> Maybe you didn't know about the underscore way to mark private entities.
> Maybe this doesn't work as I think it does
If you think that single leading underscores have a special meaning for
the compiler/interpreter, then you got
;_' *is* API.
>>
>>Right, and what if I want to change a private API to a public one. How
>>does that solve my naming issues.
>
>
> Then you have to change all references to that private attribute.
Not even - cf my answer on this point.
--
bruno desthuill
tribute style would break all client code. Having the two
schemes coexisting would make for bloated APIs and
too-many-ways-to-do-it. So we live with this until Py3K. And none of
these considerations contradicts the point that there's no more use for
javaish getters/setters in Python, nor that javaish getters/setters are
not pythonic.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
>>>Lousy Attribute Name:
>>> self.tmp
>>>
>>>Accessors:
>>> set_temporary_buffer
>>> get_temporary_buffer
>>>
>>
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
>>>Marc 'BlackJack' Rintsch wrote:
>>>
>>>
>>>>In <[EMAIL PROTECTED]>, mystilleef
>>>>wrote:
>>>>
>>>>
>>&
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>(snip)
>>
>>>Python doesn't have any philosophy with regards to naming identifiers.
>>
>>Yes it does.
>
>
> No it doesn't.
>
>
>>>>But they
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
>
>
>>Do you mean the code effectively doing these operations is in the gui ?
>>If yes, it would be better to factor it out IMHO.
>
> The GUI has to be able to acces the data object, otherwise how does the
>
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
(snip)
>>>>
>>>>>I have used that name in
>>>>>dozens of places spanning over 27000 LOC.
>>>>
>>>>Too bad for you.
>>>
>>&g
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
>
>
>>Separating operations on data (model/controler) from GUI code (view).
>>The controler(s) have a reference on the model. The views have a
>>reference on the controler(s), and call on the controller to get data
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>>>You choose a bad name for a *public* symbol.
>>>
>>>
>>>My point exactly! It doesn't solve my problem!
>>
>>What do you hope ? Something that cures cancer ? Please enlighten us an
ia "properties".
If you need to control anything - else just use a plain attribute.
> That's the pythonic way to implement
> accessors and mutators
>
> I guess people who've done medium to large scale programming in Python
> already know this.
Do 50
, create the
'singleton' in it's module (at the module's to level), then import the
module.
> Trying hard, I am not even being able to figure out how to create an
> object in one module and refer the same in another one. "import"
> created a new object, as I trie
t Python
> sucks. Neither those it suggest that Java or other OO languages are
> better. I asked because I sincerely wanted to know the Pythonic way
> handling issues like that.
Mark as implementation what is obviously implementation (be it callable
or not), mark as API what is obviously
st the code !-)
> Pardon me if I am too novice but I could not make out the meaning of
> this phrase from your reply:
>
> "(at the module's to level)"
Pardon me if I am too bad typist to avoid a typo on such a simple word
as 'top' !-)
And, please, don
utomatically converts \\ to / when
> the script runs on Linux? What is the best way to deal with this
> situation?
os.path.join('log', 'log.txt')
os.path.join('ctl', 'table.ctl')
Or look for the 'path' module
http://www.jorendorff.com/articles/
Mike Kent wrote:
(snip - about Jason Orendorff's path module)
> Of course, using the '/' operator in this manner makes some people's
> heads explode.
+1 QOTW
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w i
Simon Brunning a écrit :
> On 13 Jul 2006 05:45:21 -0700, John Henry <[EMAIL PROTECTED]> wrote:
>
>>
>> Simon Brunning wrote:
>> >
>> > min(logflags)
>> >
>>
>> !!!
>
>
> Be aware that not only is this an outrageous misuse of min(),
+1 QOTW
Ho, my, I've already proposed another one today :(
--
ame2)s",
"what about %(name2)s for %(name1)s ?",
"Now we only deal with %(name1)s",
]
data = {'name1' : 'parrot', 'name2': 'dead'}
for tpl in tpls:
print tpl % data
As you can see, the keyword flavour doesn't care about positions nor
repetitions.
You may also want to look at more featured templating solutions like
empy, cheetah, etc...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
ct):
def __init__(self):
self._c1=123.0
self._c2=134.0
def fun(self, temp):
return temp + self._c1 - self._c2
def fun1(self, temp):
return temp - self._c1
foo = Foo()
foo.fun(42)
foo.fun1(42)
--
bruno desthuilliers
python -c "print '@'.join([
o focus on design. Let me reiterate, I'm not obsessing over language
> semantics, I just need practical, not religious, solutions for my
> problem domain.
Using properties instead of explicit getters/setters is pragmatism, not
religion. Using the default get/set mechanism when th
f objects.
Behaviour is how a given object reacts to a given message. *Nothing* in
this implies the notions of attributes or methods. Attributes and
methods are implementation details of the concepts of state and
behaviour, and - while this is a common implementation of OO concepts -
the choice to use non-callable attributes as representing the state
and callable ones as representing behaviour is totally
implementation-dependant.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
> mystilleef wrote:
(snip)
>>Here are the lessons I've learned (the hard way).
>>
>>1) Make all attributes of a class private or protected.
>
>
> Unless they are obviously part of the implementation
s/implementation/interface/
why not use some more dot-magic to implement
> privates?
What for ? What makes you think we need language-inforced access
restriction ?
(snip)
> BTW, I am aware of Python's name mangling feature.
Name mangling is mainly here to protect from accidental overridding. The
convention for
ings, integer 0, float 0.0 and None are all false. This is part
of the language specs.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
ions*. An expression is
boolean if it's result can be coerced to a boolean value, ie fed to the
bool type's constructor. So your example is wrong wrt/ if statements -
it should read:
empty_list = []
bool(empty_list) is False
=> True
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
if all you are doing is removing
> all the items in the list, this is definitely better:
>
> lst = []
Not if there are other names bound to the same list. You are only
rebinding this name, which does *not* empty the list object. The correct
solution here is
del lst[:]
which will remove all cont
e/readable/
Python is much more readable than Java because it's *less* verbose than
Java.
> BTW, lst = [] was not what
> I was interested in :-)
Nor is it the correct functional equivalent of your code snippet.
> I was asking whether it was better style to
> use len() or not
ustomization.html
> If Python had been designed with these types in
> mind, I'm not sure "empty list is false" would have been part of the
> language, let alone recommend practice.
FWIW, this magic method already existed in 1.5.2 :
http://www.python.org/doc/1.5.2p2/ref/customization.html
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
it's obvious the expression is a Boolean.
The fact that the expression is used in the context of a if statement is
clearly enough to denote a boolean expression. Explicitly testing
against a boolean is uselessly redundant - and doesn't change anything,
since it's always a bool
arsl89 wrote:
> hy gys i m wanting python programming language.
> plz snd me the backup of python
>
Welcome to my bozo-list.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]&
Carl Banks wrote:
> Bruno Desthuilliers wrote:
>
>>Carl Banks wrote:
>>
>>>Patrick Maupin wrote:
>>>
>>>
>>>>PTY wrote:
>>>>
>>>>
>>>>
>>>>>It looks like there are two crowds, terse and
ild
Or how to *not* address the real problem...
Boris, using a generator may be a pretty good idea, but *not* as a way
to solve a problem that happens to be a FAQ !-)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) f
Steve Holden wrote:
> Bruno Desthuilliers wrote:
>
>> arsl89 wrote:
>>
>>> hy gys i m wanting python programming language.
>>> plz snd me the backup of python
>>>
>>
>> Welcome to my bozo-list.
>>
> Note how the OP even abbre
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
>>>Gerhard Fiedler wrote:
>>>
>>>
>>>>On 2006-07-15 06:55:14, mystilleef wrote:
>>>>
>>>>
>>>>
>>>>>In very well
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>Please don't top-post
>>
>>>On State and Behavior:
>>>
>>>To understand objects in terms of state and behavior you need to
>>>absolve yourself from impl
Carl Banks wrote:
> Bruno Desthuilliers wrote:
>
>>Carl Banks wrote:
>>
>>>Iterables, lists, arrays, and whatever else have overlapping uses, but
>>>bool(obj) behaves differently for different types,
>>
>>bool(obj) will mainly look for __len__(),
Volker Grabsch a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> schrieb:
>
>>PTY wrote:
>>
>>>I was asking whether it was better style to
>>>use len() or not.
>>
>>FWIW, it's also more generic (you could have an object supporting
&g
Volker Grabsch a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> schrieb:
>
>>Carl Banks wrote:
>>
>>>Bruno Desthuilliers wrote:
>>>
>>>I'm well aware of Python's semantics, and it's irrelvant to my
>>>argument.
>
&g
Boris Borcic a écrit :
> Hello Bruno,
>
> Bruno Desthuilliers wrote:
>
>> Boris Borcic wrote:
>>
>>>> Do you have any ideas?
>>>
>>>
>>> you could use a recursive generator, like
>>>
>>> def genAllChildren(sel
Nick Vatamaniuc a écrit :
(please don't top-post - corrected)
>
> Bruno Desthuilliers wrote:
>
(snip)
>>A few observations and questions :
>>- you should avoid tests on concrete types as much as possible - at
>>least use isinstance
>
> Good point about
Carl Banks a écrit :
> Bruno Desthuilliers wrote:
>
>>There are less risk of a typo with "if a:" than with "if len(a) > 0".
>
>
> So, it's more important to protect against typos than subtle bugs?
>
People making smart points are really ann
> have been, planned in future releases of Python.
>
> Would love to listen to others.
I've never had a use case for this kind of feature in the past seven years.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.spli
Kay Schluehr wrote:
> Bruno Desthuilliers wrote:
>
>>Sanjay wrote:
>>
>>>Hi Alex,
>>>
>>>Thanks for the input.
>>>
>>>Being new to Python, and after having selected Python in comparison to
>>>ruby (Turbogears vs Rails) ,
n ["%s%s%s%s" % (a, b, c, d) \
for a in r \
for b in r \
for c in r \
for d in r]
But there's certainly better solutions...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('
es is
> when you want to separate your GUI code from the rest of your logic.
What the ... is GUI code doing in a domain object ???
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
edge of the technologies involved,
> is that assign_mapper does some magic only on Person class, and things
> work. But after inheritence, it is not working.
Anyway, there are other ways to reuse implementation, like
composition/delegation. You may want to have a look at
__getattr
ressor, then combuster, then turbine
but I don't know if it makes any sens wrt/ your app !-)
Now there can of course be a lot of other solutions...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
>
>>Boris Borcic a écrit :
>>
>>>Hello Bruno,
>>>
>>>Bruno Desthuilliers wrote:
>>>
>>>
>>>>Boris Borcic wrote:
>>>>
>>>>
>>>>&g
Steve Holden wrote:
> Bruno Desthuilliers wrote:
>
>> Boris Borcic a écrit :
>>
>>> Hello Bruno,
>>>
>>> Bruno Desthuilliers wrote:
>
> [...]
>
>>>> Or how to *not* address the real problem...
>>>>
>>>&
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
(snip)
>>>>>
>>>>>Of course using setters for the sake of just using them is pointless.
>>>>
>>>>Indeed.
>>>>
>>>>
>>>>
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
(snip)
>>>>>For example, a third party randomly changing
>>>>>is_active, (which Python lets you do freely and easily)
>>>>
>>>>Unless you make it a
[EMAIL PROTECTED] a écrit :
>>Even if you need to do something during attachment of components it is
>>more Pythonic to use properties. So you will write a method in your
>>class name something like _set_up(self,upstream_obj) an _get_up(self).
>> And then at the end of your class put up=property(_
Tobias Brox a écrit :
> [Jason]
>
>>Nothing like being forced to write getters and setters in C++/Java
>>before you feel like shooting your source code. Please don't bring
>>this code-rage into Python.
>
>
> "Code generation" springs into my mind. IMO, if the code needs to be
> generated, the
_dict__[name] = value
Make it:
object.__setattr__(self, name, value)
Your approach will lead to strange results if you mix it with properties
or other descriptors...
> class C1(C):
>
> standard_attributes = ['a1', 'a2']
DRY viol
>
> I can't believe I always used version control systems for that use case if
> it's that easily solved with partial classes.
Collaborative work is only one of the needs solved by VCS.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1
danielx wrote:
> Bruno Desthuilliers wrote:
>
>>danielx wrote:
(snip)
>>>which gets me thinking again about
>>>the stuff I self-censored. Since the dot syntax does something special
>>>and unexpected in my case,
>>
>>"unexpected" ? Di
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Bruno Desthuilliers
> wrote:
>
>
>>Lawrence D'Oliveiro wrote:
>>
>>>In message <[EMAIL PROTECTED]>, Bob Greschke
>>>wrote:
>>>
>>>
>>>
>>
mystilleef wrote:
> Bruno Desthuilliers wrote:
>
>>mystilleef wrote:
>>
>>>Bruno Desthuilliers wrote:
>>>
>>>
>>>>mystilleef wrote:
>>
>>(snip)
>>
>>>>>>>Of course using setters for the sake of just us
101 - 200 of 3705 matches
Mail list logo