Re: how relevant is C today?

2006-04-10 Thread bruno at modulix
gregarican wrote: > Here are a few languages I recommend most programmers should at least > have a peek at: > (snip) > 2) Lisp - Along with FORTRAN, one of the oldest programming languages > still in use. Pure functional programming model Err... Even if Lisp is the father of functional programmi

Re: Is this object counter code pythonic

2006-04-11 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Fredrik is then this a valid "property" use case and pythonic to > get/set a common varibale across objects > > class E(object): > _i = 0 > def geti(self) : return E._i > def seti(self,val) : E._i = val > i = property(geti,seti) > > if __name__ == "_

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
fyhuang wrote: > Hello all, > > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Seems you're confusing encapsulation with data hiding. >

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
Roy Smith wrote: (snip) > That being said, you can indeed have private data in Python. Just prefix > your variable names with two underscores (i.e. __foo), and they effectively > become private. The double-leading-underscore stuff has nothing to do with "privacy". It's meant to protect from

Re: how relevant is C today?

2006-04-11 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > bruno at modulix <[EMAIL PROTECTED]> wrote: > > >>gregarican wrote: >> >>>Here are a few languages I recommend most programmers should at least >>>have a peek at: >>&g

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
looping wrote: > Peter Hansen wrote: > >>Georg Brandl wrote: >> >>>class C(): >>> >>>is meant to be synonymous with >>> >>>class C: >>> >>>and therefore cannot create a new-style class. >> >>I think "looping" understands that, but is basically asking why anyone >>is bothering with a change that in

Re: unboundlocalerror with cgi module

2006-04-11 Thread bruno at modulix
David Bear wrote: > I'm attempting to use the cgi module with code like this: > > import cgi > fo = cgi.FieldStorage() > # form field names are in the form if 'name:part' > keys = fo.keys() > for i in keys: > try: > item,value=i.split(':') > except NameError, Unboun

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > bruno at modulix>Since the class statement without superclass actually > creates an old-style class, I'd expect the "class MyClass():" variant > to behave the same.< > > In Python 3.0 I really hope the > > class C: pass

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
looping wrote: > bruno at modulix wrote: > >>looping wrote: >> >>>Peter Hansen wrote: >>> >>> >>>>Georg Brandl wrote: >>>> >>>> >>>>>class C(): >>>>> >>>>>is meant

Re: how relevant is C today?

2006-04-11 Thread bruno at modulix
gregarican wrote: > bruno wrote: > > >>Err... > > >>And ? > > > It's the snide, curt replies such as your recent ones in this thread > that reinforce the generalization that the Python community can be > rude. I'm afraid you're right, at least for the second one, and I do apologise NB : the

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Ben C wrote: > On 2006-04-11, Michele Simionato <[EMAIL PROTECTED]> wrote: > >>Roy Smith wrote: >> >> >>>That being said, you can indeed have private data in Python. Just prefix >>>your variable names with two underscores (i.e. __foo), and they effectively >>>become private. Yes, you can bypass

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Casey Hawthorne wrote: >>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >>or any other aspect you may be familiar with from Java or C++. The >>primary concept behind OOP is not buzzwords such as abstraction, >>encapsulation, polymorphism, etc etc, but the fact that your pro

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Gregor Horvath wrote: > Steven D'Aprano schrieb: > > >>I don't know of many other OO languages that didn't/don't have >>inheritance, > > > VB4 - VB6 > VB6 has a kind of inheritance via interface/delegation. The interface part is for subtyping, the delegation part (which has to be done manuall

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > thanks for your answer. split gives me a list of strings, Of course, why should it be otherwise ?-) More seriously : Python doesn't do much automagical conversions. Once you've got your list of strings, you have to convert'em to floats. > but i found a > way to do what i want: >

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > yo! > > thank you everone! here's how i finally did it: > converting the string into a list: > > input = net.receiveUDPData() > input = list(eval(input[0:-2])) You'll run into trouble with this. > converting the list into a string: > > sendout = "%.6f %.6f %.6f

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
News wrote: > Hi everyone, > > My goal is to pull command switches/options from a file and then assign > the values to select variables which would eventually be included in a > class object. > > The data file looks something like this but the switches could be in any > order and not all may be us

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
News wrote: > bruno at modulix wrote: > >>News wrote: >> >>>Hi everyone, >>> >>>My goal is to pull command switches/options from a file and then assign >>>the values to select variables which would eventually be included in a >>>class

Re: how to match n- lists for a common elements.

2006-04-13 Thread bruno at modulix
Grzegorz Ĺšlusarek wrote: > Hi all. I my application i have situation when i have some lists and i > must get from lists common elements. Exacly i don't know how many list I > have so at the moment of creation each of one I append them to one > list. So I get list wchich consist of lists of objects

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
News wrote: (snip) > sometimes you can't see the forest .. trees and all that :) Yes, been here too... I wrote a CSV parser before realising there was a pretty good one in the standard lib :( (snip) > OT: I saw several references to "OP". What does this mean? Original Poster -- bruno desthuill

Re: new-style classes and len method

2006-04-13 Thread bruno at modulix
Thomas Girod wrote: > Or maybe I'm mixing up what we call a "classmethod" with what we could > call an "instance method" ? > That's what I was about to point out !-) > class Data(list): > __slots__ = ["width", "height", "label"] > > def __init__(self,width,height,label=None): > l

Re: new-style classes and len method

2006-04-13 Thread bruno at modulix
Thomas Girod wrote: > It's alright I found where my mistake came from. I was misunderstanding > the meaning of "classmethod", thinking of it as an instance method. Given that 'instance methods' being most of the time attributes of the class object, such a confusion is not so surprising !-) -- br

Re: Can't see the forest for the trees - when reading file, only processing first line

2006-04-13 Thread bruno at modulix
News wrote: > Hi Everyone, > > > The attached code creates client connections to websphere queue managers > and then processes an inquiry against them. > > The program functions when it gets options from the command line. > > It also works when pulling the options from a file. > > My issue is

Re: function prototyping?

2006-04-13 Thread bruno at modulix
Burton Samograd wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: > > >>Burton Samograd wrote: >> >>>Is there any way to 'prototype' functions in python, as you would in >>>C? Would that be what the 'global' keyword is for, or is there a more >>>elegant or 'pythonic' way of doing forward referen

Re: function prototyping?

2006-04-13 Thread bruno at modulix
Burton Samograd wrote: > bruno at modulix <[EMAIL PROTECTED]> writes: (snip) >>*But* is it necessary to have the main() in the same file that defines >>a_fun and b_fun ? It's quite common (and not only in Python) to use a >>distinct file for the main(). So you

Re: function prototyping?

2006-04-13 Thread bruno at modulix
Burton Samograd wrote: > "infidel" <[EMAIL PROTECTED]> 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 w

Re: nested functions

2006-04-14 Thread bruno at modulix
Szabolcs Berecz wrote: > On 14 Apr 2006 04:37:54 -0700, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > >>def a(): >> def b(): >>print "b" >> def c(): >>print "c" >> >>how can i call c() ?? > > > Function c() is not meant to be called from outside function a(). > That's what a nested

<    1   2   3   4   5   6