Re: Wrapping classes

2005-09-23 Thread bruno modulix
Jeremy Sanders wrote: > Is it possible to implement some sort of "lazy" creation of objects only > when the object is used, but behaving in the same way as the object? Smells like a Proxy pattern... > For instance: > > class Foo: > def __init__(self, val): > """This is really slow.""" >

Re: Wrapping classes

2005-09-23 Thread bruno modulix
Jeremy Sanders wrote: > Diez B. Roggisch wrote: > > >>It works - in python 2.4!! I tried subclassing dict, but my >>__getitem__-method wasn't called - most probably because it's a C-type, >>but I don't know for sure. Maybe someone can elaborate on that? > > > Yes - I tried that (see thread belo

Re: Carrying variables over from function to function

2005-09-27 Thread bruno modulix
Peter Otten wrote: > Bruno Desthuilliers wrote: > > >>2/ functional solution: >>--- >>def make_funcs(): >>x = 0 >>def _abc(): >>x = 1 >>return x + 1 >>def _abcd(): >>return x + 1 >>return _abc, _abcd >> >>abc, abcd = make_funcs() >>print

Re: Module organization

2005-09-28 Thread bruno modulix
Lasse Vågsæther Karlsen wrote: > I am slowly learning Python and I'm already starting to write some minor > modules for myself. Undoubtedly there are better modules available > either built-in or 3rd party that do the same as mine and much more but > I need to learn it one way or another anyway. >

Re: Zope3 Examples?

2005-09-29 Thread bruno modulix
Markus Wankus wrote: > Hi All, > > Does anyone know of any good Zope3 examples? Ask the Zope mailing-list. Zope is a world by itself, and is usually not discussed here. BTW, Zope3 is a really really new thing, so you won't find much existing apps. When it's said that it offers 'the best from P

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
James A. Donald wrote: > I am contemplating getting into Python, which is used by engineers I > admire - google and Bram Cohen, but was horrified "horrified" ??? Ok, so I'll give you more reasons to be 'horrified': - no private/protected/public access restriction - it's just a matter of conventi

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
James A. Donald wrote: > James A. Donald: > >> > Surely that means that if I misspell a variable name, my program will >> > mysteriously fail to work with no error message. > > > On Sun, 02 Oct 2005 17:11:13 -0400, Jean-François Doyon > >>No, the error message will be pretty clear actually :)

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
[EMAIL PROTECTED] wrote: > The easiest way to avoid this problem (besides watching for NameError > exceptions) is to use an editor that has automatic name completion. > Eric3 is a good example. So, even though in theory it could be an > issue, I rarely run into this in practice. I don't use emacs

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread bruno modulix
Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >>No, but that is precisely why Python's semi-private variables are >>usually better. Names like _X and class.__X are warnings to the developer >>"use these at your own risk", without preventing developers who need them >>from using

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread bruno modulix
Mike Meyer wrote: (snip) > Antoon, at a guess I'd say that Python is the first time you've > encountered a dynamnic language. Being "horrified" at not having > variable declarations, Mike, "being horrified" by the (perceived as...) lack of variable declaration was the OP's reaction, not Antoon's.

Re: So far

2005-10-06 Thread bruno modulix
CppNewB wrote: > I am absolutely loving my experience with Python. Even vs. Ruby, the syntax > feels very clean with an emphasis on simplification. > > My only complaint is that there doesn't appear to be a great commercial IDE Why "commercial" ? -- bruno desthuilliers python -c "print '@'.j

Re: Python interpreter bug

2005-10-07 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Sorry Fredrik but I don't understand. Just comment out the assert and > you have different results depending on whether an unrelated sort > function is defined. > This seems weird to me ! code snippet: > from random import choice > class OBJ: > def __init__(self,i

Re: Python's Performance

2005-10-12 Thread bruno modulix
Alex Stapleton wrote: > > On 9 Oct 2005, at 19:04, Bruno Desthuilliers wrote: > > >> Laszlo Zsolt Nagy a écrit : (snip) >>> Do you want to know how many internal string operations are done inside >>> the Python interpreter? I believe it is not a useful information. There >>> are benchmarks tes

