Re: Costly object creation (was : Having Trouble with Scoping Rules)

2006-01-31 Thread bruno at modulix
Charles Krug wrote: > List: > > I've a module that's not doing what I expect. My guess is that I don't > quite understand the scoping rules the way I should. > > I have an object that's costly to create. My thought was to create it > at the module level

Re: A simple question string.replace

2006-01-31 Thread bruno at modulix
Haibao Tang wrote: > I have a two-column data file like this > 1.12.3 > 2.211.1 > 4.31.1 > ... > Is it possible to substitue all '1.1' to some value else without using > re. I suppose that you don't want '11.1' to be affected. raw_data=""" 1.12.3 2.211.1 4.31.1 """ data =

Re: test whether 2 objects are equal

2006-01-31 Thread bruno at modulix
Yves Glodt wrote: > Hello, > > > I need to compare 2 instances of objects to see whether they are equal > or not, but with the code down it does not work (it outputs "not equal") > > > #!/usr/bin/python > > class Test: > var1 = '' > var2 = '' Take care, this creates two *class* variab

Re: OO conventions

2006-02-03 Thread bruno at modulix
e object via the superclass type. Why "via the superclass type" ? "returns the object" is enough. > The caller can then either check a flag in the superclass to see what > type the subclass is, Why the h... ? We don't care what type it is, as long at it does what we

Re: Another try at Python's selfishness

2006-02-03 Thread bruno at modulix
ly exist) when this code is eval'd (how could an instance of class Foo exists before class Foo itself exists ?). > That way, the declaration would match the invocation (at least > syntactically), and the "magic"-feeling is gone. In the long run, the > "old-style" synt

Re: Regular expression query

2006-02-03 Thread bruno at modulix
Martin Biddiscombe wrote: > It's probably quite simple, but what I want is a regular expression If it's simple, then you probably *dont* want a regexp. > to > parse strings of the form: > > "parameter=12ab" > "parameter=12ab foo bar" > "parameter='12ab'" > "parameter='12ab' biz boz" > "parameter

Re: problems writing tuple to log file

2006-02-03 Thread bruno at modulix
for oText in incident.fetchText( oRE): > drinklist += oText.strip() + "','" idem > drink = ''.join(drinklist) idem > print drink > > > > > tuple = (food + drink "\n

Re: Compiling

2006-02-03 Thread bruno at modulix
Simon Faulkner wrote: > Pardon me if this has been done to death but I can't find a simple > explanation. > > I love Python for it's ease and speed of development especially for the > "Programming Challenged" like me but why hasn't someone written a > compiler for Python? But there *is* a compile

Re: Python on Windows

2006-02-03 Thread bruno at modulix
Simon Faulkner wrote: > I've just written my first (simple) WxPython program - yy! > > What would folks suggest is the easiest way to package it to run on > other windows PCs? I can't tell for sure since I do not use Windows, but I think Py2Exe is what you're looking for. -- bruno desthui

Re: Compiling

2006-02-03 Thread bruno at modulix
compiler compiles Python source code to Python bytecode, which is then executed by the Python interpreter. You may not have noticed - since the Python interpreter is smart enough to call the compiler when needed - but Python is compiled to bytecode before execution. Just look at all the .pyc files o

Re: Regular expression query

2006-02-06 Thread bruno at modulix
Giovanni Bajo wrote: > Martin Biddiscombe wrote: > > >>"parameter=12ab" >>"parameter=12ab foo bar" >>"parameter='12ab'" >>"parameter='12ab' biz boz" >>"parameter="12ab"" >>"parameter="12ab" junk" > > import shlex def extract(s): > > ... s = s.split("=")[1] > ... s = shlex.split

Re: fairly large webapp: from Java to Python. experiences?

2006-02-07 Thread bruno at modulix
n Java may end up as a small/medium app with Python !-) > I was sniffing around the following A-team of toolkits: CherryPy, > Cheetah, SQLObject, all behind Apache2. If you plan to run behind Apache2, you may want to have a look at Myghty. It's somewhere between a framework and a tem

