Re: Pysqlite tables in RAM

2006-09-29 Thread Bruno Desthuilliers
is. If it then happens that SQLite is the bottleneck, try switching to a real RDBMS like PostgreSQL. Remember the 3 golden rules about optimisation: 1/ don't optimize 2/ don't optimize 3/ for the experts only: don't optimize My 2 cents... -- bruno desthuilliers "Premature

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi Bruno, Heck. PC-Soft marketing droids are pursuing us even here now. > Let me guess, your favorite book is the "I HATE THE FRENCH OFFICIAL > HANDBOOK". je suis français, pauvre semoule. > People here deserve a more objective opinion. &quo

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
e this crap do something useful. Heck, compared to PC-Soft, one could find that Microsoft's marketing strategy is based on delivering smart, usable, cleanly debugged products and being helpful to users... -- 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

Re: How to iterate through a sequence, grabbing subsequences?

2006-09-29 Thread Bruno Desthuilliers
y(s, chunksize): f = StringIO.StringIO(long_string) chunk = f.read(chunksize) while chunk: yield chunk chunk = f.read(chunksize) f.close() Now I'm sure someone will come up with a solution that's both far better and much more obvious (at least if you're Dutch ) -- bruno

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi, > > Bruno Desthuilliers a écrit : >> I've never met a programmer that "loved" Windev. > > I have met some here (I'm the guy with a mustache-just kidding but > actually I was there). > > http://www.pcsoft.f

Re: windev vs python SOS

2006-10-02 Thread Bruno Desthuilliers
ml > http://www.pcsoft.fr/pcsoft/120pages/index.html "Facts" ? Lol ! It's about as factual as the existence of Saddam Hussein's mass destruction weapons. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.

Re: preemptive OOP?

2006-10-02 Thread Bruno Desthuilliers
de (which can boil down to a single assignement), but about the unnecessary level of indirection (which, as someone stated, is the one and only problem that cannot be solved by adding a level of indirection !-). -- 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

Re: "Wiki in 10 minutes"

2006-10-02 Thread Bruno Desthuilliers
be appreciated. Could it be that one ? http://adminspotting.net/building-web-pages-with-python/ -- 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

Re: strange append

