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: [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: 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: 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: 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: 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: [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
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: 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: 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-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: 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: 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: 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: 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: 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: [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: 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: 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: 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 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: 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: "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: 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-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: "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
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: 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: 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: 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: 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: 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: Help w/ easy python problem

2005-09-22 Thread bruno modulix
[EMAIL PROTECTED] wrote: > I am very much a beginner to python. I have been working on writing a > very simple program and cannot get it and was hoping someone could help > me out. Basically i need to write a code to print a sin curve running > down the page from top to bottom. The trick is I ha

Re: using variable-value

2005-09-21 Thread bruno modulix
Tor Erik Sønvisen wrote: > Hi > > In php I can assign a value to a variable and use this varaible to access a > property in some object: > > $var = 'property'; > $object->{$var} > > This will transelate to $object->property... > Is this possible in Python? Not directly, but there's a way: geta

Re: Organising a python project

2005-09-20 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Dear all, > > Can anyone point me to a resource that describes the best way of > organising a python project? My project (gausssum.sf.net) is based > around a class, and has a GUI that allows 'easy-access' to the methods > of the class. Err... Unless it's a *very* simp

Re: functional or object-oriented?

2005-09-20 Thread bruno modulix
beza1e1 wrote: > This nails it down, yes. :) > > I probably was too deep into OOP thinking-mode to work pythonic. So i > am now rediscovering the python way. > > Have you read Paul Grahams On Lisp (or was it one of his essays)? He is > strongly in favor of functional programming. Yes, but this d

Re: Why doesn't IDLE editor windows have horizontal scrollbars?

2005-09-16 Thread bruno modulix
chuck wrote: > The browser windows do. Why not the editor windows? > > I hate to complain but is there any way to get IDLE to run in more of > an MDI mode? Having the floating windows everywhere is rather > confusing to me. > IDLE is open source, so you may want to consider contributing to it

Re: Lines of Strings

2005-09-16 Thread bruno modulix
Reem Mohammed wrote: > Hi > > Suppose we have data file like this one (Consider all lines as strings ) > > 1 2 3 3 4 4 4 4 5 6 > 2 2 2 5 5 5 6 > 3 2 1 1 1 3 3 3 4 6 > > I would like to remove line if its belong to another one, and will be > able to do this if longer line come after a short one.

Re: change an element of a list

2005-09-15 Thread bruno modulix
Dirk Hagemann wrote: > THANKS! That works :-) Of course it works. Why wouldn'it it work ?-) > But meanwhile I found another solution that works in my case. Out of > this list of tuples I generated a SQL-Statement which is a simple > string. Then I simply checked this string for 'None'. May be too

Re: change an element of a list

2005-09-15 Thread bruno modulix
Dirk Hagemann wrote: > Hi! > > I have a list of lists and in some of these lists are elements which I > want to change. > Here an example: > lists=[('abc', 4102, 3572), ('def', 2707, 'None'), ('ghi', 'None', 4102)] > > 'None' should be replaced by 0 or NULL or something else. Your list is a

Re: ddd or eclipse with mod_python

2005-09-15 Thread bruno modulix
Sakcee wrote: > Hi > > I am using mod_python for web development, I am in need of some ide , > can i use ddd or eclipse with pydev with mod_python. Don't know, but you may want to check Eric3, a full blown Python IDE with support for mod_python debugging. -- bruno desthuilliers python -c "prin

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Adriaan Renting wrote: > In my mind all Python variables are some kind of "named pointers", Technically, they are key/value pairs in a dictionnary, the key being the name and the value a reference to an object. > I > find that thinking this way helps me a lot in understanding what I'm > doing. I

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Johnny Lee wrote: > bruno modulix wrote: > >>I dont see anything interesting nor problematic here. If you understand >>the difference between class attributes and instance attributes, the >>difference between mutating an object and rebinding a name, and the >>at

Re: Unexpected Behavior Iterating over a Mutating Object

2005-09-14 Thread bruno modulix
Dave Hansen wrote: (snip code snippets and sensible explanations) > Again, iterating over an item that is mutating seems like a Bad > Idea(tm) to me. It as *always* been a bad idea to modify a list in place (I mean adding or removing items) while iterating over it, whatever the language. If you

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Johnny Lee wrote: > Hi, >Look at the follow command in python command line, See what's > interesting?:) > > class A: > > i = 0 > a = A() b = A() a.i = 1 print a.i, b.i > > 1 0 Quite what I would expect. First you declare i as being a *class* attribute of A, with

Re: Redundant code in multiple methods

2005-09-13 Thread bruno modulix
Rob Conner wrote: > Genius! Nope. Just common Python idioms... > Thanks guys that was exactly the help I was looking for. I'll be > implementing this later today. I don't forsee any problems, so if I > don't post anything else, thank you so much for the help. You're welcome. -- bruno desthuill

Re: [OT] Zope, ZPT and slots

2005-09-13 Thread bruno modulix
Jaroslaw Zabiello wrote: > I would like to lauch macro from another zpt file. (snip - tech answer in private) Please stop posting Zope and ZPT related questions here. There are mailing-lists dedicated to Zope. That's where you'll get the good answers. -- bruno desthuilliers ruby -e "print '[EM

Re: ZPT and "incompatible version None" error :(

2005-09-13 Thread bruno modulix
Jaroslaw Zabiello wrote: > Dnia Mon, 12 Sep 2005 16:51:48 +0200, Jaroslaw Zabiello napisał(a): > > >>Another ZPT file try to fill one slot: >> >> >> Search|Read|Compare|History >> >> >>When I try to open it, I get the error mentioned above. Any idea? > > > Solution was trivial > > Duh ! I s

Re: Simplifying imports?

2005-09-13 Thread bruno modulix
[EMAIL PROTECTED] wrote: > I like to keep my classes each in a separate file with the same name of > the class. Let me guess: you have a C++ or Java background ?-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')

Re: How to protect Python source from modification

2005-09-12 Thread bruno modulix
Frank Millman wrote: > Peter Hansen wrote: > >>Frank Millman wrote: >> (snip) >>>The only truly secure solution I can think of would involve a radical >>>reorganisation of my program >> >>Please define what "truly secure" means to you. >> > > > Fair question. I am not expecting 'truly' to mean 1

Re: How to protect Python source from modification

2005-09-12 Thread bruno modulix
Frank Millman wrote: > Hi all > > I am writing a multi-user accounting/business system. Data is stored in > a database (PostgreSQL on Linux, SQL Server on Windows). I have written > a Python program to run on the client, which uses wxPython as a gui, > and connects to the database via TCP/IP. > >

Re: ZPT and "incompatible version None" error :(

2005-09-12 Thread bruno modulix
Jaroslaw Zabiello wrote: > I got strange errors in Zope 2.7. 2.7.? > > METALError > macro 'context/base' has incompatible version None, at line 1, column 1 > (snip) > > When I try to open it, I get the error mentioned above. Any idea? > yes : try posting on a Zope/Plone related mailin

Re: Redundant code in multiple methods

2005-09-12 Thread bruno modulix
Rob Conner wrote: > No you don't need to know Zope to help me. The whole reason I'd even > want to do this is because of Zope though. I made a Zope product, and > now want to perfect it. > > some simple example code... > > > class User: > > def View(self): > # play with data here >

Re: How to dynamicly define function and call the function?

2005-09-09 Thread bruno modulix
FAN wrote: > I want to define some function in python script dynamicly and call > them later, but I get some problem. I have tried the following: > > ## > # code > ## > class test: > def __init__(self): > exec("def

Re: Django Vs Rails

2005-09-06 Thread bruno modulix
D H wrote: > bruno modulix wrote: > >> D H wrote: >> >> (snip) >> >>> Go with Rails. Django is only like a month old. >> >> >> Please take time to read the project's page. Django has in fact three >> years of existence and i

Re: Generators and Decorators doing my head in ..

2005-09-06 Thread bruno modulix
Paul McGuire wrote: (snip) > (This is a quick-and-dirty example, but it works. A proper iterator s/iterator/decorator/ (snip) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailma

Re: Django Vs Rails

2005-09-06 Thread bruno modulix
D H wrote: (snip) > Go with Rails. Django is only like a month old. Please take time to read the project's page. Django has in fact three years of existence and is already used on production websites, so it's far from pre-alpha/planning stage. -- bruno desthuilliers python -c "print '@'.join

Re: [OT] HTML tags optimization

2005-09-02 Thread bruno modulix
DENG wrote: (snip same post as two days ago) In case you don't know, google.groups is just a web interface (and archive) to usenet groups. No need to repost the same question twice... BTW, for what you want to do (which is mostly a waste of time IMHO, but what, that's your time, not mine), the

Re: descriptors for container items

2005-09-02 Thread bruno modulix
Terry Reedy wrote: > "Brock Filer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>countries['us']['Colorado']['Denver']['@population'] >> >>This is going to be used in user-input formulae, so I'm willing to do a >>lot of work for minor beautifications. I'd like to be able to sa

Re: Adding bound methods dynamically... CORRECTED

2005-09-01 Thread bruno modulix
Mike Meyer wrote: > bruno modulix <[EMAIL PROTECTED]> writes: > >>Devan L wrote: >> >>>Kevin Little wrote: >>> >>> >>>>I want to dynamically add or replace bound methods in a class. >> >>(snip) >> >> &

Re: HTML tags optimization [better learn CSS]

2005-09-01 Thread bruno modulix
DENG wrote: > I know very well Tidy, sir > > Tidy do a nice job but it is writen in Java, Seems like we're not talking about the same program here. Tidy (aka HTMLTidy) is written in C. You must be talking about it's Java port JTidy. > and have Python ported > > my aim is to learn Python, learn

Re: Well, Reading is hard to learn...

2005-09-01 Thread bruno modulix
wen wrote: > due to the work reason, i have to learn python since last month. i have > spent 1 week on learning python tutorial and felt good. but i still don't > understand most part of sourcecode of PYMOL(http://pymol.sourceforge.net/) > as before. > > it sucks. > I have spent 1 week on learn

Re: Bicycle Repair Man usability

2005-08-31 Thread bruno modulix
matt wrote: (snip) > I'd like to hear other's experiences with refactoring in python. Most > of the projects I work on are quite small relative to some of the Java > projects I've worked on. Python being much less verbose and much more dynamic than Java, the LOCs/functionnalities ratio can be v

Re: Adding bound methods dynamically... CORRECTED

2005-08-31 Thread bruno modulix
Devan L wrote: > Kevin Little wrote: > >>I want to dynamically add or replace bound methods in a class. (snip) > I'm not an expert, but why do you need to dynamically add or replace > bound methods? To modify the behaviour at runtime ?-) There are a lot of idioms/patterns in dynamic language

Re: problem with classes

2005-08-26 Thread bruno modulix
cfgauss wrote: > I am having a strange problem with classes. I'm fairly sure the > problem is with classes, anyway, because when I re-write the program > without them, it works like I'd expect it to. > > When I run this program, at first, L[0].z[1] is 0, because z=[0,0]. > But after I run that lo

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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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
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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: > 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: 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: > 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: 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: 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: 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 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-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: 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
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

  1   2   3   >