Re: Too Many if Statements?

2006-02-07 Thread bruno at modulix
s that I may have hit a wall with > 'if' statements. > > Due to the number of checks perfromed by the script on the text files, > (over 500), there are quite a few 'if' statements in the script, (over > 1150). It seems that it is at the point that when I add any

Re: Too Many if Statements?

2006-02-07 Thread bruno at modulix
code. > I guess what I > am trying to say is that in order to make the many checks on the > configuration files I do not know of any other way than to check for > the existance of particular statements, (strings), and then report on > those if they are incorrect or missing - hence at

Re: Too Many if Statements?

2006-02-08 Thread bruno at modulix
Pierre Quentel wrote: > This is because Python has a hidden mechanism to detect programs > generated by Perl scripts, and make them crash with no explanation > KEYBOARD ! -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.spl

Re: Python Class use

2006-02-08 Thread bruno at modulix
S Borg wrote: > Hello, > > I am running Python on Mac OS X. The interpreter has been great for > learning the basics, but I would now like to be able to reuse code. > How do I write reusable code? I have done it "The Java way": write > the class, and save it to my home directory, then call it fr

Re: 450 Pound Library Program

2006-02-08 Thread bruno at modulix
elf.stacks) == 0: > self.cv.wait() > print "%s waiting for a book..." %readerName > book = self.stacks.pop(0) This last line will crash (IndexError) on an empty list, and then the resource may not be released... A first step would be to enclose

Re: 450 Pound Library Program

2006-02-08 Thread bruno at modulix
Magnus Lycka wrote: > just a few style notes... > (snip) > > Why bother with L? The follwing is as clear I think, and solves > the problem of commas in the title. Also, don't put a space between > the callable and the parenthesis please. See the Python style guide, > PEP 008. > > aut

Re: module with __call__ defined is not callable?

2006-02-08 Thread bruno at modulix
Steve Holden wrote: (snip) > The pursuit of orthogonality, while admirable, can lead to insanity if > pushed too far. > +1 QOTW -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailm

Re: 450 Pound Library Program

2006-02-08 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Ok, > > I give up. DRY = Don't Repeat Yourself (google Pragmatic Programmers) > but SPOT? Google is little help here, SPOT is too common a word. Single Point Of Truth (or Single Point Of Transformation) And before you mention it, yes, it's *almost* the same thing as D

Re: 450 Pound Library Program

2006-02-08 Thread bruno at modulix
was SPOT4 > (Le Systeme Pour 'l Observation de la Terre) but that's > probably not it... Probably not !-) > Single Point Of Truth? And the winner is... > It seems some claim that DRY and > SPOT are the same things. > http://www.artima.com/cppsource/reducepnp3.html

Re: how to remove using replace function?

2006-02-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > i have some html that looks like this > > > 34 main, Boston, MA > > and i am trying to use the replace function to get rid of the that > i scrape out using this code: > > for oText in incident.fetchText( oRE): > strTitle += oText.strip() Why concatening

Re: Finding the public callables of self

2006-02-09 Thread bruno at modulix
Sion Arrowsmith wrote: > Russell Warren <[EMAIL PROTECTED]> wrote: (snip) > At first I thought self.__dict__ would do it, but callable methods >>seem to be excluded so I had to resort to dir, and deal with the >>strings it gives me. > > This last sentence

Re: read-only attributes

