Re: Best IDE for Python?

2006-03-31 Thread bruno at modulix
Duncan Booth wrote: Fredrik Lundh wrote: as you can see, Microsoft's usability team has made some massive improvements (note how well it deals with the eat flaming death command): I especially like the way running it messes up the prompt: C:\Documents and Settings\Duncanedlin File

Re: How to search HUGE XML with DOM?

2006-03-31 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: a relation database has admiring search efficiency when the database is very big (several thousands or tens of thousands of records). But my current project is based on XML, for its tree-like data structure has much more flexibility; and DOM, which could be

Re: member variables in python

2006-03-31 Thread bruno at modulix
PyPK wrote: ok I reason I was going with globals is that i use this variable in another class something like this along with above testflag = 0 class AA: def __init__(...): def methos(self,...): global testflag testflag = xx class BB: def __init__(...):

Re: Free Python IDE ?

2006-03-30 Thread bruno at modulix
Ernesto wrote: I'm looking for a tool that I can use to step through python software (debugging environment). This is not an 'IDE', it's a debugger. Is there a good FREE one http://www.python.org/doc/2.4.2/lib/module-pdb.html Strange enough, I almost never had a use for a debugger in 5+

Re: Try Python!

2006-03-30 Thread bruno at modulix
Michael Tobis wrote: We had some discussion of this in the edu-sig meeting at PyCon. I alleged that I had read that there is no such thing as a Python sandbox. And yet Zope 2 has some restricted environment for TTW scripts... -- bruno desthuilliers python -c print

Re: List conversion

2006-03-30 Thread bruno at modulix
yawgmoth7 wrote: Hello, I have a piece of code: command = raw_input(command ) words = string.split(command, ' ') temparg = words if len(words)= 3: temparg = words[4:] else:

Re: dynamic construction of variables / function names

2006-03-30 Thread bruno at modulix
Steven D'Aprano wrote: Sakcee wrote: python provides a great way of dynamically creating fuctions calls and class names from string (snip) Personally, I think the best way is: find another way to solve your problem. See Duncan's post for a pretty clean and pythonic solution. Another

Re: does python could support sequence of short or int?

2006-03-30 Thread bruno at modulix
momobear wrote: hi, is there a way to let python operate on sequence of int or short? In C, we just need declare a point, I assume you mean a 'pointer'. then I could get the point value, just like: short* k = buffer, //k is a point to a sequence point of short. short i = *k++, but python

Re: regular expressions and matches

2006-03-30 Thread bruno at modulix
Johhny wrote: Hello, I have recently written a small function that will verify that an IP address is valid. (snip re.match() based solution - just one remark: compiling the regexp on each function call is more than useless) I was having issues trying to get my code working so that I could

Re: does python could support sequence of short or int?

2006-03-30 Thread bruno at modulix
momobear wrote: but what about buffer is not be declared in python program, it comes from a C function. and what about I want to treat a string as a short list? OT level='slightly' There are no short in Python. An integer is an integer is an integer... /OT buffer = foobur() // a invoke from

Re: Non-GUI source code browser with file system tree view

2006-03-30 Thread bruno at modulix
Stefan Schwarzer wrote: Hello, from time to time I want to inspect the source code of projects on remote computers.(*) I've googled for one or two hours but didn't find anything helpful. :-/ I'm looking for something like IDLE's path browser - i. e. a tree view and file view side-by-side -

Re: How to determine an object is scriptable

2006-03-30 Thread bruno at modulix
Larry Bates wrote: abcd wrote: I recently came across a problem where I saw this error: TypeError: unsubscriptable object How can I determine if an object is scriptable or unscriptable? Simplest answer is to use isinstance to see if it is a string, list, or tuple: if

Re: How to determine an object is scriptable

2006-03-30 Thread bruno at modulix
abcd wrote: Richard Brodie wrote: subscriptable: supports an indexing operator, like a list does. doesn't seem to be a builtin function or module... It's not. Look no further. or is that just your definition of subscriptable? It's a correct definition of 'subscriptable' in the context