2006-10-02 Thread Bruno Desthuilliers
ery nice which is the interactive python shell. This lets you try code snippets and see by yourself how it really works : [EMAIL PROTECTED] ~ $ python Python 2.4.3 (#1, Sep 29 2006, 20:26:46) [GCC 4.1.1 (Gentoo 4.1.1-r1)] on linux2 Type "help", "copyright", "credits"

Re: [OT] windev vs python SOS

2006-10-02 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > Bruno Desthuilliers wrote: > >> Amanda wrote: >> (snip) >>> I am always amazed when I meet fanatics!! >> I'm always amazed when I meet PC-Soft's salespersons... > > isn't there some non-python forum where you can sort

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Bruno Desthuilliers
LaundroMat a écrit : > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. Have you trie

Re: was python implemented as a object oriented langage at the beginning ?

2006-10-04 Thread Bruno Desthuilliers
has wrote: > Python's type/class > distinction Which "type/class" distinction ? -- 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

Re: Overwrite only one function with property()

2006-11-19 Thread Bruno Desthuilliers
Kai Kuehne a écrit : > Hi list! > It is possible to overwrite only one function with the property-function? property is not function, it's a class. And it doesn't "overwrite" anything. > x = property(getx, setx, delx, 'doc') > > I just want to overwrite setx, but when I set the others to None, >

Re: basic python questions

2006-11-19 Thread Bruno Desthuilliers
Diez B. Roggisch a écrit : > [EMAIL PROTECTED] schrieb: > >> I have taken the coments and think I have implemented most. My only > > > Unfortunately, no. > >> question is how to use the enumerator. Here is what I did, I have tried >> a couple of things but was unable to figure out how to get th

Re: Python v PHP for web, and restarting Apache?

2006-11-19 Thread Bruno Desthuilliers
walterbyrd a écrit : > Fredrik Lundh wrote: > > >>modularity, modularity, and modularity. >> > > > Can't PHP be made to be just as modular? PHP has no notion of modules. > As a matter of popular practise, I suppose that is not done. I would > think that it could be. Certainly not the way Pyt

Re: Trying to understand Python objects

2006-11-22 Thread Bruno Desthuilliers
body (ie, outside methods) are attached to the class object itself (and then shared by all instances of the class), not to instances themselves. Instance attributes initialisation is usually done in the __init__(self, ...) method. HTH -- 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

Re: Python visual IDE

2006-11-22 Thread Bruno Desthuilliers
productive with a good code editor, the command line, and a few external tools when needed. My 2 cents... -- 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

Re: Method argument names

2006-11-22 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi > > Having a method: > > def method(self,x,y): > > is it possible to discover, from outside the method, that the methods > arguments are ['self', 'x', 'y']? import inspect help(inspect.getargspec) HTH -- brun

Re: Trying to understand Python objects

2006-11-23 Thread Bruno Desthuilliers
Aahz a écrit : > In article <[EMAIL PROTECTED]>, > Ben Finney <[EMAIL PROTECTED]> wrote: > >>Typically, classes are created as a subclass of another class. The >>top-level basic type in Python is 'object', so if your class doesn't >>make sense deriving from anything else, derive from 'object'. >>

Re: Trying to understand Python objects

2006-11-23 Thread Bruno Desthuilliers
Fredrik Lundh a écrit : > Bruno Desthuilliers wrote: > >> Don't see it as a religious point please, but I fail to understand why >> you seem so in love with old-style classes ? (snip) > > to pick a few reasons: the old-style/new-style distinction is com- > plet

Re: Access to variable from external imported module

2006-11-23 Thread Bruno Desthuilliers
GinTon a écrit : > Sorry, I mean access to local variable from a method One of the most surprising properties of local variables is that they are, well... local. -- http://mail.python.org/mailman/listinfo/python-list

Re: python vs java & eclipse

2006-12-12 Thread Bruno Desthuilliers
Amir Michail a écrit : > Hi, > > It seems to me that measuring productivity in a programming language > must take into account available tools and libraries. > > Eclipse for example provides such an amazing IDE for java that it is no > longer obvious to me that one would be much more productive i

Re: merits of Lisp vs Python

2006-12-12 Thread Bruno Desthuilliers
Mathias Panzenboeck a écrit : > Mark Tarver wrote: > >>How do you compare Python to Lisp? What specific advantages do you >>think that one has over the other? >> >>Note I'm not a Python person and I have no axes to grind here. This is >>just a question for my general education. >> >>Mark >> > >

Re: merits of Lisp vs Python

2006-12-12 Thread Bruno Desthuilliers
Mathias Panzenboeck a écrit : > Rob Thorpe wrote: > >>Mathias Panzenboeck wrote: >> >>>Mark Tarver wrote: >>> How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This

Re: oo problem

2006-12-12 Thread Bruno Desthuilliers
Tool69 a écrit : > Hi, > I've got a simple but difficult problem : > > Suppose I've got a Paper class, on wich I can draw i.e a rectangle, a > circle or whatever. > > class Paper(...): > def __init__(self, paperx, papery): > self.paperx = paperx > self.papery = papery >

Re: Snake references just as ok as Monty Python jokes/references in python community? :)

2006-12-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I'm semi-seriously wondering if snake jokes are valid in the Python > community since technically, Python came from Monty Python, not > slithery animals. > > Problem is I don't know that anyone born after Elvis died gets any of > these Monty Python jokes. > > Is it k

Re: merits of Lisp vs Python

2006-12-14 Thread Bruno Desthuilliers
André Thieme a écrit : > Bruno Desthuilliers schrieb: > (snip) >> Both are highly dynamic. Neither are declarative. > > > Well, Lisp does support some declarative features in the ansi standard. If you go that way, there are declarative stuff in Python too... But neithe

