Re: HTML Templates (Sitemesh/Tiles concept) in Python

2006-10-23 Thread bruno de chez modulix en face
Suren a écrit : > > Python with ? CGI ? FastCGI ? mod_python ? Other ? > > We are using mod_python and SSI. > > We are inheriting some legacy code > that we do not want to mess with at all. Ok. > > You shouldn't - unless this is an internal web-based application, not a > > public site. Since yo

Re: help with my first use of a class

2006-10-22 Thread bruno de chez modulix en face
Fulvio a écrit : > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Saturday 21 October 2006 02:01, James Stroud wrote: > > I think the trick is to identify when a class would make more sense than > > a collection of subroutines > > I do be

Re: Good Form

2006-10-21 Thread bruno de chez modulix en face
[EMAIL PROTECTED] a écrit : > I am new to Python but come from a C++ background so I am trying to > connect the dots :) . I am really liking what I see so far but have > some nubee questions on what is considered good form. For one thing I > am used to class variables I assume you mean "instance

Re: sufficiently pythonic code for testing type of function

2006-10-11 Thread bruno de chez modulix en face
Theerasak Photha a écrit : > On 10/11/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > > Now the real question : what if the object is not an instance of any of > > the types, but still support the expected interface ? > > Perhaps: > > try: > for attribute in ['foo', 'bar', '__baz__']: >

Re: How to be a good programmers?

2006-10-11 Thread bruno de chez modulix en face
[EMAIL PROTECTED] a écrit : > I just started to learn python programming because I need to be in the > group when google come in Madagascar, So I want to know, what kind of > python programming I have to start to learn? Zope?...? Not sure what you mean about Google and "being in the group", but

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread bruno de chez modulix en face
sam a écrit : (snip) > i'm still in the early stages, and am trying to code something simple > and interactive to get the percentages of the portfolio in the five > different investment categories. i thought i'd get in with the error > handling early so if someone types in something wrong (like a

Re: Accessing object parent properties

2006-05-26 Thread bruno de chez modulix en face
(answering to the op) Cloudthunder wrote: > How can I set up method delegation so that I can do the following: > A.run() > and have this call refer to the run() method within the boo instance? Also, > what if I have tons of functions like run() within the boo instance and I > want all them to be

Re: Accessing object parent properties

2006-05-26 Thread bruno de chez modulix en face
> Are you sure you don't want to use a child class for this? Composition/delegation introduce far less coupling than implementation inheritance. Inheritance abuse is in fact a well-known OO antipattern. Since Python makes delegation easy as pie, I don't see any reason to go for inheritence when it

Re: dict literals vs dict(**kwds)

2006-05-26 Thread bruno de chez modulix en face
> Hm, as far as I know shadowing the builtins is discouraged. *accidentally* shadowing builtins is a common Python gotcha - that's why it's comon here to raise *warnings* about this. Explicitly and knowingly rebinding a builtin (or any other name FWIW) *with a compatible object* is something else

Re: Python for my mum

2006-05-26 Thread bruno de chez modulix en face
> Someone has give my 78 year old mother a tool for learning French > vocabulary written in Python. Is it the tool or the vocabulary that's written in Python ? > She has a plain vanilla Windows XP system and does not know what a > compiler is. One doesn't need to know what's a compiler is to us

Re: __getattr__ and functions that don't exist

2006-05-26 Thread bruno de chez modulix en face
class Parrot(object): class _dummy(object): def __init__(self, obj, name): self.name = name self.obj = obj def __call__(self, *args, **kw): print "dummy %s for %s" % (self.name, self.obj) print "called with %s - %s" % (str(args),

Re: Can any body help me

2006-05-26 Thread bruno de chez modulix en face
1. read this: www.catb.org/~esr/faqs/smart-questions.html 2. do the Python tutorial 3. do your homework 4. when stuck, post your code here HTH -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a classes code

2006-04-19 Thread bruno de chez modulix en face
> It turns out that what I want to do can be done using the inspect > module which has methods for getsourcecode among other things. I never said that what you wanted to do was impossible (nor even difficult, and FWIW, there are simpler alternatives than using inspect - using a templating system l