Re: How to determine an object is scriptable

2006-03-30 Thread bruno at modulix
abcd wrote: I recently came across a problem where I saw this error: TypeError: unsubscriptable object How can I determine if an object is scriptable or unscriptable? By trying to apply the subscript operator ('[index]'). If it raises a TypeError, then it's not subscriptable. But, as Larry

Re: Looking for a language/framework

2006-03-29 Thread bruno at modulix
walterbyrd wrote: You can bet it'll be plain old cgi - possibly with an outdated Pyton version. I think you are right. In practical terms, what does that mean? Will I not be able to use modules? Will I not be able to use frameworks? It means that you will be limited to what can run with cgi

Re: No Cookie: how to implement session?

2006-03-29 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: I do not want to use Cookies in my site since not all web browser support it well and sometimes people close cookie functioning for security reasons. Too bad for them. The only other way to support session is by encoding the session id in the request, and it's

Re: tips for this exercise?

2006-03-29 Thread bruno at modulix
John Salerno wrote: I'm working on another exercise now about generating random numbers for the lottery. What I want to do is write a function that picks 5 random numbers from 1-53 and returns them. Here's what I have so far: numbers = range(1, 54) def genNumbers(): for x in range(5):

Re: tips for this exercise?

2006-03-29 Thread bruno at modulix
Paul Rubin wrote: (snip) Why is everyone using shuffle? import random random.sample(xrange(1,41), 5) [24, 15, 9, 39, 19] Great. Didn't know that one. -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: Python plug-in

2006-03-29 Thread bruno at modulix
toto wrote: Hi, I'm trying to find some howto, tutorial in order to create a python program that will allow plug-in programming. I've found various tutos on how to write a plug-in for soft A or soft B but none telling me how to do it in my own programs. Do you have any bookmarks ?? Trac

Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Probably because there are much better options for web programming in Python ? Not willing to use external modules, I would like to implement a simplest Session object on my own.

Re: instantiate a class with a variable

2006-03-28 Thread bruno at modulix
John wrote: Hi, is it possible to instantiate a class with a variable. example class foo: def method(self): pass x='foo' Can I use variable x value to create an instance of my class? You got examples using string 'foo', now if all you need is to store or pass around the

Re: object references

2006-03-28 Thread bruno at modulix
DrConti wrote: Hi Bruno, hi folks! thank you very much for your advices. I didn't know about the property function. I learned also quite a lot now about references. Ok everything is a reference but you can't get a reference of a reference... I saw a lot of variations on how to solve this

Re: multiple assignment

2006-03-28 Thread bruno at modulix
Anand wrote: Wouldn't it be nice to say id, *tokens = line.split(',') id, tokens_str = line.split(',', 1) But then you have to split tokens_str again. id, tokens_str = line.split(',', 1) tokens = tokens_str.split(',') this is too verbose. head_tail = lambda seq: seq[0], seq[1:]

Re: Looking for a language/framework

2006-03-28 Thread bruno at modulix
walterbyrd wrote: Way back when, I got a lot of training and experience in highly structued software development. These days, I dabble with web-development, but I may become more serious. I consider php to be an abombination, the backward compatibility issues alone are reason enough to

Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: bruno at modulix 写道: Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Probably because there are much better options for web programming in Python ? Really? Then what is it? Please notice the 's

Re: Properties

2006-03-27 Thread bruno at modulix
Ronny Mandal wrote: Is there a way of checking whether the call to a set-function is called from within the class, e.g. the __init__() contra object.set()? import inspect help(inspect.stack) -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in

Re: Python types

2006-03-27 Thread bruno at modulix
Dennis Lee Bieber wrote: On Mon, 27 Mar 2006 01:34:14 +0200, Bruno Desthuilliers [EMAIL PROTECTED] declaimed the following in comp.lang.python: Ok, so even if Python itself declares b and b2 (read: objects that names b and b2 are bound to) to be of the same type, you cannot apply the