Re: Writing and reading variables to/from flat file

2006-12-14 Thread Bruno Desthuilliers
Kevin Walzer a écrit : > I want to write some variables (user preferences, specifically) to a > text file and then read the values from that file. http://docs.python.org/lib/module-ConfigParser.html -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Paul Rubin a écrit : > "Rob Thorpe" <[EMAIL PROTECTED]> writes: > >>Once you can do the above then you can phrase programs entirely in >>terms of composition of functions, which is what functional programming >>is about. >> >>Getting good performance though is problematic without being able to >>e

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Mathias Panzenboeck a écrit : > Bruno Desthuilliers wrote: > >>Mathias Panzenboeck a écrit : >> >>>Rob Thorpe wrote: >>> >>> >>>>Mathias Panzenboeck wrote: >>>> >>>> >>>>>Mark Tarver wrote: >>&g

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Kaz Kylheku a écrit : > Bruno Desthuilliers wrote: > >>André Thieme a écrit : >> >>>Bruno Desthuilliers schrieb: >>> >> >>(snip) >> >>>>Both are highly dynamic. Neither are declarative. >>> >>> >>>We

Re: import

2006-12-18 Thread Bruno Desthuilliers
Gert Cuykens a écrit : > I would like to lauch a server from outside the side package directory > how do i specify a path with import http://docs.python.org/tut/node8.html#SECTION00811 (snip) > if __name__ == '__main__': # ??? dont know what is this for When a module is used a

Re: trees

2006-12-18 Thread Bruno Desthuilliers
Raymond Hettinger a écrit : > vertigo wrote: > >>What library/functions/classes could i use to create trees ? > > > Start with random.seed, login as root, use svn to download the trunk > and branches, when Spring arrives, the leaves will fill-in ;-) keyboard !-) -- http://mail.python.org/mailm

Re: Class and instance question

2006-12-18 Thread Bruno Desthuilliers
Marco Wahl a écrit : (snip) > The __new__ method should return the class. s/class/instance/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary, iterate & update objects

2006-12-18 Thread Bruno Desthuilliers
jansenh a écrit : > hi comp.lang.python. > > I need some newbe advice on idiomatic use of Python dictionaries. > > I have service with a dictionary which holds a bunch of objects as > values, and an ID as key to each object. Then I want to change an > objects state based on its key. class MyObj(

Re: Metaclass uses?

2006-12-18 Thread Bruno Desthuilliers
Nathan Harmston a écrit : (snip) > Also is there anymore interesting OO stuff that Python has apart from Java. Quite a lot. Everything (well, except statements and expressions...) in Python is an object, including classes, modules and functions, and Python objects are really 'dynamic', ie you ca

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>Strictly speaking, only first-class functions are required, and >>tail-recursion optimisation is only an implentation detail. Now it's >>obvious that when it comes to real-life-size pro

Re: def index(self):

2006-12-18 Thread Bruno Desthuilliers
Gert Cuykens a écrit : > Is there a difference between > > > class HelloWorld: > def index(self): > index.exposed = True > return "Hello world!" > > > and > > > class HelloWorld: > def index(self): > self.exposed = True > return "Hello world!" > Ask yourself what are the names 'index' a

Re: def index(self):

2006-12-19 Thread Bruno Desthuilliers
Gert Cuykens a écrit : >> FWIW, the first version raises an exception (unless of course the name >> 'index' is already bound in the enclosing scope). And the second won't >> probably work as expected with CherryPy. > > > > class HelloWorld: > def index(self): > return "Hello world!" > index.exp

Re: python poetry?

2006-12-19 Thread Bruno Desthuilliers
BartlebyScrivener a écrit : > I'm working on a book of technology and computer programming humor. > > First, can anybody recommend any other such books? You of course alreeady know "Tao of programming" and "BOFH" (aka the Bastard Operator From Hell') ? -- http://mail.python.org/mailman/listinf

Re: When Closure get external variable's value?

