Stephen Hansen a écrit :
On 6/10/10 8:35 AM, Bruno Desthuilliers wrote:
Stephen Hansen (L/P) a écrit :
On 6/10/10 7:14 AM, Victor Subervi wrote:
(snip)
+1 for "absolutely worst framed question of the day" :)
IMHO you're wasting your time. Some guys never learn, and I gue
Stephen Hansen (L/P) a écrit :
On 6/10/10 7:14 AM, Victor Subervi wrote:
(snip)
+1 for "absolutely worst framed question of the day" :)
IMHO you're wasting your time. Some guys never learn, and I guess we do
have a world-class all-times champion here.
--
http://mail.python.org/mailman/li
Nick Keighley a écrit :
On 9 June, 13:50, Bruno Desthuilliers
(snip)
Note that the lambda trick you used is very idiomatic - functool.partial
being newer and probably not as used - so one could argue that the most
common way is also the most "elegant" !-)
I'm somewhat newbi
Nick Keighley a écrit :
On 9 June, 10:35, Bruno Desthuilliers wrote:
Nick Keighley a crit :
I'm trapping mouse clicks using
canvas.bind("", mouse_clik_event)
def mouse_clik_event (event) :
stuff
What mouse_clik_event does is modify some data and trigger a redraw.
Is t
Nick Keighley a écrit :
Hi,
If this is the wrong place for Tkinter in python please direct me
elsewhere!
I'm trapping mouse clicks using
canvas.bind("", mouse_clik_event)
def mouse_clik_event (event) :
stuff
What mouse_clik_event does is modify some data and trigger a redraw.
Is there a
ch1zra a écrit :
On Jun 8, 10:59 am, Bryan wrote:
Python doesn't have one global namespace. Each module (file) has its
own namespace, which is a Python dict, and 'global' means defined in
the containing module's dict. Put the import:
from reportlab.pdfgen import canvas
in the mkTable.py fil
pyDev a écrit :
Hello,
I would like to let the community know that there is a new web-based
forum for Python enthusiasts over at PythonForum.org (http://
pythonforum.org).
YetAnotherUselessWebForum :(
Web-based forums is a preferred method by Python
newcomers to get help
Oh yeah ? Chapter
mouadino a écrit :
Hello
and thanx for your answer it's was very helpful
but just to clear some thinks :
There's no such thing as a "private" attribute in Python. The
name-mangling mechanism invoked by "__name" is really meant to avoid
accidental redefinition of the attribute in a derived clas
Simon Brunning a écrit :
On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote:
Just wondering if there is a problem with mixing a dictionary into a class like
this. Everything seems to work as I would expect.
No problem at all AFAIC.
OP didn't show up on c.l.py, so too bad you snipped the re
Haulyn Jason a écrit :
Hi, all:
I am a Java programmer, now I am working on a Python program. At the
moment, I need to store some data from user's input, no database, no
xml, no txt(we can not make users open the data file by vim or other
text editor).
Any suggestions or reference url? Is t
Jean-Michel Pichavant a écrit :
chen zeguang wrote:
code is in the end.
I want to print different number when pressing different button.
Yet the program outputs 8 no matter which button is pressed.
I guess it's because the callback function is not established untill
the button is pressed, and i
Chris Rebert a écrit :
(snip)
Here is how I would rewrite your example:
class Shape(object):
def __init__(self, x=0, y=0):
self.x = x
self.y = y
@property
def location(self):
return (self.x, self.y)
@location.setter
def location(self, val):
se
Richard Lamboj a écrit :
Hello,
i want to inherit from a data type. How can i do this?
Hmmm, let's see... Could it be possible that it's documented somewhere ?
Like, in the FineManual(tm) ?-)
http://docs.python.org/tutorial/classes.html#inheritance
Can anyone explain more
abou this? How k
Ulrich Eckhardt a écrit :
Hi!
I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4),
(5,6). I can of course roll my own, but I was wondering if there was
already some existing library function that already does this.
>>> l = range(10)
>>> for x, y in zip(l[::2], l[1::2]):
...
Samuel Williams a écrit :
Dear Friends,
Is Python a functional programming language?
Depends on your definition of "functional programming language", but
well, not really. It's mostly an imperative, object-oriented (but not
pure-object) language. It has some restricted support for some
func
mouadino a écrit :
i have a problem here :
i want to make a plugin architecture using abstract base class , this
is my base class :
# -*- coding: utf-8 -*-
import abc
class BASE_Connector:
"""
Mount point for plugins which refer to actions that can be
performed.
Plugins implemen
TomF a écrit :
On 2010-05-04 07:11:08 -0700, alex23 said:
(snip)
(I also think there's value to be gained in studying _bad_ code,
too...)
True, although whether that's time well spent is another question.
The more bad code (mine or not) I have to maintain (or even just read
and understand
Alf P. Steinbach a écrit :
(snip)
Re efficiency it seems to be a complete non-issue, but correctness is
much more important: is there any way that the config details can be
(inadvertently) changed while the build is going on?
+1
--
http://mail.python.org/mailman/listinfo/python-list
TomF a écrit :
I'm interested in improving my python design by studying a large,
well-designed codebase. Someone (not a python programmer) suggested
Django. I realize that Django is popular, but can someone comment on
whether its code is well-designed and worth studying?
Carl makes some v
GZ a écrit :
(snip)
Ah, this totally works. The key is to use the staticmethod function.
staticmethod is not a function, it's a class.
Another question: I am not sure how staticmethod works internally. And
the python doc does not seem to say. What does it do?
It's easy to figure this out on
Anton Shishkov a écrit :
Hi, I can't figure out how can I change the variable type in function.
In C I could do that easily by changing pointer.
(snip)
Others already answered on this. Now, the real question is : why to you
want to do such a thing ?
Of one the most common use case for this
luca72 a écrit :
i get a string from a web server and i save it in to a file, that i
open the file and i read the string:
the string looks like :
http://lhti.gs/JKBTYD
after the read i use webbrowser open (sting), but i get the error
because at the end of the string are added '%0D%0A',
Python 2
Bryan a écrit :
Bruno Desthuilliers wrote:
Nope. I want to keep all my settings parsed, my librairies loaded, all
my connections opened etc. That is, all the time consuming stuff at app
startup - which, with PHP, mostly happens for each and every request.
O.K. I wasn't clear on your obje
Bryan a écrit :
I think I see what you mean
Err...
-- correct me if I'm wrong:
You are, sorry !-)
You want to
keep complex application data structures around between requests.
Nope. I want to keep all my settings parsed, my librairies loaded, all
my connections opened etc. That is, al
Adam Tauno Williams a écrit :
On Mon, 2010-04-19 at 15:15 +0200, Bruno Desthuilliers wrote:
Gilles Ganault a écrit :
On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
wrote:
The PHP execution model (mostly based on CGI FWIW) tends to be a bit
unpractical for non-trivial applications
Bryan a écrit :
Bruno Desthuilliers wrote:
Gilles Ganault a écrit :
Apart from the ease of having the application run at all times, I'd be
curious to read about an application that was written in PHP and then
a long-running process and see if performance improved.
I'm not sure the
eb303 a écrit :
On Apr 19, 2:20 pm, AlienBaby wrote:
Hi,
just a quick one,
Is it possible to achieve a default value in a list comprehension
where the if-clause is false?
Ie, something similar to:
[ a for a in b if something(a) else 'default' ]
the idea being that, rather than skip a value
Gilles Ganault a écrit :
On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
wrote:
The PHP execution model (mostly based on CGI FWIW) tends to be a bit
unpractical for non-trivial applications since you have to rebuild the
whole world for each and any incoming request, while with a long
J a écrit :
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
So why the None? Is this because what's
Gilles Ganault a écrit :
So it looks like, unlike PHP, the prefered solution in Python is to
build a complete application as a long-running process, and either use
its embedded web server or configure a stand-alone web server to act
as reverse proxy using either FastCGI or WSGI to connect the two
john maclean a écrit :
Can one use the setUp block to store variables so that they can be
used elsewhere in unit tests? I'm thinking that it's better to have
variables created in another script and have it imported from within
the unit test
???
#!/usr/bin/env python
'''create knowledge base
gerardob a écrit :
I have a problem using Pickle inside a class object.
The following code works:
m2 = markov_model.MarkovModel()
m2 = pickle.load(open("prueba", 'rb'))
Given the second line, the first is totally useless.
print m2.n
However, if I create the following method inside markov_
Aahz a écrit :
In article , kj wrote:
What's the word on using "classes as namespaces"? E.g.
class _cfg(object):
spam = 1
jambon = 3
huevos = 2
breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)
There is one gotcha associated with using classes as namespaces: you have
to be care
Tim Arnold a écrit :
On Apr 8, 4:20 am, Bruno Desthuilliers
(snip)
There are two points here : the first is that we (that is, at least, you
and me) just don't know enough about the OP's project to tell whether
something should belong to the document or not. period. The second poi
Lie Ryan a écrit :
On 04/07/10 18:34, Bruno Desthuilliers wrote:
Lie Ryan a écrit :
(snip)
Since in function in python is a first-class object, you can instead do
something like:
def process(document):
# note: document should encapsulate its own logic
document.do_one_thing()
Obvious
Richard Lamboj a écrit :
Hello,
i want to parse this String:
version 3.5.1 {
$pid_dir = /opt/samba-3.5.1/var/locks/
$bin_dir = /opt/samba-3.5.1/bin/
service smbd {
bin = ${bin_dir}smbd -D
pid = ${pid_dir}smbd.pid
}
servic
Lie Ryan a écrit :
(snip)
Since in function in python is a first-class object, you can instead do
something like:
def process(document):
# note: document should encapsulate its own logic
document.do_one_thing()
Obvious case of encapsulation abuse here. Should a file object
encapsulat
Tim Arnold a écrit :
Hi,
I have a few classes that manipulate documents. One is really a
process that I use a class for just to bundle a bunch of functions
together (and to keep my call signatures the same for each of my
manipulator classes).
So my question is whether it's bad practice to set th
r a écrit :
(snip)
* If he feeling like spreading propaganda he fires up the George
Sakkis or Bruno Desthuilliers.
???
Thought most of my posts here were mostly in the "lame joke" category,
with perhaps sometimes a more technical contribution, but "propaganda" ???
I th
Ani Sinha a écrit :
And now for the most import point: __getattr__ is only called as a
*last* resort. That is, after the attribute lookup mechanism will have
tried *and failed* to find the name in the instance's __dict__.
Thanks you all for all the suggestions and thoughts. So in other
words, t
Ani a écrit :
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
Robert already addressed your problem, so I'll just comment on a couple
other points:
import copy
class BaseDummyObject(object):
def __init__(self):
pass
Th
lbolla a écrit :
class MyList(list):
def __init__(self, names, values):
list.__init__(self, values)
for name, value in zip(names, values):
setattr(self, name, value)
names = ['A', 'B', 'C']
values = ['a', 'b', 'c']
lst = MyList(na
djc a écrit :
and never call the Librarian a monkey
ook ?!?
--
http://mail.python.org/mailman/listinfo/python-list
Jason a écrit :
Hi,
I want to send objects (new style) over DBUS. DBUS can only send
fairly primitive types[1] so I turn my objects into dicts and send
that. I'm reusing the __getstate__ function I wrote for pickling like
so:
def __getstate__(self):
attrs = self.__dict__.copy()
Jose Manuel a écrit :
I have been learning Python, and it is amazing I am using the
tutorial that comes with the official distribution.
At the end my goal is to develop applied mathematic in engineering
applications to be published on the Web, specially on app. oriented to
simulations and c
Steven D'Aprano a écrit :
On Wed, 24 Mar 2010 21:14:23 -0700, Tim Roberts wrote:
Jimbo wrote:
class stock:
code = ""
purchasePrice= 0
purchaseQuantity = 0
price= [] # list of recent prices
recentBid= [] # list of recent bids for stock
John Posner a écrit :
On 3/22/2010 11:44 AM, Bruno Desthuilliers wrote:
Another (better IMHO) solution is to use a plain property, and store the
computed value as an implementation attribute :
@property
def foo(self):
cached = self.__dict__.get('_foo_cache')
if cached is
kj a écrit :
In Dennis Lee Bieber
writes:
On Sun, 21 Mar 2010 16:57:40 + (UTC), kj
declaimed the following in gmane.comp.python.general:
Regarding properties, is there a built-in way to memoize them? For
example, suppose that the value of a property is obtained by parsing
the content
Jimbo a écrit :
Hello
Can you help me figure out why I am getting this compile error with my
program. The error occurs right at the bottom of my code & I have
commented where it occurs.
The error is:
[QUOTE]Expected an indented block[/QUOTE]
[CODE]
(snip)
# Main program loop
def main():
Christian Heimes a écrit :
However Python 2.6 has a new factory that creates a similar
datatype called named tuple:
http://docs.python.org/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields
Duh... Should spend some more time reading 2.6's What's New :(
--
http://
Wes Santee a écrit :
I am very new to Python, and trying to figure out how to create an
object that has values that are accessible either by attribute name,
or by index. For example, the way os.stat() returns a stat_result or
pwd.getpwnam() returns a struct_passwd.
In trying to figure it out, I
Lie Ryan a écrit :
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote:
Patrick Maupin a écrit :
On Mar 16, 1:59 pm, Jason Tackaberry wrote:
Why not create the bound methods at instantiation time, rather than
using the descriptor protocol which has the overhead of creating a new
bound method
Patrick Maupin a écrit :
On Mar 16, 1:59 pm, Jason Tackaberry wrote:
Why not create the bound methods at instantiation time, rather than
using the descriptor protocol which has the overhead of creating a new
bound method each time the method attribute is accessed?
Well, for one thing, Python
samb a écrit :
Hi,
I've found a work around, inspired from Rob Williscroft :
class ReMatch(object):
"""
Object to be called :
1st time : do a regexp.match and return the answer (args:
regexp, line)
2nd time : return the previous result (args: prev)
"""
def __
lallous a écrit :
Hello,
Learning Python from the help file and online resources can leave one
with many gaps. Can someone comment on the following:
(snip code)
Why in test1() when it uses the class variable func_tbl we still need
to pass self, but in test2() we don't ?
What is the differen
Michael.Lausch a écrit :
(snip)
Now I'm trying to understand why this is the case.
How is Foo.__dict__['_ref'] different from Foo._ref?
Shouldn't it return the same attribute?
It's an application of the descriptor protocol:
http://wiki.python.org/moin/FromFunctionToMethod
--
http://mail.py
mk a écrit :
Bruno Desthuilliers wrote:
Well, Zope is backed by an object database rather than a relational one.
And it ended up being a *major* PITA on all Zope projects I've worked
on...
Care to write a few sentences on nature of problems with zodb? I was
flirting with the thoug
John Posner a écrit :
On 3/8/2010 11:55 PM, Gary Herron wrote:
The form of import you are using
from helpers import mostRecent
makes a *new* binding to the value in the module that's doing the
import.
What you can do, is not make a separate binding, but reach into the
helpers module to ge
Rolando Espinoza La Fuente a écrit :
On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
Arnaud Delobelle wrote:
1 == True
True
0 == False
True
So what's your question?
Well nothing I'm just kind of bewildered: I'd expect smth like that in Perl,
but not in Python.. Although I can understand the ra
Pete Emerson a écrit :
(snip)
> I'm really liking the rigid flexibility I'm experiencing with python
> so far.
"rigid flexibility" !-)
+1 QOTW - and welcome on board BTW.
--
http://mail.python.org/mailman/listinfo/python-list
John Posner a écrit :
On 3/3/2010 6:56 PM, John Posner wrote:
... I was thinking
today about "doing a Bruno", and producing similar pieces on:
* properties created with the @property decorator
* the descriptor protocol
I'll try to produce something over the next couple of days.
Starting t
Philip Semanchuk a écrit :
On Mar 3, 2010, at 5:41 PM, Avid Fan wrote:
Jonathan Gardner wrote:
I see it as a sign of maturity with sufficiently scaled software that
they no longer use an SQL database to manage their data. At some point
in the project's lifetime, the data is understood well e
Oren Elrad a écrit :
Howdy all, longtime appreciative user, first time mailer-inner.
I'm wondering if there is any support (tepid better than none) for the
following syntactic sugar:
silence:
block
->
try:
block
except:
pass
Hopefully not.
Eike Welk a écrit :
Bruno Desthuilliers wrote:
John Posner a écrit :
Done -- see http://wiki.python.org/moin/FromFunctionToMethod
Done and well done !-)
Thanks again for the good job John.
I like it too, thanks to both of you!
I have two small ideas for improvement:
- Swap the first two
Bruno Desthuilliers a écrit :
> mk a écrit :
(snip)
>> So sys.getsizeof returns some 200MB for this dictionary. But according
>> to top RSS of the python process is 300MB. ps auxw says the same thing
>> (more or less).
>>
>> Why the 50% overhead?
Oh, and
mk a écrit :
>
> Obviously, don't try this on low-memory machine:
>
a={}
for i in range(1000):
Note that in Python 2, this will build a list of 1000 int objects.
You may want to use xrange instead...
> ... a[i]='spam'*10
> ...
import sys
sys.getsizeof(a)
> 201326
mk a écrit :
>
> does every builtin class have unique id?
Classes are objects. And every object *within a python process* has it's
own unique id. For a definition of "unique" being "unique amongst the
objects living in the process at a given time" - IOW, if an object is
garbage-collected, it's id
John Posner a écrit :
On 3/3/2010 9:58 AM, John Posner wrote:
Film at 11,
John
Done -- see http://wiki.python.org/moin/FromFunctionToMethod
Done and well done !-)
Thanks again for the good job John.
PS : Do you think it could be possible to add link to this page from the
relevant FAQ ite
John Posner a écrit :
On 3/3/2010 5:56 AM, Bruno Desthuilliers wrote:
Eike Welk a écrit :
John Posner wrote:
I've updated the text at this location:
> http://cl1p.net/bruno_0301.rst/
I think this is a very useful writeup!
It would be perfect with a little bit of introduction that
gentlestone a écrit :
Hi, is there some well-known problems with class method monkey
patching?
I've got this error message:
unbound method get_pocet_neocislovanych() must be called with Pozemok
instance as first argument (got Subjekt instance instead)
The method is declared as:
@classmethod
Eike Welk a écrit :
John Posner wrote:
I've updated the text at this location:
> http://cl1p.net/bruno_0301.rst/
I think this is a very useful writeup!
It would be perfect with a little bit of introduction that says:
1. - What it is: "The rough details of method look-up";
2. - which con
John Posner a écrit :
On 3/1/2010 2:59 PM, Bruno Desthuilliers wrote:
Answer here:
http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/bd71264b6022765c/3a77541bf9d6617d#doc_89d608d0854dada0
I really have to put this in the wiki :-/
Bruno, I performed a light copy
Michael Rudolf a écrit :
> Out of curiosity I tried this and it actually worked as expected:
>
class T(object):
> x=[]
> foo=x.append
> def f(self):
> return self.x
>
>
t=T()
t.f()
> []
T.foo(1)
t.f()
> [1]
>
> At first I thought "hehe, alwa
Michael Rudolf a écrit :
(snip)
(pseudocode - this is *not* python ;)
class Machines (Object):
@classmethod
def shutdown(cls, Machine, emergency=False):
try:
if Machine is instanceof(Fileservers):
if not emergency:
Machine.unmount_raid_first
Luis M. González a écrit :
On Feb 24, 8:48 am, Bruno Desthuilliers wrote:
Luis M. Gonz lez a crit :
And what about the trick of updating globals? Is it legal?
It's legal, but it's (usually) a very bad idea - at the top-level, it
harms readability, and from within a function i
Luis M. González a écrit :
(snip)
Alright, this is what the docs say about locals:
"Note
The built-in functions globals() and locals() return the current
global and local dictionary, respectively, which may be useful to pass
around for use as the second and third argument to exec().
Note
The def
Luis M. González a écrit :
On Feb 23, 10:41 pm, Steven D'Aprano
wrote:
On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote:
By the way, if you want the variables inside myDict to be free
variables, you have to add them to the local namespace. The local
namespace is also a dictionary "lo
Luis M. González a écrit :
On Feb 23, 5:53 pm, vsoler wrote:
Hi,
I have two dicts
n={'a', 'm', 'p'}
v={1,3,7}
and I'd like to have
a=1
m=3
p=7
that is, creating some variables.
How can I do this?
You are probably coming from another language and you're not used to
python's data structur
Roald de Vries a écrit :
On Feb 22, 2010, at 10:56 PM, AON LAZIO wrote:
That will be superb
I guess static typing will have to be added, so that tools like eclipse
can inspect (and autocomplete) your programs [better].
Yet another troll...
--
http://mail.python.org/mailman/listinfo/python-
hackingKK a écrit :
(snip)
I don't care how many apps are developed using java as long as they
remain heavy and slw.
google runs on python
Please get your facts right.
Python is one of the languages used internally at Google, true, but so
is Java.
And google-the-search-engine does
commander_coder a écrit :
Hello,
I have a routine that sends an email (this is how a Django view
notifies me that an event has happened). I want to unit test that
routine.
http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends
Or if you're stuck with 1.x < 1.2a, you could just
Yasser Almeida Hernández a écrit :
Hi all.
I have a class with the attribute 'log_file', opened out of the class:
class ProteinCluster:
def __init__(self,cluster_name,log_file):
...
self.log_file = log_file
...
Then i have a private method which write in the log_file:
def
mk a écrit :
John Posner wrote:
a
False
I expected to see 'nostatget' output: nostat.__get__ = nostatget
obviously failed to replace this function's __get__ method.
I don't quite understand the above sentence, so I'm assuming that you
wanted the final "is" test to be "True" instead of "False
mk a écrit :
Steven D'Aprano wrote:
On Thu, 18 Feb 2010 18:28:44 +0100, mk wrote:
nostat.__orig_get__ = nostat.__get__
I should point out that leading-and-trailing-double-underscore names
are reserved for use by the language.
Right... I completely missed that. I will try to change th
mk a écrit :
(snip)
Sorry, no time to get into details now - but I can at least provide a
couple hints.
The first point is that, to override a method on an _instance_, you have
to provide a method object, not a plain function - remember that the
descriptor protocol is only invoked on _cla
mk a écrit :
Bruno Desthuilliers wrote:
class Foo4(object):
""" working solution 2 : use a lambda """
@staticmethod
def bar(baaz):
print baaz
tagada = {'bar': lambda x : Foo4.bar(x)}
def test(self, baaz):
self.taga
mk a écrit :
Bruno Desthuilliers wrote:
Thanks, that worked. But in order to make it work I had to get rid of
'self' in print_internal_date signature
Indeed. Using it that way, the print_internal_date will not be wrapped
in a method object.
Hold on! How does Python know what t
mk a écrit :
Bruno Desthuilliers wrote:
(snip)
class Foo2(object):
""" naive solution : kinda work, BUT will fail
with the real code that has plain functions
in 'tagada'
"""
@staticmethod
def bar(baaz):
print
mk a écrit :
I'm trying to get print_internal_date become a static method AND to
refer to it in a class attribute 'tagdata' dict.
class PYFileInfo(FileInfo):
'python file properties'
@staticmethod
def print_internal_date(filename):
f = open(filename + 'c', "rb")
da
Ben Finney a écrit :
Bruno Desthuilliers writes:
perhaps a lighter introductory text could be helpful. So guys, if you
think a revised version of my post would be of interest, I'll take you
on words: provide the hosting, I'll provide the content !-)
Here, let me work my hosting m
Mark Lawrence a écrit :
Ben Finney wrote:
Bruno Desthuilliers writes:
Mmmm... Let's try to explain the whole damn thing. It's really (and
IMHO beautifully) simple once you get it, but I agree it's a bit
peculiar when compared to most mainstream OO languages.
[…]
Bruno, t
John Posner a écrit :
> On 2/17/2010 2:44 PM, Bruno Desthuilliers wrote:
>>
> Very nice writeup, Bruno -- thanks!
>
>
>>
>>
>> def __call__(self, *args, **kw):
>> # XXX : all sanity checks removed for readability
>> if se
mk a écrit :
class Person(object):
> ... pass
> ...
class Friendly(object):
> ... def hello(self):
> ... print 'hello'
> ...
Person.__bases__ += (Friendly,)
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: Cannot create a consistent
mk a écrit :
> Bruno Desthuilliers wrote:
>> mk a écrit :
>>> P.S. Method resolution order in Python makes me want to kill small
>>> kittens.
>>
>> mro is only a "problem" when using MI.
>
> Oh sure! And I have the impression that multip
mk a écrit :
> Stephen Hansen wrote:
>
>> You don't have to (and can't) refer to the class within the body.
>> Class statements are sort of... odd. They are code which is directly
>> executed, and the results are then passed into a
>> metaclass/type/whatever and a class object is created. While wi
mk a écrit :
P.S. Method resolution order in Python makes me want to kill small kittens.
mro is only a "problem" when using MI.
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro a écrit :
In message <60b1abce-4381-46ab-91ed-
f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote:
Also, lambda's are expressions, not statements ...
Is such a distinction Pythonic, or not?
Python is (by design) a statement-based language, so yes, this
d
Aahz a écrit :
In article <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>,
Jonathan Gardner wrote:
I used to think anonymous functions (AKA blocks, etc...) would be a
nice feature for Python.
Then I looked at a stack trace from a different programming language
with lots of
Arnaud Delobelle a écrit :
rludwinowski writes:
class A:
def __init__(self):
print("A__init__")
class B:
def __init__(self):
print("B__init__")
class C(A, B):
pass
C()
A__init__
Why __init__ class B will not be automatic executed?
Because it's documented beh
Jean-Michel Pichavant a écrit :
Paulo Repreza wrote:
Greetings,
I'm having problems with a little script that I'm trying to finish, I
don't know if I'm in the right track but I know somebody is going to
help me.
(snip - problem already addressed by Jean-Michel...)
while var != ranum:
101 - 200 of 3705 matches
Mail list logo