Re: object references

2006-03-27 Thread bruno at modulix
Steven D'Aprano wrote: On Sat, 25 Mar 2006 21:33:24 -0800, DrConti wrote: Dear Python developer community, I'm quite new to Python, so perhaps my question is well known and the answer too. I need a variable alias ( what in other languages you would call a pointer (c) or a reference (perl))

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Michael Spencer wrote: Bruno Desthuilliers wrote: (snip) BTW, there may be other use case for per-instance descriptors... Agreed. Per-instance descriptors could be interesting (that's why the subject line caught my attention). But your solution involves a custom __getattribute__ in

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Steven Bethard wrote: bruno at modulix wrote: Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, (snip) class MyClass2(MyClass1): def __getattribute__(self, key): v = MyClass1.__getattribute__(self, key

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Steven Bethard wrote: (some smart questions) Steven , I owe you a *big* thank. I knew they must have been something wrong, but couldn't point what. Now I see, and it's of course totally obvious. Using a class as a decorator, I have of course only one instance of it per function - and for some

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Steven Bethard wrote: (snip code) But that looks pretty nasty to me. aol / It sounds like your architecture could use some redesigning Done - in much more sane way. Got rid of some more boilerplate and of the whole problem of per-instance descriptors BTW !-) I should probably sleep

Per instance descriptors ?

2006-03-22 Thread bruno at modulix
Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): class DummyDescriptor(object): def __get__(self, obj, objtype=None): if obj is None: return self return getattr(obj, 'bar', 'no bar') class

Re: py web-app-frameworks without a rdbms...

2006-03-22 Thread bruno at modulix
[EMAIL PROTECTED] wrote: Hi folks, Of TurboGers Django WAF candidates, which one would be easier to use in an environment where the data/content doesn't come an RDBMS, but from other server-side apps... IMHO, both. If these are not good candidates, could you suggest appropriate ones...

Re: Per instance descriptors ?

2006-03-22 Thread bruno at modulix
Ziga Seilnacht wrote: bruno at modulix wrote: Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): snip Now the question: is there any obvious (or non-obvious) drawback with this approach ? Staticmethods

Re: user-supplied locals dict for function execution?

2006-03-21 Thread bruno at modulix
Lonnie Princehouse wrote: Beautiful is better than ugly. Explicit is better than implicit. Err... I see no contradiction nor conflict here. What to do when explicit is ugly and implicit is beautiful? Depends on your understanding of explicit/implicit. Side effects on globals or automatic

Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread bruno at modulix
Ilias Lazaridis wrote: Where can I find practical coding examples for real life coding problems? Probably in real life code ?-) Something like a categorized solution guide? Look for the Python cookbook (google is your friend). - My current problem: * create a folder * seems to be:

Re: should os.walk return a list instead of a tuple?

2006-03-21 Thread bruno at modulix
Ministeyr wrote: Hello, os.walk doc: http://www.python.org/doc/2.4/lib/os-file-dir.html#l2h-1625 When walking top to bottom, it allows you to choose the directories you want to visit dynamically by changing the second parameter of the tuple (a list of directories). However, since it is a

Re: Python compiler

2006-03-21 Thread bruno at modulix
Rc wrote: DaveM [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] On Thu, 16 Mar 2006 13:34:14 +0100, Méta-MCI [EMAIL PROTECTED] wrote: Après, vous pourrez aussi fréquenter le newsgroup : fr.comp.lang.python qui a l'avantage d'être en français. But perhaps he's a Flemish

Re: user-supplied locals dict for function execution?

2006-03-20 Thread bruno at modulix
Lonnie Princehouse wrote: Can anyone think of a way to substitute a user-supplied dictionary as the local dict for a function call? e.g. def f(): x = 5 d = {} exec_function_in_dictionary( f, d ) # ??? print d[x] # 5 def f(**kw): kw['x'] = 5 d = {} f(**d) print