2006-02-10 Thread bruno at modulix
limodou wrote: > On 2/10/06, john peter <[EMAIL PROTECTED]> wrote: (snip) >> what do i have to do if i want my application code to have >>read-only >> attributes? >> > I think you may consider property() built-in function: > > property( [fget[, fset[, fdel[, doc) > > Return a property attrib

Re: breaking from loop

2006-02-10 Thread bruno at modulix
Ritesh Raj Sarraf wrote: > Hi, > > Following is the code: > > def walk_tree_copy(sRepository, sFile, sSourceDir, bFound = None): > try: > if sRepository is not None: You're being overly defensive here. Passing None as first arg is clearly a programming error, so the sooner you detect

Re: Too Many if Statements?

2006-02-10 Thread bruno at modulix
slogging_away wrote: > It appears it may not be a 'if' statment limitation at all. This is > because I added another 800 element array Looks like a memory problem then... > in which to store the various > error messages generated when a configuration file error is dete

Re: Too Many if Statements?

2006-02-13 Thread bruno at modulix
slogging_away wrote: > bruno at modulix wrote: > > >>Looks like a memory problem then... > > > The system I am using has 2GB of memory, (unless you are syaing the > memory is faulty). Nope, just that I don't know of any system with unlimited memory. BTW, havin

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

2006-02-13 Thread bruno at modulix
HappyHippy wrote: > More of a minor niggle than anything but how would I remove the > aforementioned space? > eg. > strName = 'World' > print 'Hello', strName, ', how are you today?' Already got an anwser, now just a coding-style suggestion: hungarian notation is *evil*. And even *more* evil wi

Re: Location of Python modules

2006-02-13 Thread bruno at modulix
Byte wrote: > Pretty much self explanatry, where are Python modules stored in Linux? > (i.e. in /usr/bin/local, or where?) > Depends on how you installed Python (or how your distro package system installed it). But it's usually in $PREFIX/lib/pythonX.X , with $PREFIX being one of /usr or /usr/loca

Re: Loop Backwards

2006-02-14 Thread bruno at modulix
but I don't want to. I want it to > stay exactly the same, but I want to start at the end and end at the > beginning. for item in reversed(alist): do_something_with(item) or (more perlish at first sight): for item in alist[::-1]: do_something_with(item) -- bruno desthuilliers p

Re: Python / Apache / MySQL

2006-02-14 Thread bruno at modulix
vpr wrote: > Hi All > > I want to build an Website using Apache / Python and MySQL. Good choice, good choice, bad choice... Why not using PostgresSQL (if you need a *real* RDBMS) or SQLite (if you don't...) > I dont want to spend to much time hacking html. I'm looking for some > recommendations

Re: Pythonic gui format?

2006-02-14 Thread bruno at modulix
DH wrote: > Bruno Desthuilliers wrote: > >>> I am currently seeking for pythonic alternative for XML. >> >> >> A pretty obvious one is dicts and lists. What about (Q&D): > > > That's like JSON: http://www.json.org/example.html No, it's pure Python. It happens that JSON looks pretty close to Py

Re: Python / Apache / MySQL

2006-02-14 Thread bruno at modulix
Kalle Anke wrote: > On Tue, 14 Feb 2006 10:32:34 +0100, Sybren Stuvel wrote > (in article <[EMAIL PROTECTED]>): > > >>I second Bruno: swap MySQL in favour of PostgreSQL. > > > And the reason is ?? (apart from PostgreSQL being larger and more complete, > what are the differences for "simple" us

Re: Unexpected behaviour of getattr(obj, __dict__)

2006-02-14 Thread bruno at modulix
Steven D'Aprano wrote: > I came across this unexpected behaviour of getattr for new style classes. > Example: > > class Parrot(object): > > ... thing = [1,2,3] > ... > getattr(Parrot, "thing") is Parrot.thing > > True > getattr(Parrot, "__dict__") is Parrot.__dict__ > > False

Re: [OT] Pythonic gui format?

2006-02-14 Thread bruno at modulix
Christoph Zwerschke wrote: > Bruno Desthuilliers schrieb: > >> Gregory Petrosyan a écrit : >> >>> I am currently seeking for pythonic alternative for XML. >> >> (snip) > Bruno, before writing another simple GUI, Sorry, Christoph, wrong attribution !-) -- bruno desthuilliers python -c "pr

Re: Pythonic gui format?

2006-02-14 Thread bruno at modulix
DH wrote: > bruno at modulix wrote: > >> DH wrote: >> >>> Bruno Desthuilliers wrote: >>> >>>>> I am currently seeking for pythonic alternative for XML. >>>> >>>> >>>> A pretty obvious one is dicts and

Re: Pythonic gui format?

2006-02-14 Thread bruno at modulix
DH wrote: > Gregory Petrosyan wrote: > >> Thanks for JSON. It's more clean&simple than XML, but my main idea is >> to remove any extra layer between Python and GUI. I want all GUI >> elements/data to be directly accessible from Python (without extra >> libraries). > > Since JSON is just python d

Re: Pythonic gui format?

2006-02-14 Thread bruno at modulix
Gregory Petrosyan wrote: >>>Isn't it ugly a bit? >> >>I'd even say 'ugly 16-bits' !-) > > > You are right of course. Those "examples" are really bad, and, most > of all, really un-pythonic. > > Thanks for JSON. It's more clean&simple than XML, but my main idea is > to remove any extra layer be

Re: Embedding an Application in a Web browser

2006-02-14 Thread bruno at modulix
rodmc wrote: > Is it possible to embed a Python application within Internet explorer? No. Nor in any other browser (except from Grail, but I think this doesn't count). > If so how do people recommend going about it. Either write a rich client app or a real web application. > As for the applicat

Re: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-15 Thread bruno at modulix
Farel wrote: > Which is Faster in Python and Why? Why don't you try by yourself ? hint : from timeit import Timer help(Timer) -- 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

Re: Pythonic gui format?

2006-02-15 Thread bruno at modulix
Fuzzyman wrote: (snip) > You say you don't want an 'extra layer' between your GUI and Python - > but your approach of using XML has the same drawback. Storing your 'GUI > configuration' in a text based format is a nice idea, but you will need > *something* to do the translation. Well, if the con

Re: Pythonic gui format?

2006-02-15 Thread bruno at modulix
Gregory Petrosyan wrote: > Bruno: in your original example, how can it be specified that image > should be placed before text? Of course, it *can* be done with one > extra level of wrapping of gui elements in list... did you mean that? Yes. That's a pretty straightforward translation of the real

Re: Code organization

2006-02-15 Thread bruno at modulix
Thomas Girod wrote: > Hi. > > I found a lot of documentation about how to code in Python, but not > much about how you organize your code in various modules / packages ... > As I am not yet used to python, this puzzle me a bit. > > So, can anyone explain how one should organize and store its code

Re: Pythonic gui format?

2006-02-15 Thread bruno at modulix
Fuzzyman wrote: > bruno at modulix wrote: > >>Fuzzyman wrote: >>(snip) >> >> >>>You say you don't want an 'extra layer' between your GUI and Python - >>>but your approach of using XML has the same drawback. Storing your 'GUI &

Re: Databases and python

2006-02-16 Thread bruno at modulix
Jonathan Gardner wrote: > I'm no expert in BDBs, but I have spent a fair amount of time working > with PostgreSQL and Oracle. It sounds like you need to put some > optimization into your algorithm and data representation. > > I would do pretty much like you are doing, except I would only have the

Re: multi/double dispatch, multifunctions once again

2006-02-16 Thread bruno at modulix
AndyL wrote: > Hi, (OT : please repeat the question in the body of the post...) > Where I can find a module supporting that? http://peak.telecommunity.com/DevCenter/PyConGenericFunctions -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: embedding python in HTML

2006-02-16 Thread bruno at modulix
John Salerno wrote: > Rene Pijlman wrote: > >> John Salerno: >> [Python alternative for PHP] >> >>> So to do this with Python, do I simply integrate it into the HTML as >>> above, with no extra steps? >> >> >> You'd need something like the PHP engine, that understands Python rather >> than PHP. >

Re: question about scope

2006-02-17 Thread bruno at modulix
it's not found, it raises a NameError !-) > But my real question is this, which is related to the above: > > "Name references search at most four scopes: local, then enclosing > functions (if any), then global, then built-in." > > I understand what global and bui

Re: Checkbuttons in a Text widget

2006-02-17 Thread bruno at modulix
Lou G wrote: > I'm trying to show a number of Checkbuttons (each with associated text > based on a list of names) inside a y-scrollable Text widget like so: > > [ ] Bob > [ ] Carol > [ ] Ted > [ ] Alice > etc. > etc. I really doubt there's a GUI toolkit supporting such a 'feature'. As it's name i

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
__slots__ = > [self.fuel,self.life,self.armor,self.weapon,self.bulk] > ... > (snip) > > I was reading the special methods, got to slots > (http://docs.python.org/ref/slots.html) and decided that i should use > this to save memory in the program because it'll have to su

Re: editor for Python on Linux

2006-02-20 Thread bruno at modulix
Rene Pijlman wrote: > F. Petitjean: > >>Rene Pijlman: >> >>>vi >> >>I beg to disagree :-) Use ed >>"Ed is the standard text editor." >>http://www.gnu.org/fun/jokes/ed.msg.html > > > That was 1991. This is 2006. Yes, but that rant is still a pure jewel of geek madness. -- bruno desthuilliers

Re: editor for Python on Linux

2006-02-20 Thread bruno at modulix
Rene Pijlman wrote: > Sriram Krishnan: > >>Check out http://wiki.python.org/moin/PythonEditors. > > > This page can't be taken seriously. vi is not listed. Well, this prove that this page *is* to be taken seriously !-) (René, don't bother replying : this is a troll ;-) -- bruno desthuilli

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
> >>>>It's not a "scripting" language, and it's not interpreted. >>> >>>Of course it is. What do you think happens to the bytecode? >> >>Ok, then what do you think happens to 'machine' code ? >> >>"interpreted

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Paul Boddie wrote: (snip) > I'm not sure why people get all defensive about Python's > interpreted/scripting designation Because it carries a negative connotation of "slow toy language not suitable for 'serious' tasks". Dynamicity apart, CPython's implementation is much closer to Java than to bas

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
to persuade the site maintainer > before. We should really, really change it. The perceived speed of > Python will at least triple on dropping that "interpreted" - and I am > NOT joking. +1 on this. -- bruno desthuilliers python -c "print '@'.join(['.

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: > Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM > used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd > prefer not to see things slipping into Swap space if I can avoid it, > and the fighter data would be only part of a larger

Re: How many web framework for python ?

2006-02-20 Thread bruno at modulix
Alex Martelli wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >... > >>>There are very good web framework for java and ruby , >>>Is there one for python ? >> >>In fact, there are actually too much *good* python web frameworks. > > > Dear Mr. BDFL, > > there are too many good web fra

Re: redirecting to a content page

2006-02-22 Thread bruno at modulix
Shreyas wrote: > I am a new user writing some scripts to store data entered via a > browser into a database. I have several content pages, and one > "processing" page. A content page often has a form like this: > > > > ... > > And the processing page goes like this: > > form = cgi.FieldStora

Re: Hiding a column at the root of a plone site ...

2006-02-27 Thread bruno at modulix
Paul Ertz wrote: > Hello, > > We would like to hide the left column for the main/home page of our > plone sites dynamically using a tal: expression. Then please post on a Zope/Plone related mailing-list. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]

Re: Python Indentation Problems

2006-02-28 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I am a newbie to Python. I am mainly using Eric as the IDE for coding. > Also, using VIM and gedit sometimes. > > I had this wierd problem of indentation. My code was 100% right but it > wont run because indentation was not right. If indentation is not right, then your

Re: error: argument after ** must be a dictionary

2006-03-01 Thread bruno at modulix
abcd wrote: > I have class like this... > > import threading > class MyBlah(object): > def __init__(self): > self.makeThread(self.blah, (4,9)) > > def blah(self, x, y): > print "X and Y:", x, y > > def makeThread(self, func, args=(), kwargs={}): > threading.Th

Re: Writing an applilcation that can easily adapt to any language

2006-03-01 Thread bruno at modulix
Chance Ginger wrote: > I am rather new at Python so I want to get it right. What I am doing > is writing a rather large application with plenty of places that > strings will be used. Most of the strings involve statements of > one kind or another. > I would like to make it easy

Re: Rapid web app development tool for database

2006-03-02 Thread bruno at modulix
go), or > something different ? AFAICT, Dabo is supposed to grow a web UI someday, so if it's close to what you're looking for, you may want to make this happens sooner !-) Else, you could have a look at Django, Turbogears or Pylons. -- bruno desthuilliers python -c "print '@&

Re: Is it better to use class variables or pass parameters?

2006-03-02 Thread bruno at modulix
Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method s/class method/method/ In Python, a "class method" is a method working on the class itself (not on a given instance). > or should I pa

Re: setattr question

2006-03-02 Thread bruno at modulix
Gerard Flanagan wrote: > Hello > > I have the following code: > > builder.py # > class HtmlBuilder(object): > > @staticmethod > def page(title=''): > return HtmlPage(title) > > @staticmethod > def element(tag, text=None, **attribs): > return HtmlElem

Re: setattr question

2006-03-03 Thread bruno at modulix
bruno at modulix wrote: (snip) > Je ne vois pas très bien à quoi sert cette classe (à moins bien sûr > qu'il y ait d'autre code). Pour ce que je vois là, pourquoi ne pas > appeler directement les classes HtmlPage, HtmlElement et HtmlLiteral ? > oops, sorry, forgot to remo

Re: setattr question

2006-03-03 Thread bruno at modulix
Gerard Flanagan wrote: > bruno at modulix wrote: > (snip french) > > I was trying to implement the factory pattern. > The recipe above uses 'apply' which is deprecated according to the > docs, and I suppose I was curious how to do the same sort of thing >

Re: do design patterns still apply with Python?

2006-03-03 Thread bruno at modulix
ajones wrote: (snip) > I would suggest getting a good grasp on OOP before you get into design > patterns. When most people start with any new concept they tend to try > and see everything in terms of their new toy, so sticking to one or two > new concepts at a time will make thi

Re: setattr question

2006-03-03 Thread bruno at modulix
Gerard Flanagan wrote: > bruno at modulix wrote: > [...] > >>I don't know this HtmlElement class, nor where it comes from. >>'to_string()' (or is it toString() ?) is javaish. The pythonic idiom for >>this is implementing the __str__() method and calling

Re: django and mod_python

2006-03-06 Thread bruno at modulix
go mailing-list, and IIRC a mod_python mailing-list >>too. When possible, post to the most specific(s) list(s). >> > > > Hi, > > There are also some wxpython, pyqt, ... mailing-list, iircc and you don't > seem to bother requesters with not being at the right pl

Re: Adding method at runtime - problem with self

2006-03-06 Thread bruno at modulix
sible, but sometimes a simple hack is better than no practical solution at all. > Oh well, at least now I can be an informed participant of > language holy wars :-) Welcome on board !-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p

Re: Java Developer Exploring Python

2006-04-18 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I've traditionally been a Java developer, although I play around with > LISP. I recently migrated to Linux and I was exploring Mono as an > option for development on Linux. However, I've had some problems with > the maturity and support when working with Mono. So I was co

Re: How protect proprietary Python code? (bytecode obfuscation?, what better?)

2006-04-18 Thread bruno at modulix
rotect code from reverse-engineering is to not distribute it *at all*. -- 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: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (snip) > Everyone is getting off track here. Not that much... > Java has interfaces because it doesn't support multiple inheritance. Java as interfaces because it relies on type declaration for subtyping *and* doesn't support MI. > Python supports MI, so you don't need

Re: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
Rene Pijlman wrote: > Kay Schluehr: > >>You won't find many deep class hierarchies and extensive frameworks. > > > Zope comes to mind. > > >>This has the advantage that a classification you have done once at >>the beginning of your project in

Re: Updated PEP 359: The make statement

2006-04-19 Thread bruno at modulix
Steven Bethard wrote: (snip) > Guido has pronounced on this PEP: >http://mail.python.org/pipermail/python-3000/2006-April/000936.html > Consider it dead. =) :( -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@'

Re: accessing a classes code

2006-04-19 Thread bruno at modulix
ermine these > unknown parameters, I would like to substitute them back into the > model and save the model as a new python class. Why ? Python is dynamic enough to let you modify classes at runtime... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-

Re: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
Neal Becker wrote: (snip) > I see various answers that Python doesn't need interfaces. OTOH, there are > responses that some large Python apps have implemented them (e.g., zope). > Does anyone have an explanation of why these large systems felt they needed > to implement interfaces? These "inter

Re: How protect proprietary Python code? (bytecode obfuscation?, what better?)

2006-04-19 Thread bruno at modulix
Ben Sizer wrote: > bruno at modulix wrote: > >>[EMAIL PROTECTED] wrote: >> >>>I suppose another idea is to rewrite entire Python app in C if compiled >>>C code >>>is harder to decompile. >> >>Do you really think "native" code is

Re: accessing a classes code

2006-04-19 Thread bruno at modulix
Ryan Krauss wrote: (top-post corrected) > > On 4/19/06, bruno at modulix <[EMAIL PROTECTED]> wrote: > >>Ryan Krauss wrote: >> >>>I have a set of Python classes that represent elements in a structural >>>model for vibration modeling (sort of like FEA)

Re: Method Call in Exception

2006-04-20 Thread bruno at modulix
mwt wrote: (snip) >>>This works when I try it, but I feel vaguely uneasy about putting >>>method calls in exception blocks. >> >>What do you put in exception blocks?! Whatever fits the specific case... (snip) > Normally I don't like to use exception blocks

Re: how to transfer a python object to other computer?

2006-04-20 Thread bruno at modulix
Daniel Nogradi wrote: >>Hey, all.Now I wanna to transfer a object to other computer, Maybe I >>could serialize the object to a file by pickle moudle, then send the file >>and get it from the file.But I think the efficency is awful, because the >>disk io is very slow. >> Someone could do me

Re: PYTHONPATH

2006-04-20 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hi, > I am using Linux env.I set the PYTHONPATH using > > import sys > sys.path.append() This does not sets the PYTHONPATH. [EMAIL PROTECTED] ~/public_html/aquitaine-pqa $ python -h (snip) Other environment variables: (snip) PYTHONPATH : ':'-separated list of d

Re: Python IDE for linux

2006-04-20 Thread bruno at modulix
Fulvio wrote: > Alle 09:43, giovedì 20 aprile 2006, Neil Isaac ha scritto: > >>At this point I'm thinking that I would like to start using a real IDE. > > Idle, shipped with Python :-) The OP said "a *real* IDE" !-) > F -- bruno desthuilliers python -c &q

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-20 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Summary: (snip) > > I'm working on a few projects concurrently so I have tried to > arranged my projects like this: > > COMMON > src > a.b.c.common > test > a.b.c.common > > APP1 > src > a.b.c.app1 > test > a.b.c.app1 > > APP2 > src >

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-21 Thread bruno at modulix
alisonken1 wrote: > As to the question "fail to see how version control relates to > code/test separation", the original poster asked several questions, one > of which was production/testing code separation. > > Along with the separation (so while you're testing new functionality, > you don't brea

Re: search files in a directory

2006-04-21 Thread bruno at modulix
Gary Herron wrote: > david brochu jr wrote: > >> Hello, >> >> I need to open every file in a directory and search for a string. What >> module is needed to do this and how would I go about searching each file? [bash] find /path/to/dir -exec grep -le "searched string" {} \; Ho, you meant : doin

Re: Strategy Design Pattern

2006-04-21 Thread bruno at modulix
Daniel Santa Cruz wrote: > Hello all, > > I've been trying to go over my OO Patterns book, and I decided to try > to implement them in Python this time around. I figured this would > help me learn the language better. > > Well, I've gotten stuck with my first go

Re: Looking for a programming resource for newbees

2006-04-21 Thread bruno at modulix
ocessing. You may want to have a look at David Mertz's "Text Processing in Python" > I'm searching for a resource that examines programming from a case > study like perspective. Such as, you're faced with problem of type X - > and here's how you should look at i

Re: python equivalent of VB code sample

2006-04-21 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Situation is this: > 1) must write application that does the following: > a) creates an xml document, the contents of which, is a request > transaction > b) send xml document to destination; I am assuming that a process > at destination

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-24 Thread bruno at modulix
Lawrence D'Oliveiro wrote: (snip) > I think you're taking Python's OO-ness too seriously. One of the > strengths of Python is that it can _look_ like an OO language without > actually being OO. According to which definition of OO ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-24 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "ToddLMorgan" <[EMAIL PROTECTED]> wrote: > > >>I'm looking for the common types of mistakes that say a Java/C# or >>even C++ developer may commonly make. > > > Using subclassing when you don't have to. For instance, you might have