2006-12-19 Thread Bruno Desthuilliers
Huayang Xia a écrit : > I'm confused. What is the definition of closure. > > I'm not sure if it's correct, I get the definition from wikipedia: > > "A closure typically comes about when one function is declared entirely > within the body of another, and the inner function refers to local > variab

Re: Page layouts in mod_python?

2006-12-19 Thread Bruno Desthuilliers
Michael a écrit : > Hey everyone, > > Is it possible to automatically insert headers/footers using > mod_python? > I will be not be using PSP's, so I cannot use the PSP/include solution. > Furthermore, the header will be dynamic; it won't be a static HTML > page. > > In short, I've been looking f

Re: Page layouts in mod_python?

2006-12-20 Thread Bruno Desthuilliers
Graham Dumpleton a écrit : > Bruno Desthuilliers wrote: > >>Michael a écrit : >> >>>Hey everyone, >>> >>>Is it possible to automatically insert headers/footers using >>>mod_python? >>>I will be not be using PSP's, so I can

Re: def index(self):

2006-12-20 Thread Bruno Desthuilliers
Tim Roberts a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>Gert Cuykens a écrit : >> >>>>FWIW, the first version raises an exception (unless of course the name >>>>'index' is already bound in the enclosing scope). And th

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi. > > I'm extremely new to Python and programming as a whole. I have written > a python script with the assistance of ESRI ArcGIS 9.2, which uses > Python 2.4.1, however, it gives me this error when I try to run it. Please post the full traceback. It's meant to he

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > [EMAIL PROTECTED] a écrit : > > 4/ the Python 'for' loop is meant to iterate over an iterable and taking > care of boundaries, so you'd be better using it: > > townships = gp.ListFeatureClasses ("*") > for towns

Re: Decorator for Enforcing Argument Types

2006-12-21 Thread Bruno Desthuilliers
Chris a écrit : > I'm not sure if this has been done before, It has... > but I couldn't easily find > any prior work on Google, so here I present a simple decorator for > documenting and verifying the type of function arguments. > Feedback/suggestions/criticism is welcome. Python is dynamic, an

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Bruno Desthuilliers
George Sakkis a écrit : > John Machin wrote: > >>Bruno Desthuilliers wrote: >> >> >>> >>>Python is dynamic, and fighting against the language is IMHO a really >>>bad idea. The only places where theres a real need for this kind of >>>s

Re: Decorator for Enforcing Argument Types

2006-12-23 Thread Bruno Desthuilliers
George Sakkis a écrit : > John Machin wrote: > > >>Peter Wang wrote: >> >>>Bruno Desthuilliers wrote: >>> >>>> >>>>Python is dynamic, and fighting against the language is IMHO a really >>>>bad idea. The only places wh

Re: Confusion over calling a nested function inside a parent function

2006-12-23 Thread Bruno Desthuilliers
MacDonald a écrit : > Pyenos wrote: > >>[code] >>class WORK: >>def getwork(self): >>def choosetable(self):pass >>choosetable() #TypeError: choosetable() takes exactly 1 >> #argument (0 given) >>[/code] >> >>Calling choosetable() at the above location gives

Re: Confusion over calling a nested function inside a parent function

2006-12-23 Thread Bruno Desthuilliers
Pyenos a écrit : > [code] You already got the answer - just a pair of stylistic advices: > class WORK: 1/ By convention, ALL_UPPER names denote (pseudo) symbolic constants. The convention for class names is CamelCase. 2/ better to use new-style classes. => class Work(object): ... -- http:

Re: Difference between __init__ (again) and nothing ...

2007-01-02 Thread Bruno Desthuilliers
Stef Mientki a écrit : > Marc 'BlackJack' Rintsch wrote: > >> In <[EMAIL PROTECTED]>, Stef Mientki wrote: >> >>> What's the difference between using __init__ and using nothing, >>> as the examples below. >>> >>> class cpu: >>>PC = 4 >> >> >> This is a *class attribute*. It's the same for all