Re: what's the general way of separating classes?

2006-03-20 Thread bruno at modulix
John Salerno wrote: From my brief experience with C#, I learned that it was pretty standard practice to put each class in a separate file. I assume this is a benefit of a compiled language that the files can then be grouped together. What I'm wondering is how is this normally handled in

Re: user-supplied locals dict for function execution?

2006-03-20 Thread bruno at modulix
Lonnie Princehouse wrote: What's your use case exactly ? I'm trying to use a function to implicitly update a dictionary. I think this was pretty obvious. What I wonder is *why* you want/think you need to do such a thing -I don't mean there can't be no good reason to do so, but this has to

Re: how to make script interact with another script

2006-03-20 Thread bruno at modulix
Chason Hayes wrote: How can I get a script to pipe data to another program, wait for a response, then send more data etc. For example, from a script, I want to run smbclient then send it the username, password, and then some commands. (I know there are better ways to achieve this

Re: Server applications - avoiding sleep

2006-03-15 Thread bruno at modulix
rodmc wrote: I have written a small server application (for Windows) which handles sending and receiving information from an instant messaging client and a database. This server needs to run 24/7, however it stops when the computer screen is locked. I assume there is a way to make it run in

Re: newbie questions

2006-03-15 Thread bruno at modulix
meeper34 wrote: Hi, I'm just starting out with Python, and so far I am thoroughly impressed with what you can do very easily with the language. I'm coming from a C++ background here. A couple of questions came up as I was thinking about dynamically typed languages: 1. If someone

Re: best practices for making read-only attributes of an object

2006-03-15 Thread bruno at modulix
Tim Chase wrote: I've set up an object and would like to make certain attributes read-only (or at least enforce it without doing extra work, as per name-mangling or the like). Ideally, the property would be set in the __init__, and then not be allowed to change. The best solution I've been

Re: problem writing to a file each record read

2006-03-15 Thread bruno at modulix
Eduardo Biano wrote: I am a python newbie and I have a problem with writing each record read to a file. The expected output is 10 rows of records, but the actual output of the code below is only one row with a very long record (10 records are lump into one record). Thank you in advance for

Re: list/classmethod problems

2006-03-14 Thread bruno at modulix
ahart wrote: Diez, Scott, and Bruno, I thank you all for your help and suggestions. I wasn't aware that default values were considered class (static) values. These are *not* 'default values'. Defining a name in the body of a class statement bind that name to the *class*. To bind a name to

Re: Accessing overridden __builtin__s?

2006-03-14 Thread bruno at modulix
[EMAIL PROTECTED] wrote: I'm having a scoping problem. I have a module called SpecialFile, The convention is to use all_lowercase names for modules, and CamelCase for classes. which defines: def open(fname, mode): return SpecialFile(fname, mode) This shadows the builtin open()

Re: Accessing overridden __builtin__s?

2006-03-14 Thread bruno at modulix
Steven D'Aprano wrote: On Mon, 13 Mar 2006 21:28:06 -0800, garyjefferson123 wrote: I'm having a scoping problem. I have a module called SpecialFile, which defines: (snip code) The problem, if it isn't obvioius, is that the open() call in __init__ no longer refers to the builtin open(), but

Re: Very, Very Green Python User

2006-03-14 Thread bruno at modulix
Scott David Daniels wrote: [EMAIL PROTECTED] wrote: ... Is the Python debugger fairly stable? Yes, but it is not massively featured. The Pythonic way is to rarely use a debugger (test first and straightforward code should lead to shallow bugs). Often for most of us judiciously placed

Re: Python Debugger / IDE ??

2006-03-14 Thread bruno at modulix
[EMAIL PROTECTED] wrote: Is there any editor or IDE in Python (either Windows or Linux) which has very good debugging facilites like MS VisualStudio has or something like that. I like SPE but couldn't easily use winPDP. I need tips to debug my code easily. pythonic debugging in three

Re: Very, Very Green Python User

2006-03-14 Thread bruno at modulix
[EMAIL PROTECTED] wrote: I have used Perl for a long time, but I am something of an experimental person and mean to try something new. Most of my 'work' with Vector Linux entails the use of Perl (a bit of a misnomer as it is not now a paid position -- I am not yet even out of K-12), and there

Re: __del__ not called?

2006-03-13 Thread bruno at modulix
Gregor Horvath wrote: Felipe Almeida Lessa schrieb: del B # We'll to tell him to collect the garbage here, but ... # usually it should not be necessary. Thanks. If I do del B then the __del__ of A gets called. That surprises me. Why ? I thought that B gets del'd by python when it

Re: PEP 8 example of 'Function and method arguments'

2006-03-13 Thread bruno at modulix
Martin P. Hellwig wrote: While I was reading PEP 8 I came across this part: Function and method arguments Always use 'self' for the first argument to instance methods. Always use 'cls' for the first argument to class methods. Now I'm rather new to programming and unfamiliar to

Re: First script, please comment and advise

2006-03-10 Thread bruno at modulix
Pedro Graca wrote: [EMAIL PROTECTED] wrote: My version is similar to Just one: from random import shuffle def scramble_text(text): Return the words in input text string scrambled except for the first and last letter. def scramble_word(word): Nice. You can have functions

Re: Help with a reverse dictionary lookup

2006-03-10 Thread bruno at modulix
rh0dium wrote: Hi all, I have a dict which looks like this.. dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']}, '180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc': ['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']}, '250nm': {'umc': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':

Re: Simple questions on use of objects (probably faq)

2006-03-10 Thread bruno at modulix
Steven D'Aprano wrote: On Thu, 09 Mar 2006 13:44:25 +0100, bruno at modulix wrote: (snip) And it's not self-referential - it introduces a references cycle (class object - instances - class object), which may or may not be a problem. Every instance knows about a list of every other

Re: Simple questions on use of objects (probably faq)

2006-03-09 Thread bruno at modulix
Brian Elmegaard wrote: bruno at modulix [EMAIL PROTECTED] writes: Now how you could do it the OO way (QD, not really tested): Something goes wrong in my 2.3 So it's time to move to 2.4x !-) What is going wrong exactly ? when I change the syntax to _add_instance=classmethod

Re: Simple questions on use of objects (probably faq)

2006-03-09 Thread bruno at modulix
Steven D'Aprano wrote: (snip) I say think you want because I don't know what problem you are trying to solve with this messy, self-referential, piece of code. This messy piece of code is mine, thanks !-) And it's not self-referential - it introduces a references cycle (class object -