Re: Python's Performance

2005-10-12 Thread bruno modulix
Donn Cave wrote: > Quoth "Fredrik Lundh" <[EMAIL PROTECTED]>: > | Alex Stapleton wrote > | > | > Except it is interpreted. > | > | except that it isn't. Python source code is compiled to byte code, which > | is then executed by a virtual machine. if the byte code for a module is up > | to date, t

Re: Very dumb question

2005-10-12 Thread bruno modulix
Laszlo Zsolt Nagy wrote: > I have a program with this code fragment: > >print len(data) >print data[:50] >raise SystemExit > > This prints: > > 20381 > > But if I change 50 to 51 > >print len(data) >print data[:51] >raise SystemExit > > then it prints > > 20381 > !DO

Re: [newbie]Is there a module for print object in a readable format?

2005-10-17 Thread bruno modulix
James Gan wrote: > I want the object printed in a readable format. For example, > x =[a, b, c, [d e]] will be printed as: > x--a > |_b > |_c > |___d >|_e > > I tried pickled, marshel. They do different work. > > Is there another > module which do this kind of job? > pprint -- bruno des

Re: Question on class member in python

2005-10-17 Thread bruno modulix
Johnny Lee wrote: > Class A: s/C/c/ >def __init__(self): > self.member = 1 > >def getMember(self): > return self.member > > a = A() > > So, is there any difference between a.member and a.getMember? yes : a.member is an integer, a.getMember is a bound method. You could hav

Re: Problems with properties

2005-10-17 Thread bruno modulix
[EMAIL PROTECTED] wrote: > If you change it to this it works. You should provide a get and a set > function for a property. The OP did: -> command=property(getCommand, setNothing) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PRO

Re: Vim capable IDE?

2005-10-18 Thread bruno modulix
Chris Lasher wrote: > Hello, > Is there a Python-sensitive, Linux compatible IDE out there with > standard bells and whistles (source browser, symbolic debugger, etc.) > but with the action-per-keystroke editing capabilities of Vim? I have > failed to turn up such an IDE in my Googling and IDE pr

Re: override a property

2005-10-18 Thread bruno modulix
Robin Becker wrote: > Bruno Desthuilliers wrote: > >> Robin Becker a écrit : >> >>> Is there a way to override a data property in the instance? Do I need >>> to create another class with the property changed? >> >> >> >> Do you mean attributes or properties ? > > > I mean property here. Ok, was

Re: Python vs Ruby

2005-10-20 Thread bruno modulix
Bryan wrote: > Amol Vaidya wrote: > >> Hi. I am interested in learning a new programming language, and have >> been debating whether to learn Ruby or Python. (snip) > > why don't you do what i did? download ruby and spend a day or two > reading "programming ruby" from www.ruby-lang.org/en. the

Re: Python vs Ruby

2005-10-20 Thread bruno modulix
Amol Vaidya wrote: > Hi. I am interested in learning a new programming language, and have been > debating whether to learn Ruby or Python. How do these compare and contrast > with one another, and what advantages does one language provide over the > other? I would like to consider as many opinio

Re: A macro editor

2005-10-21 Thread bruno modulix
Tom Anderson wrote: > On Thu, 20 Oct 2005, Diez B. Roggisch wrote: > >> So - _I_ think the better user-experience comes froma well-working >> easy to use REPL to quickly give the scripts a try. > > > I'd agree with that. Which is better, a difficult language with lots of > fancy tools to help yo

Re: Python vs Ruby

2005-10-21 Thread bruno modulix
Amol Vaidya wrote: > "Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>What languages do you know already? >> >>What computer science concepts do you know? >> >>What computer programming concepts do you know? >> >> >>Have you heard of Scheme? >> >> >>Ruby is a bi

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
Michael Ekstrand wrote: > On Friday 21 October 2005 07:07, bruno modulix wrote: > >>>>Python is more like Java. >> >> >>Err... Python is more like what Java would have been if Java was a >>smart dynamic hi-level object oriented language !-) >> &g