Re: Missing interfaces in Python...

2006-04-24 Thread bruno at modulix
bruno at modulix wrote: > Neal Becker wrote: > (snip) > >>I see various answers that Python doesn't need interfaces. OTOH, there are >>responses that some large Python apps have implemented them (e.g., zope). >>Does anyone have an explanation of why these lar

Re: Instruction at "0x00FC3D70" use memory address "0x00000000". Can't be "read".

2006-04-25 Thread bruno at modulix
> On Apr 24, 2006, at 5:38 PM, Neil Adams wrote: > >> How do Ifix memory message Ox033fc512 at Ox can't be read I think the first think to do would be to read this: http://www.catb.org/~esr/faqs/smart-questions.html -- bruno desthuilliers python -c "print 

Re: python application ideas.

2006-04-25 Thread bruno at modulix
Tim Parkin wrote: > Anthony Greene wrote: > >>Hello, I know this isn't really a python centric question, but I'm seeking >>help from my fellow python programmers. I've been learning python for the >>past year and a half, and I still haven't written anything substantial nor >>have I found an existi

Re: Multiple hierarchie and method overloading

2006-04-25 Thread bruno at modulix
If that's really your code, you should have an exception right here. Else, please post real code. > B.__init__(self) > . > > self.A_Func() #HERE I GET AN EXCEPTION "... takes at least 2 > arguments (1 > given). > > I renamed A_Func(self) to fix