Re: Simple questions on use of objects (probably faq)

2006-03-09 Thread bruno at modulix
Brian Elmegaard wrote: bruno at modulix [EMAIL PROTECTED] writes: So it's time to move to 2.4x !-) I guess so. What is going wrong exactly ? def _add_instance(cls, instance): _add_instance=classmethod(_add_instance) cls._instances.append(instance) You want

Re: How to dervie from an instance object?

2006-03-09 Thread bruno at modulix
reinsn wrote: Hi, I am currently working with ZopeX3. Because python doesn't include concept of interfaces, It does, but implicitly. The interface of an object is the set of messages it understands. those were defined by the module zope.interface. So interfaces were defined like:

Re: Simple questions on use of objects (probably faq)

2006-03-08 Thread bruno at modulix
Brian Elmegaard wrote: Hi, I am struggling to understand how to really appreciate object orientation. I guess these are FAQ's but I have not been able to find the answers. Maybe my problem is that my style and understanding are influenced by matlab and fortran. I tried with the simple

Re: It is fun.the result of str.lower(str())

2006-03-07 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: Guess what would be the result of these functions: s/functions/method calls/ str.lower('ASFA') = 'ASFA'.lower() = 'asfa' str.join(str(),['1','1','1']) = ''.join(['1','1','1']) = '111' str.join('a','b') = 'a'.join('b') = 'b' If you guess them correctly,