Re: [OT] Python vs Ruby

2005-10-24 Thread bruno modulix
Scott David Daniels wrote: > bruno modulix wrote: > >> ... Another language that failed to make it to the mainstream but is >> worth giving a try is Smalltalk - the father of OOPLs (Simula being the >> GrandFather). > > I would say Simula is the forefather of

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
Alex Martelli wrote: (snip) > Here's a tiny script showing some similarities and differences: > > def f() > i = 0 > while i < 100 > j = 923567 + i > i += 1 > end > end > > f() > > comment out the 'end' statements, and at colons s/at/add/ > at the end of the def > and while st

Re: Zope and Persistence

2005-10-24 Thread bruno modulix
[EMAIL PROTECTED] wrote: > I don't know if this is the appropriate place to post a Zope question Nope. You'd better use the zope mailing-list for this. > but I figure many here are familiar with it. I'm confused about the > role of the ZMI when it comes to development. As it's name implies, the

Re: Tricky Areas in Python

2005-10-24 Thread bruno modulix
PyPK wrote: > hmm Thats one thing. Also I was thinking of something like benefites of > python over other languages. That's fairly context-dependant *and* subjective. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@

Re: Hi All - Newby

2005-10-25 Thread bruno modulix
Ask wrote: > G'day All, > (snip) Welcome here... > I must admit to much confusion regarding some of the basics, but I'm sure > time, reading, and good advice will get rid of that. at this stage, it's > just working through some examples and getting my head around things. As an > example, if I

Re: [OT] Python vs Ruby

2005-10-25 Thread bruno modulix
Scott David Daniels wrote: > bruno modulix wrote: > >> Scott David Daniels wrote: >> >>> bruno modulix wrote: >>> >>>> ... Another language that failed to make it to the mainstream but is >>>> worth giving a try is Smalltalk - the fat

Re: Tricky Areas in Python

2005-10-25 Thread bruno modulix
beza1e1 wrote: > let me try. > > 1) ''.join(lots_of_pieces) > > 2) This doesn't even work, if something is removed, the list is too > short. So: > [x for x in somelist if not isbad(x)] > well, list comprehension is Python 2.4 2.2.x IIRC > and 2.3 is the standard in many > OSes, so it is possib

Re: noob question

2005-06-27 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Hi Matt, > I also am almost a newbie (in Python) and my approach to variable > naming > follows more or less the Hungarian Type Notation Defined. which is seen as a bad practice anywhere outside Win32... http://mindprod.com/jgloss/unmainnaming.html -- bruno desthuill

Re: delphi to python converter

2005-06-27 Thread bruno modulix
Thys Meintjes wrote: > Greets, > > I have need of a Delphi/pascal to python converter. Googling didn't > suggest any obvious leads so I'm trying here... Have you tried with "python/delphi programer" ?-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')])

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread bruno modulix
[EMAIL PROTECTED] wrote: > ##Coin Flip: randomly flips 100 "coins" and prints results > ##Original draft: june 27, 2005 > ##Chuck > > import random > heads = 0 > tails = 0 > flips = 0 > while flips < 99: > coin = random.randrange(0, 2) > if coin == 0: > heads = heads +

Re: Dictionary to tuple