Re: OO question

2007-01-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > First I want to say thanks everyone for helping me! > > John Machin wrote: > > >>[EMAIL PROTECTED] wrote: >> >>>I want to make an addressbook and I'm new to OO programming, so I >>>wonder if this sounds reasonable. >>> >>>I think of making a class Address which cont

Re: Can I beat perl at grep-like processing speed?

2007-01-02 Thread Bruno Desthuilliers
js a écrit : > Just my curiosity. > Can python beats perl at speed of grep-like processing? Probably not. > > $ wget http://www.gutenberg.org/files/7999/7999-h.zip > $ unzip 7999-h.zip > $ cd 7999-h > $ cat *.htm > bigfile > $ du -h bigfile > du -h bigfile > 8.2Mbigfile > > -- grep.

Re: Convert Perl to Python

2007-01-02 Thread Bruno Desthuilliers
Marc 'BlackJack' Rintsch a écrit : > In <[EMAIL PROTECTED]>, > Χρυσάνθη Αϊναλή wrote: > > >>How can I convert a perl script to Python? > > > Look what the Perl script does and then rewrite it in Python. Automatic > translations between programming languages, if possible, usually result in > co

Re: array of class

2007-01-02 Thread Bruno Desthuilliers
mm a écrit : > > How can I do a array of class? s/array/list/ > s1=[] ## this array should hold classes > > ## class definition > class Word: > word="" > > > ## empty words... INIT > for i in range(100): ## 0..99 > s1.append(Wort) I guess that s/Wort/Word/ > s1[0].word="There" > s1[1]

Re: list/dictionary as case statement ?

2007-01-02 Thread Bruno Desthuilliers
Stef Mientki a écrit : > > If I'm not mistaken, I read somewhere that you can use > function-names/references in lists and/or dictionaries, Python's functions are objects too - instances of the (builtin) class 'function'. So yes, you can use them like any other object (store them in container

Re: array of class

2007-01-02 Thread Bruno Desthuilliers
George Sakkis a écrit : > Bruno Desthuilliers wrote: > (snip) >>words = [] >>for w in ['this', 'is', 'probably', 'what', 'you', 'want']: >> words.append(Word(w)) >>print words > > Or more comp

Re: array of class

2007-01-04 Thread Bruno Desthuilliers
Podi a écrit : >>>Or more compactly: >>> >>>words = [Word(w) for w in 'this is probably what you want'.split()] >>>print words >> >>I didn't want to introduce yet some more "confusing" stuff !-) > > > Indeed, the for loop is perfectly fine and totally readable. Let's save > the "confusing stuff"

Re: array of class / code optimization

2007-01-04 Thread Bruno Desthuilliers
mm a écrit : > > Yes, it was the (), equivalent to thiks like new() create new object > from class xy. Yeps. In Python there's no 'new' operator. Instead, classes are themselves 'callable' objects, acting as instance factory. It's very handy since it let's you replace a class with a factory fu

Re: static object

2007-01-04 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) > The "Singleton" pattern does what you say here. Implementing a proper > Singleton in Python is complicated and hard to understand. Really ? Using __new__ and a class attribute, it doesn't seem so complicated - nor difficult to understand... -- http://mail.python.org

Re: checking one's type

2007-01-05 Thread Bruno Desthuilliers
belinda thom a écrit : > Hi, > > I've been using the following hack to determine if a type is acceptable > and I suspect there is a better way to do it: > > e.g. > > if type(s) == type("") : >print "okay, i'm happy you're a string" if isinstance(s, basestring): print """ There are very

Re: What is proper way to require a method to be overridden?

2007-01-05 Thread Bruno Desthuilliers
jeremito a écrit : > I am writing a class that is intended to be subclassed. What is the > proper way to indicate that a sub class must override a method? class Base(object): def method_to_override(self, *args, **kw): raise NotImplementedError("You need to override this method") -- htt

Re: What is proper way to require a method to be overridden?