Re: Checking function calls

2006-03-07 Thread bruno at modulix
James Stroud wrote: (snip) Since python is weakly typed, s/weakly/dynamically/ (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/mailman/listinfo/python-list

Re: Difference between a library and a module...

2006-03-07 Thread bruno at modulix
sophie_newbie wrote: OK this might seem like a retarded question, Better to look like an ignorant than to stay one !-) but what is the difference between a library and a module? Python only defines 'modules' and 'packages'. A module can technically be any python source file, but usually

Re: django and mod_python

2006-03-06 Thread bruno at modulix
Laurent Rahuel wrote: Bruno Desthuilliers wrote: [EMAIL PROTECTED] a écrit : Hi, I read the mod_python documentation on the Django site but I'm getting this error: EnvironmentError: Could not import DJANGO_SETTINGS_MODULE 'accesshiphop.settings' (is it on sys.path?): No module named

Re: Adding method at runtime - problem with self

2006-03-06 Thread bruno at modulix
[EMAIL PROTECTED] wrote: Thank you all for your responses. That's exactly what I needed to know - how to bind a function to an object so that it would comply with standard calling syntax. This is largely a theoretical issue; I just wanted to improve my understanding of Python's OOP model.

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 remove this before posting

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 without 'apply'. def fun(*args, **kwargs

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 things a little easier.

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 str(obj) on the obj (which will call obj.__str__

Re: Rapid web app development tool for database

2006-03-02 Thread bruno at modulix
George Sakkis wrote: Is there any tool in python (or with python bindings) like Oracle Application Express, former HTML DB (http://www.oracle.com/technology/products/database/application_express/index.html) ? Ideally it should be dbms-agnostic, e.g. by using SQLObject to talk to the database.

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 pass

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 HtmlElement(tag,

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={}):

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 for the support

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: 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: 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: form method=POST action=processing.py input type=text name=username ... And the

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: class Fighter: Old-style classes are deprecated, use new-style class wherever possible: class Fighter(object): ... '''Small one man craft that can only harm other fighters on their own.''' ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): ...

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 python -c print

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 desthuilliers

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Torsten Bronger wrote: Hallöchen! Bruno Desthuilliers [EMAIL PROTECTED] writes: Alexander Schmolck a écrit : Bruno Desthuilliers [EMAIL PROTECTED] writes: [...] It's not a scripting language, and it's not interpreted. Of course it is. What do you think happens to the bytecode? Ok,

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 bash

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Harald Armin Massa wrote: OK, but then we should change http://python.org/doc/Summary.html, which starts with Python is an interpreted, interactive, object-oriented programming language. I second this motion. Even tried to persuade the site maintainer before. We should really, really change

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 program. And as I

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 frameworks nowadays.

Re: question about scope

2006-02-17 Thread bruno at modulix
John Salerno wrote: Here's a sentence from Learning Python: Names not assigned a value in the function definition are assumed to be enclosing scope locals (in an enclosing def), globals (in the enclosing module's namespace) or built-in (in the predefined __builtin__ names module Python

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 implies,

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. My web server can

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('@')]) --

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 conf

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 ? the

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 configuration' in a text based format is a nice idea, but you will need *something

Re: Loop Backwards

2006-02-14 Thread bruno at modulix
Dave wrote: This should be simple, but I can't get it: How do you loop backwards through a list? For example, in, say, Javascript: for (var i = list.length - 1; i =0; i--) { do_stuff() } I mean, I could reverse the list, but I don't want to. I want it to stay exactly the same,

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

<    1   2   3   4   5   6   >