2005-06-28 Thread bruno modulix
Odd-R. wrote: > I have a dictionary, and I want to convert it to a tuple, > that is, I want each key - value pair in the dictionary > to be a tuple in a tuple. > > If this is the dictionary {1:'one',2:'two',3:'three'}, > then I want this to be the resulting tuple: > ((1,'one'),(2,'two'),(3,'three'

Re: Modules for inclusion in standard library?

2005-06-28 Thread bruno modulix
George Sakkis wrote: > I'd love to see IPython replace the standard interpreter. I dont. -- 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: Dictionary to tuple

2005-06-28 Thread bruno modulix
Tim Williams (gmail) wrote: (snip) d = {1:'one',2:'two',3:'three'} t = tuple([(k,v) for k,v in d.iteritems()]) Err... don't you spot any useless code here ?-) (tip: dict.items() already returns a list of (k,v) tuples...) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-

Re: Dictionary to tuple

2005-06-29 Thread bruno modulix
Erik Max Francis wrote: > bruno modulix wrote: > >> Err... don't you spot any useless code here ?-) >> >> (tip: dict.items() already returns a list of (k,v) tuples...) > > But it doesn't return a tuple of them. Which is what the tuple call > th

Re: Newbie: Help Figger Out My Problem

2005-06-29 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Thanks to all who replied. I did not ask for other iterations of my > program. I asked what was wrong with it. Please understand that usenet is not a commercial support service. Everyone is free to answer how he likes. Or not to answer at all... -- bruno desthuilliers

Re: How to connect python and Mysql?

2005-06-29 Thread bruno modulix
praba kar wrote: > Dear All, > > I am using python2.4 and Mysql 4.0.20. Now I am > want to connect python and mysql. I have problem to > install Mysql-python-1.2.0 interface into my machine. > When I try to install this interface the following > error restrict to install fully. > > /System

Re: Modules for inclusion in standard library?

2005-06-29 Thread bruno modulix
George Sakkis wrote: >>"bruno modulix" <[EMAIL PROTECTED]> wrote: > > >>George Sakkis wrote: >> >>>I'd love to see IPython replace the standard interpreter. >> >>I dont. > > > Care to say why ? Sorry... it was about

Re: script fichiers binaires lecture écriture

2005-06-30 Thread bruno modulix
Statesman wrote: > In English: > > I don't know much about python and I won't have much time to learn much > about it even if it seems powerful... > (snip code) > Here is an error I get trying to run this script: > > AttributeError: 'string' object has no attribute 'index' > > According to me,

Re: script fichiers binaires lecture écriture

2005-06-30 Thread bruno modulix
Statesman wrote in comp.lang.python: Hi Statesman comp.lang.python is the english-speaking Python forum. You may want to try the french-speaking one at fr.comp.lang.python (xpost and fu2 set) > Je connais mal python et n'est pas trop le temps de m'y plonger bien > que cela semble être assez pui

Re: Store multiple dictionaries in a file

2005-06-30 Thread bruno modulix
Philipp H. Mohr wrote: > Hello, > > I would like to store multiple dictionaries in a file, if possible one per > line. Why "one per line" ? > My code currently produces a new dictionary every iteration and > passes it on to another peace of code. May this code rest in piece > In order to be

Re: I am a Java Programmer

2005-07-04 Thread bruno modulix
[EMAIL PROTECTED] wrote: > I am a java programmer Too bad :( > and I want to learn Python So there's still hope !-) > Please help me. 1/ download and install Python 2/ go thru the 'dive into Python' and 'Thinking in Python' free books 3/ post here when you're in doubt or in trouble... And don'

Re: How to compare files

2005-07-04 Thread bruno modulix
Lad wrote: > Hi, > What is the best method for comparing two files by words? try the difflib module: http://www.python.org/doc/2.4.1/lib/module-difflib.html -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" --

Re: How do you program in Python?

2005-07-04 Thread bruno modulix
anthonyberet wrote: > My question isn't as all-encompassing as the subject would suggest... > > I am almost a Python newbie, but I have discovered that I don't get > along with IDLE, as i can't work out how to run and rerun a routine > without undue messing about. > > What I would really like is

Re: How do you program in Python?

2005-07-04 Thread bruno modulix
Roy Smith wrote: > bruno modulix <[EMAIL PROTECTED]> wrote: > > >>Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still >>looking for a better and more versatile code editor/IDE - specially when >>it comes to languages with REPL (-> Read

Re: python nested class

2005-07-08 Thread bruno modulix
Roland Heiber wrote: > Vedanta Barooah wrote: > >> o = mother() >> o.show() >> y=mother.child() >> y.increase(20) >> # this should print 20 >> o.show() >> >> .. is it possible somehow ??? > > > Hi, > > this should do what you want: > > --- test.py > class mother: > x=0 > def __init

Re: Pattern question

2005-07-08 Thread bruno modulix
cantabile wrote: > Hi, > > I'm trying to write a small installer for a server. But this program > should be able to run in the future under heterogenous environments and > os (at least linux/windows). I mean, the install will be done either in > text mode or curses or gtk or tk, either in debian o

Re: Python Forum

2005-07-11 Thread bruno modulix
Throne Software wrote: > Throne Software has opened up a Python Forum at: > > http://www.thronesoftware.com/forum/ > > Join us! > Why should we ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://ma

Re: Slicing every element of a list

2005-07-13 Thread bruno modulix
Alex Dempsey wrote: > Recently I tried to slice every element of a list of strings. First I tried: > > f = open("export.xls", "r") http://www.python.org/doc/2.4.1/lib/module-csv.html (snip, see other posts in this thread) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for

Re: Couple quick questions from a Python Noob

2005-07-21 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Hey, I just started on Python and have a few questions I couldn't find > answers to on the Python site or it's tutorial. > > 1. I notice a few "compiled python" files (indicated by reddish snake > icons), I thought Python didn't need to be compiled? This is my first > v

Re: File Table List in Plone

2005-07-21 Thread bruno modulix
[EMAIL PROTECTED] wrote: > All, > > Is there is a Plone type or product for generating a file list on a > plone page, eg: a list of downloadable files in a table? An example of > what I want can be found at > http://www.zope.org/Members/MacGregor/ExtFile under "Available > Releases" where a list

Re: Stupid question: Making scripts python-scripts

2005-07-22 Thread bruno modulix
Jan Danielsson wrote: > Hello all, > >How do I make a python script actually a _python_ in unix:ish > environments? > > I know about adding: > #!/bin/sh > >..as the first row in a shell script, but when I installed python on > a NetBSD system, I didn't get a "python" executable; only a "

Re: Getting a dictionary from an object

2005-07-25 Thread bruno modulix
John Machin wrote: > Dark Cowherd wrote: > >>> voiceless-ly'rs >> >> >> What does this mean?? Just curious (googled that and ly'rs and didnt >> find anything relevant) s/ly'rs/ly y'rs/ > The voiceless part I understand to mean that Bruno is "shocked and > stunned and not a little bit amazed" [1]

Re: Create a variable "on the fly"

2005-07-27 Thread bruno modulix
Paul D.Smith wrote: > Can Python create a variable "on-the-fly". For example I would like > something like... > > make_variable('OSCAR', 'the grouch'); > print OSCAR; > > ...to output... > > the grouch > > Anything like this in Python? The bad news is that yes, there is something "like this"

Re: functions without parentheses

2005-07-28 Thread bruno modulix
Simon Dahlbacka wrote: > If you actually want that kind of syntax, then why don't you use Visual > Basic? ;) s/VisualBasic/Ruby/ -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- http://mail.python.org/

Re: functions without parentheses

2005-07-28 Thread bruno modulix
Jerry He wrote: > Hi, > Is it possible to create a function that you can use > without parenthesizing the arguments? for example, for > > def examine(str): > . > . > > Is there some way to define it so that I can call it > like > > examine "string" > instead of examine("str

Re: calling functions

2005-08-02 Thread bruno modulix
anthonyberet wrote: > This is the first time I have tried out functions (is that the main way > of making subroutines in Python?) A function is allowed to change it's arguments and to return None, so yes, you can consider it as a 'subroutine'. > > Anyway, my function, mutate, below > > #make a

Re: Newer than a Newbe

2005-08-02 Thread bruno modulix
None wrote: > Hello, > I am just starting to look into python.I have been prog with php for > several years.My question is: > Can/Is Python used as a web scripting language Yes, definitively. There are in fact almost too many web-programming solutions in Python, from the good ole cgi to the

Re: Python IDE's

2005-08-03 Thread bruno modulix
Jon Hewer wrote: > I do use Vim a lot. I am currently using it for some PHP development > i'm doing. I'm been using it so much recently that i keep pressing > ESC and typing vi commands out of vi. > > But, if i use Vi, then whenever i want to test some code i have to > open up python, import the

Re: Python -- (just) a successful experiment?

2005-08-08 Thread bruno modulix
Eric Pederson wrote: > Raise your hand if you think the best technology wins! > Those who have raised hands should google for "worse is better"... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://ma

Re: What are modules really for?

2005-08-10 Thread bruno modulix
N.Davis wrote: (snip) > Functions existing in a module? Surely if "everything is an object" (OK > thats Java-talk but supposedly Python will eventually follow this too) > then there should be nothing in a module thats not part of a class. Why ? The name of the paradigm is *object* oriented, not *c

Re: What are modules really for?

2005-08-10 Thread bruno modulix
Neil Benn wrote: (snip) > If you don't have a class how can you combine functionality with data > and hold state In Python, functions can hold state in various ways: closures, generators, and - Python functions being instances of the function class - attributes. > - that is one of the points of

Re: Python supports LSP, does it?

2005-08-10 Thread bruno modulix
Roy Smith wrote: > Andy Leszczynski writes: > (snip) >>It's not a true statement. Nothing in the language enforces LSP. In >>fact, there's not even a [way?] when a function/method is invoked to make >>sure the type passed in is a subtype of the type you expect > > > Well, that's not entirely t

Re: What are modules really for?

2005-08-10 Thread bruno modulix
Tito wrote: >> [1] 'aName' => public, '_aName' => protected, '__aName' => private > > > I didn't know this one, as I am quite new to Python. Is it really > general use? Yes, it's the convention. Well, to be more exact, this is: name => interface (intended for public use) _name => implementati

Re: What is Python?!

2005-08-10 Thread bruno modulix
Roy Smith wrote: > Robert Wierschke <[EMAIL PROTECTED]> wrote: > >> a scripting language or a "normal" language like C++ etc. > > > It is difficult to define exactly what a "scripting language" is and isn't, You can tell buy the most common use. bash is a scripting language, javascript is

Re: What are modules really for?

2005-08-11 Thread bruno modulix
Neil Benn wrote: (snip) >> > Suppose you have a logistics tracking system available on every install > in your company - there are 55 installs throughout the company. You > wish to push through a patch because of a problem. If you have one > class per file you can push that class through onto the

Re: What are modules really for?

2005-08-11 Thread bruno modulix
Magnus Lycka wrote: > N.Davis wrote: > >> Functions existing in a module? Surely if "everything is an object" >> (OK thats Java-talk but supposedly Python will eventually follow this >> too) > > > int too? ;) Yes, int too. >>> i = 42 >>> i.__class__ >>> i.__class__.__name__ 'int' >>> dir(i)

Re: len(sys.argv) in (3,4)

2005-08-11 Thread bruno modulix
Daniel Schüle wrote: > Hello > > I wrote a simple module, which is also supposed to be used as standalone > program > after considering how to avoid multiple if's I came up with this idea > > if __name__ == "__main__": > if len(sys.argv) not in (3,4): > print "usage: prog arg1 argv2

Re: How do these Java concepts translate to Python?

2005-08-12 Thread bruno modulix
Ray wrote: > Hello, > > I've been learning Python in my sparetime. I'm a Java/C++ programmer by > trade. So I've been reading about Python OO, and I have a few questions > that I haven't found the answers for :) > > 1. Where are the access specifiers? (public, protected, private) object.name =>

Re: How do these Java concepts translate to Python?

2005-08-12 Thread bruno modulix
Devan L wrote: > Fausto Arinos Barbuto wrote: > >>Ray wrote: >> >> >>>1. Where are the access specifiers? (public, protected, private) >> >>AFAIK, there is not such a thing in Python. >> >>---Fausto > > > Well, technically you can use _attribute to mangle it, __attribute would work better

Re: How do these Java concepts translate to Python?

2005-08-12 Thread bruno modulix
Ray wrote: > Fausto Arinos Barbuto wrote: > >>Ray wrote: >> >> >>>1. Where are the access specifiers? (public, protected, private) >> >>AFAIK, there is not such a thing in Python. > > > So everything is public? I know that you can prefix a member with > underscores to make something private,

Re: Python's Exception, and Capitalization

2005-08-12 Thread bruno modulix
Ray wrote: > Hello guys, > > OK, I've been reading some more about Python. There are some things > about Python exception that I haven't been able to grasp: > > 1. This is a small thing, but why is object spelled "object", and the > mother of all exception "Exception" (with capital E)? Why is not

Re: How do these Java concepts translate to Python?

2005-08-12 Thread bruno modulix
Ray wrote: > Roy Smith wrote: > >>Quick answer; there are none, all attributes are public. >> (snip) > > Well yeah... if you really want it, in Java you can do that too via > reflection. Just that I'm not used to it yet so I feel a bit jittery > with so much power on my hands! Then wait until yo

Re: What are modules really for?

2005-08-13 Thread bruno modulix
Magnus Lycka wrote: > bruno modulix wrote: > >> Magnus Lycka wrote: >> >>> N.Davis wrote: >>> >>> >>>> Functions existing in a module? Surely if "everything is an object" >>>> (OK thats Java-talk but s

Re: Dictionary inheritance

2005-08-13 Thread bruno modulix
Devan L wrote: > Talin wrote: > >>I want to make a dictionary that acts like a class, in other words, >>supports inheritance: (snip) > > Dictionaries aren't classes? They are. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECT

Re: Dictionary inheritance

2005-08-13 Thread bruno modulix
Talin wrote: > I want to make a dictionary that acts like a class, in other words, > supports inheritance: I must be missing your point here, since dict is a class and as such support inheritence: >>> class MyDict(dict):pass ... >>> d = MyDict() >>> d.items() [] >>> > If you attempt to find a

Re: need help with my append syntax

2005-08-13 Thread bruno modulix
yaffa wrote: > dear folks, Dear Yaffa, > i'm trying to append a semicolon to my addr string Python strings don't have a 'append' method. > and am using the > syntax below. for some reason the added on of the ; doesn't work. "doesn't work" is the worst possible description of a problem. Pleas

Re: looping list problem

2005-08-17 Thread bruno modulix
Fredrik Lundh wrote: > Jon Bowlas wrote: (snip) >>But I get the following error- Line 5: Yield statements are not allowed. > > > umm. I might be missing something, but I cannot find any trace of that > error message in the Python interpreter source code. it doesn't even look > like a Python tr

Re: how do i add a new path into sys.path?

2005-08-18 Thread bruno modulix
wen wrote: > on my system(win2k server, python 2.3.5), > import sys print sys.path > > ['C:\\', 'C:\\WINNT\\system32\\python23.zip', > 'C:\\Python23\\lib\\site-packages\\Pythonwin', > 'C:\\Python23\\lib\\site-packages\\win32', > 'C:\\Python23\\lib\\site-packages\\win32\\lib', > 'C:\\Pytho

Re: python classes taught

2005-08-20 Thread bruno modulix
[EMAIL PROTECTED] wrote: > anyone know of any college/school that is teaching the python language? > Bordeaux University (France) uses Python in a "programming 101" course. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.sp

Re: Decorator and Metaclasses Documentation

2005-08-22 Thread bruno modulix
Mike C. Fletcher wrote: (snip) > Though the don't go into extreme detail on decorators (they are > basically syntactic sugar for a particular type of descriptor). > Err... Could you elaborate on this ? Decorators are syntactic sugar for function wrapping, while descriptors are a 'protocol' to hook

Re: loop in python

2005-08-22 Thread bruno modulix
km wrote: > Hi all, > > Why is it that the implementation of empty loop so slow in python when > compared to perl ? > > #i did this in python (v 1.5) Python 1.5.2 was released in april 1999. Current Python version is 2.4.1. Please consider upgrading - unless of course you just want to troll..

Re: Python and the web

2005-08-23 Thread bruno modulix
Joe T. wrote: > Hello group, I'm new to Python and have a couple of beginner questions that > I'm hoping someone can answer. > > 1. Is python something that you would recommend using for server side web > programming? Definitively yes. > Something like C# or Java? Far better IMHO. > If so,

Re: loop in python

2005-08-23 Thread bruno modulix
Terry Reedy wrote: > "Benjamin Niemann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > (snip) >>In that case, you are interested in IO performance. The time spent >>handling >>the loop is not significant compared to the time spent executing the >>'print' statement - which is a v

Re: loop in python

2005-08-23 Thread bruno modulix
Steve Holden wrote: (snip) > If you want a fast language, try Holden. I've just invented it. > Unfortunately it gets the answer to every problem wrong unless the > answer is 42, but boy it runs quickly. The code for the whole > interpreter (it's written in Python) follows: > > print 42 > keyboar

Re: loop in python

2005-08-23 Thread bruno modulix
km wrote: >>If you want a fast language, try Holden. I've just invented it. >>Unfortunately it gets the answer to every problem wrong unless the >>answer is 42, but boy it runs quickly. The code for the whole >>interpreter (it's written in Python) follows: > > >>print 42 > > > great ! u can

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear All > > What i want to do is , my input is like > 0 2 > 0 3 > 0 4 > 1 2 > 1 4 > 2 3 > 3 4 > > I am comparing and put the number in group , like ,the first three lines > , all has zero as first input for each line, so the out put should look > like > 0 2 3 4 > and so o

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear all > > Sorry , I confused between two things , what i said in the last e-mail i > already managed to do using C code , But what i need to do using python > is : my input data : > > 0 2 3 4 > 1 2 4 > 2 3 > 3 4 > > what i suppose to do is , using the first line and

Re: how to deal with space between numbers

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear All > > This is my problem again , (snip) > > I managed to do all these things , but i did it in the way that i am > reading my data as strings ( no space between numbers) something like > > 0124 > 124 > 23 > 34 > > what i would like to know or to do is , how can i

Re: pipes like perl

2005-08-23 Thread bruno modulix
max(01)* wrote: > hi. (snip) > it doesn't work, since "*do_something*" and *do_something_more* are > always executed (it seems like > > MYPIPE = os.popen("*some_system_command*", "r") > > does not raise any exception even if *some_system_command* does not > exist/work... > > any help? http://

Re: loop in python

2005-08-24 Thread bruno modulix
Terry Hancock wrote: > On Tuesday 23 August 2005 05:35 am, bruno modulix wrote: > (snip) >> >>If you hope to be taken seriously, please abandon the sms-talk style here. >> > > > I think it's reasonably clear that neither poster hoped "to be taken >

Re: What's the matter with this code section?

2005-08-24 Thread bruno modulix
Johnny Lee wrote: > Here is the source: > (snip) > class TestCaseTest(TestCase): > def testRunning(self): > print "testRunning in TestCaseTest" > test = WasRun("testMethod") > assert(not test.wasRun) > test.run() > assert(

Re: how to deal with space between numbers

2005-08-24 Thread bruno modulix
Mohammed Altaj wrote: > > Thanks a lot for your valuable answer, i like the way you code , Thanks. > but i > would like to use my own, so if it is possible for you and if you have > time, please could you fix my code, so that i can do what i want. > Because i am using the this out put to anoth

Re: FileIO problem

2005-08-24 Thread bruno modulix
Laszlo Zsolt Nagy wrote: > Try this: > > gclas = raw_input("What is the class:") > def Princlas(): >count = 0 >while count != 1000: >count = count + 1 >return "Admin forceclass %s %s " % ( count , gclas ) have you tried your code ? Obviously, no, else you would have seen t

Re: variable hell

2005-08-25 Thread bruno modulix
Nx wrote: > Thanks for the many replies > > here is an example for what it will be used for , in this case > fixed at 31 fieldvalues: > > > inputvalues=(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25, > s26,s27,s28,s29,s30,s31) >MYINS

Re: variable hell

2005-08-25 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Hey, if the man wants to write it that way, let the man write it that > way. If it works for him, great... he's sure confused the heck out of > all of us, and that translates into job security for him! As you can > see, the name of the post is 'variable hell' and that is

  1   2   3   >