2007-01-05 Thread Bruno Desthuilliers
Carl Banks a écrit : > jeremito wrote: > >>I am writing a class that is intended to be subclassed. What is the >>proper way to indicate that a sub class must override a method? > > > You can't (easily). > > If your subclass doesn't override a method, then you'll get a big fat > AttributeError

Re: howto overload with a NOP (empty statement)

2007-01-06 Thread Bruno Desthuilliers
Stef Mientki a écrit : > How should I overload / disable a method ? > In the example below I have defined the class "Power_Supply", derived > from baseclass "device". Naming conventions are to use CamelCase for class names. So it would be better to name your classes 'PowerSupply' (no '_') and '

Re: What is proper way to require a method to be overridden?

2007-01-06 Thread Bruno Desthuilliers
Patrick Down a écrit : > jeremito wrote: > >>I am writing a class that is intended to be subclassed. What is the >>proper way to indicate that a sub class must override a method? >> (snip) > Decorators to the rescue? (snip convoluted code) What a strange idea... -- http://mail.python.org/mail

Re: Pausing for Python Interpreter error messages...

2007-01-06 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I've written a few classes that I have been testing in IDLE. However, > every time I make a change to the classes based on the testing I have > to walk through all he steps of preparing the classes for testing > again. > > So I wrote a script that does all the set-up

Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Bruno Desthuilliers
Stef Mientki a écrit : > In the example below, "pin" is an object with a number of properties. > Now I want > 1- an easy way to create objects that contains a number of these "pin" > 2- an multiple way to access these "pin", i.e. > device.pin[some_index] > device.some_logical_name > ad

Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Bruno Desthuilliers
Stef Mientki a écrit : > rzed wrote: (snip) >> class Power_Supply(device): >> def __init__(self): >> self.pin = { >> 0:dict(Name='GND',Value=_DIG_OUT,something=_par2), >> 1:dict(Name='VCC',Value=_DIG_OUT,something=_par33), >> } > > Why so complex, I ne

Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Bruno Desthuilliers
rzed a écrit : (snip) > for k in self.pin.keys(): > self.__dict__[self.pin[k]['Name']] = self.pin[k] for pin self.pin.values(): self.__dict__[pin['name']] = pin -- http://mail.python.org/mailman/listinfo/python-list

Re:[OT] (newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-07 Thread Bruno Desthuilliers
Martin Miller a écrit : (snip) > > Oh, contrair. I guess you mean "au contraire" ?-) (snip) -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-07 Thread Bruno Desthuilliers
Andrea Griffini a écrit : > Paul Rubin wrote: > > > Yes I've had plenty of > >> pointer related bugs in C programs that don't happen in GC'd >> languages, so GC in that sense saves my ass all the time. > > > My experience is different, I never suffered a lot for > leaking or dangling pointers

Re: Why less emphasis on private data?

2007-01-07 Thread Bruno Desthuilliers
Paul Rubin a écrit : > "Felipe Almeida Lessa" <[EMAIL PROTECTED]> writes: > >>What is the chance of having to inherit from two classes from >>different modules but with exactly the same name *and* the same >>instance variable name? >> >>Of course you're being very pessimistic or extremely unlucky.

Re: Why less emphasis on private data?

2007-01-07 Thread Bruno Desthuilliers
Thomas Ploch a écrit : > sturlamolden schrieb: (snip) > >>As mentioned in other replies, it is not rocket science to access a >>class private data. In C++ you can cast to void*, in Java and C# you >>can use reflection. C++ is said to be an "unsafe" language because >>programmers can, using a few t

Re: where is python on linux?

2007-01-07 Thread Bruno Desthuilliers
Frank Potter a écrit : > I installed fedora core 6 and it has python installed. > But the question is, where is the executable python file? > I can't find it so I come here for help. man which -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-07 Thread Bruno Desthuilliers
Andrea Griffini a écrit : > Bruno Desthuilliers wrote: > > >> ... and on > >>> the opposite I didn't expect that fighting with object >>> leaking in complex python applications was that difficult >>> (I've heard of zope applications that

