function prototyping?

bruno at modulix onurb at xiludom.gro
Thu Apr 13 14:43:34 EDT 2006


Burton Samograd wrote:
> "infidel" <saint.infidel at gmail.com> writes:
> 
> 
>>If you want the user to be able to (re)define them in config.py, why
>>not just define them there in the first place?  I may be wrong, but I
>>think "global" means "module level" rather than "interpreter level".
> 
> 
> That's what I'm trying to do but I'm running into problems with
> the function values, since they haven't been defined yet.  
> 
> I'm a C programmer, so I'm doing it in a bit of a C like way;
> prototype the function, initalize the array using the prototypes, have
> the functions defined somewhere else and then let the linker work it
> all out for me.  I was hoping that python had some sort of lazy
> evaluation scheme for this type of behaviour so that you could defer
> linkage (or variable evalutation) until runtime, or at least variable
> reference (through the use of thunks or some sort).  Maybe I was
> hoping for too much :)

It's not a problem of "hoping for too much", but a problem of paradigm
shift. You're actually *thinking* in C, and Python is a *completely
different* language. You just can't directly transpose C idioms in
Python - nor could you transpose much Python idioms in C. So you need to
'go down a level' and consider the real problem and how to solve it the
Python way - not how to implement the C-ish solution in Python.


My 2 cents
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list