Re: Multiple hierarchie and method overloading

2006-04-25 Thread bruno at modulix
(self) > > . > > self.A_Func() #HERE I GET AN EXCEPTION "... takes at least 2 > arguments (1 > given). Ho, yes, also: A.A_Func() really takes 2 arguments (self, and p_param). When called from an instance of A, the first argument (ie: self) will be automagical

Re: test assignmet problem

2006-04-25 Thread bruno at modulix
Paolo Pantaleo wrote: (snip) > Thnx for the help, > actually the problme is not solved > > i have [well I want to do...] something like: > > if a=b(): >do stuff with a > else if a=c(): >do stuff with b where does this 'b' come from ? > else: >do other stuff > > well, two solutions

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-25 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > bruno at modulix <[EMAIL PROTECTED]> wrote: > > >>Lawrence D'Oliveiro wrote: >> (snip) >>>I suppose this is an instance of the more general rule: "using OO when >>

Re: RESOLVED Re: PYTHONPATH

2006-04-25 Thread bruno at modulix
Brian van den Broek wrote: > Hi all, > > As a fairly new linux user running ubuntu 5.10 I'd had problems > persistently setting my PYTHONPATH environment variable. bruno and > Edward got me most of the way (thanks!); I'm posting what worked for > future googling. > (snip) > The syntax that worked

<    1   2   3   4   5   6   7   >