Re: Why less emphasis on private data?

2007-01-07 Thread Bruno Desthuilliers
John Nagle a écrit : > sturlamolden wrote: > >> [EMAIL PROTECTED] wrote: >> >>> Coming from a C++ / C# background, the lack of emphasis on private data >>> seems weird to me. I've often found wrapping private data useful to >>> prevent bugs and enforce error checking.. >>> >>> It appears to me (pe

Re: [OT] (newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-07 Thread Bruno Desthuilliers
Martin Miller a écrit : > Bruno Desthuilliers wrote: > >>Martin Miller a écrit : >>(snip) >> >>>Oh, contrair. >> >>I guess you mean "au contraire" ?-) >> >>(snip) > > > FWIW "contrair" is how it's spel

Re: how to find the longst element list of lists

2007-01-07 Thread Bruno Desthuilliers
Michael M. a écrit : > How to find the longst element list of lists? For what definition of "find" ? You want the lenght of the longest sublist, it's index, or a reference to it ? > I think, there should be an easier way then this: > > s1 = ["q", "e", "d"] > s2 = ["a", "b"] > s3 = ["a", "

Re: Working with Excel inside Python

2007-01-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I have a .plt file (which is a tab delimited ASCII file) and I want to > format it to get a .dbf with data in rows and columns, detele some > rows/columns and substitute decimal '.' with ','. All this using Python Then you may want to have a look here: http://docs.pyt

Re: Working with Excel inside Python

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Or, you might want to look at two packages: > > xlrd > > pyExcelerator > > The first can "read" .xls files, and the second can write them. I've had > great results with both. That's fine, but since the OP is mainly using Excel for reformating a csv file and savin

Re: Working with Excel inside Python

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Sorry for my little knowledge on Python. Actually my knowledge is > specific for automating geo-processing tasks within ESRI environment, > but sometimes I need to automate some other tasks (like this one) which > require more in-depth knowledge of this language. I wo

Re: Why less emphasis on private data?

2007-01-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Wow, I got a lot more feedback than I expected! > > I can see both sides of the argument, both on technical merits, and > more philosophical merits. When I first learned C++ I felt > setters/getters were a waste of my time and extra code. When I moved > to C# I stil

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Bruno Desthuilliers
vizcayno a écrit : > Hello: > Need your help in the "correct" definition of the next function. If > necessary, I would like to know about a web site or documentation that > tells me about best practices in defining functions, especially for > those that consider the error exceptions management. > I

Re: private variables

2007-01-09 Thread Bruno Desthuilliers
belinda thom a écrit : > Hello, > > In what version of python were private variables added? Which private variables ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine an object is a subclass of another

2007-01-09 Thread Bruno Desthuilliers
abcd a écrit : > yea i meant to have animal extend thing and dog extend animalmy > mistake. > > anyways, is there a way to check without having an instance of the > class? > > such as, > > isinstance(Dog, (Animal, Thing)) ?? > > issubclass(Dog, Animal) Note that such tests should only be

Re: Python - C# interoperability

2007-01-09 Thread Bruno Desthuilliers
mc a écrit : > Is there an easy way to compile a Python class (or set of classes) into > a .DLL that a C# program can call? Or otherwise to use an existing > library of Python classes from a C# program as seamlessly as possible? > I can't tell if that'll do, but have you looked at IronPython ? --

Re: injecting functions into a python sandbox within a python program

2007-01-09 Thread Bruno Desthuilliers
Graham Menhennitt a écrit : > I have a large Python 2.5 program that I want my users to be able to > "extend" using a Python script. However, I want their script to run in a > sandbox within the overall program so that they only have access to the > rest of the program via a single simple interf

Re: file_name_fixer.py

2006-01-24 Thread Bruno Desthuilliers
eww a écrit : (top-post corrected) > bruno at modulix wrote: > >>[EMAIL PROTECTED] wrote: >> >>>i put this together to fix a bunch of files with wierd names, please >>>gimme feedback, i am a newbie >> >>Ok, so let's go... Hope you won't ha

Re: templates

2006-01-30 Thread Bruno Desthuilliers
projecktzero a écrit : > For some of the web programming I've done in Python, I've used > htmltmpl. I had some experience with it in Perl, and found a Python > version. > > http://htmltmpl.sourceforge.net/ > > I like that there's nearly a complete separation between the > presentation and the cod

Re: test whether 2 objects are equal

2006-01-31 Thread Bruno Desthuilliers
Yves Glodt a écrit : > bruno at modulix wrote: > >> Yves Glodt wrote: >> (snip) >>> #!/usr/bin/python >>> >>> class Test: >>> var1 = '' >>> var2 = '' >> >> >> Take care, this creates two

Re: Object Oriented vs Pythonic Code, and Pythonic standards

2006-02-07 Thread Bruno Desthuilliers
Carl J. Van Arsdall a écrit : > It seems the more I come to learn about Python as a langauge and the way > its used I've come across several discussions where people discuss how > to do things using an OO model and then how to design software in a more > "Pythonic" way. Well, Python being mostl

Re: by reference

2006-02-12 Thread Bruno Desthuilliers
dirvine a écrit : > Thanks but I am a bit unsure as to what error I have made by posting > this question. Your question was not very clear. > I am not trying to be funny but can you give me a > pointer to the issue. Have you read Martin Hellwig's answer ? -- http://mail.python.org/mailman/lis

Re: is there a better way?

2006-02-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Problem: > > You have a list of unknown length, This doesn't exist in Python: len(alist) > such as this: list = > [X,X,X,O,O,O,O]. You want to extract all and only the X's. braindead solution - relying on zeros being zeros or any other False value: all_xxx = fi

Re: Newbie

2006-02-12 Thread Bruno Desthuilliers
LittlePython a écrit : > Is this a good place to post python questions from newbie's, or would you > suggest another board? Well, depends on how newbie you are, both to Python and to programming, but yes, this is at least a good place to start. You may find that most other newsgroups are probabl

Re: [OT]Another n00b: Removing the space in "print 'text', var"

2006-02-13 Thread Bruno Desthuilliers
Rick Zantow a écrit : > bruno at modulix <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>HappyHippy wrote: >> (snip) >>>eg. >>>strName = 'World' >>>print 'Hello', strName, ', how are you today?'

Re: Pythonic gui format?

2006-02-13 Thread Bruno Desthuilliers
Gregory Petrosyan a écrit : > Buenos dias, amigos! > I have to write _simple_ gui library, for embedding into game. My > first attempt was to use XML: isn't it cute to describe ui in such a > way: > > > Hello World! > > > (some text here) > > > first elem

Re: invert the order of a string

2006-02-13 Thread Bruno Desthuilliers
rtilley a écrit : > s = list('some_random_string') > print s > s.reverse() > print s > s = ''.join(s) > print s > > Surely there's a better way to do this, right? print 'some_random_string'[::-1] -- http://mail.python.org/mailman/listinfo/python-list

Re: invert the order of a string

2006-02-13 Thread Bruno Desthuilliers
Paul Rubin a écrit : > rtilley <[EMAIL PROTECTED]> writes: > >>s = list('some_random_string') >>print s >>s.reverse() >>print s >>s = ''.join(s) >>print s >> >>Surely there's a better way to do this, right? > > > In Python 2.4, just say > s = reversed('some_random_string') Python 2.4.1 (#1, J

Re: Pythonic gui format?

2006-02-14 Thread Bruno Desthuilliers
Gregory Petrosyan a écrit : (snip) > Your dicts example is nice, but this approach (and some others) lacks > one important feature: ordering of GUI elements. In XML, the order of > all elements is specified, and with dicts (or with very clean Georg's > model) it is not. (BTW remember topics about

<    6   7   8   9   10   11   12   13   14   15   >