Re: About one class/function per module

2009-11-02 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote: Peng Yu wrote: I can navigate to the definition of class and function by vim + ctags, Start learning a decent editor (emacs is mine) which allows you to deal with all of your perceived problems Diez This is a declaration of war against the vi

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Jean-Michel Pichavant
Glenn Hutchings wrote: Rob Briggs rdbriggs at mun.ca writes: Is there a way to do a repeat formatting command like in Fortran? Rather that doing this: print %s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f % (parmName[i], tmp[i][1], tmp[i][2], tmp[i][4], tmp[i][6], tmp[i][7],

Re: TODO and FIXME tags

2009-11-18 Thread Jean-Michel Pichavant
Scott David Daniels wrote: Martin P. Hellwig wrote: Ben Finney wrote: Chris Rebert c...@rebertia.com writes: 2009/11/16 Yasser Almeida Hernández pedro...@fenhi.uh.cu: How is the sintaxis for set the TODO and FIXME tags...? ... There's no widely-followed “syntax” for this convention,

getting properly one subprocess output

2009-11-18 Thread Jean-Michel Pichavant
Hi python fellows, I'm currently inspecting my Linux process list, trying to parse it in order to get one particular process (and kill it). I ran into an annoying issue: The stdout display is somehow truncated (maybe a terminal length issue, I don't know), breaking my parsing. import

Re: getting properly one subprocess output

2009-11-19 Thread Jean-Michel Pichavant
Nobody wrote: On Wed, 18 Nov 2009 12:25:14 +0100, Jean-Michel Pichavant wrote: I'm currently inspecting my Linux process list, trying to parse it in order to get one particular process (and kill it). I ran into an annoying issue: The stdout display is somehow truncated (maybe a terminal

Re: How to log messages _only once_ from all modules ?

2009-11-25 Thread Jean-Michel Pichavant
Barak, Ron wrote: Hi, I'm trying to add the logging module to my application, but I seem to be missing something. My application (a wxPython one) has a main script that calls various helper classes. I want the log messages from all modules to go to one central log file. When I implement

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Jean-Michel Pichavant
Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code. If I keep them in if statement, it will take some runtime. I'm

Re: Creating a local variable scope.

2009-11-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 30 Nov 2009 02:11:12 +0100, Alf P. Steinbach wrote: I think if one could somehow declare names as const (final, readonly, whatever) then that would cover the above plus much more. Having real constants is one feature that I miss. Because Python doesn't

Re: Exec Statement Question

2009-11-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: if which == '': i = 0 all = '' while i len(meanings): table = '%s\n' % meanings[i] table += table\n tr\n td colspan='8' align='center'%s/td\n /tr % names[i] j = 0 for elt in code: if (j + 8) % 8 == 0: table += '

Re: getattr problem

2009-12-01 Thread Jean-Michel Pichavant
Victor Subervi wrote: Hi; I have the following code that execute without a problem: import sys,os sys.path.append(os.getcwd()) import options storesTables = [] junkStores = string.join(addStore(), ', ') for table in optionsTables(): if table not in ('particulars', junkStores):

Re: Python without wrapper script

2009-12-02 Thread Jean-Michel Pichavant
eric.frederich wrote: Is there a way to set up environment variables in python itself without having a wrapper script. The wrapper script is now something like #!/bin/bash export LD_LIBRARY_PATH=/some/thing/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/another/thing/lib:$LD_LIBRARY_PATH

Re: Declaring a class level nested class?

2009-12-03 Thread Jean-Michel Pichavant
cmckenzie wrote: Hi. I'm new to Python, but I've managed to make some nice progress up to this point. After some code refactoring, I ran into a class design problem and I was wondering what the experts thought. It goes something like this: class module: nestedClass def __init__():

Re: Declaring a class level nested class?

2009-12-03 Thread Jean-Michel Pichavant
Chris Rebert wrote: On Wed, Dec 2, 2009 at 8:55 PM, cmckenzie mckenzi...@gmail.com wrote: Hi. I'm new to Python, but I've managed to make some nice progress up to this point. After some code refactoring, I ran into a class design problem and I was wondering what the experts thought. It goes

Re: testing command line scripts that use optparse

2009-12-04 Thread Jean-Michel Pichavant
Peter wrote: Hi I have a script like this: def doit(input, output): parser = OptionParser() parser.add_option(-a, --accounts, dest=accounts, default=all, help=list available accounts) ... (options, args) = parser.parse_args() # main driver if __name__ == __main__:

Re: subprocess kill

2009-12-07 Thread Jean-Michel Pichavant
luca72 wrote: On 5 Dic, 03:06, Carl Banks pavlovevide...@gmail.com wrote: On Dec 4, 3:44 pm, luca72 lucabe...@libero.it wrote: On 5 Dic, 00:14, luca72 lucabe...@libero.it wrote: On 5 Dic, 00:03, luca72 lucabe...@libero.it wrote: On 4 Dic, 23:23, Mike Driscoll

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: global printTree = function printTree, allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}] /var/www/html/angrynates.com/cart/catTree.py http://angrynates.com/cart/catTree.py in printTree(allTrees=[{'prodCat1': {}, 'prodCat2': {}},

Re: postgresql_autodoc in Python?

2009-12-07 Thread Jean-Michel Pichavant
Wolfgang Keller wrote: Hello, has anyone ever implemented something similar to postgresql_autodoc in Python? TIA, Sincerely, Wolfgang If by postgresql_autodoc you mean tools for generating html documentation from python code, yes. Starting from the ugliest: - pydoc - epydoc - sphinx

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Mon, Dec 7, 2009 at 7:14 AM, Jean-Michel Pichavant jeanmic...@sequans.com mailto:jeanmic...@sequans.com wrote: Victor Subervi wrote: global printTree = function printTree, allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: printTree(aTree[name], level + 1) ... print aTree([name], level + 1) ... Traceback (most recent call last): File stdin, line 4, in ? TypeError: 'dict' object is not callable Be cautious, you are now executing the same code ! Again, read carefully

accessing local variables from the pdb debugger

2009-12-10 Thread Jean-Michel Pichavant
Guys, I have some problem changing method locals with pdb: import pdb def test(): foo = 'foo' pdb.set_trace() test() --Return-- /home/jeanmichel/trunk/tnt/test.py(5)test()-None - pdb.set_trace() (Pdb) print foo foo (Pdb) foo = 'bar' (Pdb) print foo foo (Pdb) I tried

Re: accessing local variables from the pdb debugger

2009-12-10 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote: Jean-Michel Pichavant wrote: Guys, I have some problem changing method locals with pdb: import pdb def test(): foo = 'foo' pdb.set_trace() test() --Return-- /home/jeanmichel/trunk/tnt/test.py(5)test()-None - pdb.set_trace() (Pdb) print foo foo (Pdb) foo

Re: accessing local variables from the pdb debugger

2009-12-11 Thread Jean-Michel Pichavant
Lie Ryan wrote: On 12/11/2009 12:37 AM, Jean-Michel Pichavant wrote: Diez B. Roggisch wrote: By just inserting the print foo statement right after changing foo's value, I've rolled back the value to 'foo' ??? A hell of a wtf pdb feature ! Apparently it's fixed in 2.7 and 3.1 D:\Lie Ryan

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Jean-Michel Pichavant
Sylvain Thénault wrote: Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community release, including the work we've done during the pylint bug day [1] and patches mostly

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread Jean-Michel Pichavant
Jerry Hill wrote: On Fri, Dec 18, 2009 at 12:24 PM, Jean-Michel Pichavant File /opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/infutils.py, line 28, in module from logilab.astng._nodes import Proxy_, List, Tuple, Function, If, TryExcept ImportError

Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-21 Thread Jean-Michel Pichavant
Sylvain Thénault wrote: On 18 décembre 18:24, Jean-Michel Pichavant wrote: Sylvain Thénault wrote: Hi, I'm very pleased to announce the release of pylint 0.19 / astng 0.19.2 release! More information / download on http://www.logilab.org/project/pylint/0.19.0. This is a community

Re: How to validate the __init__ parameters

2009-12-21 Thread Jean-Michel Pichavant
Denis Doria wrote: Hi; I'm checking the best way to validate attributes inside a class. Of course I can use property to check it, but I really want to do it inside the __init__: class A: def __init__(self, foo, bar): self.foo = foo #check if foo is correct self.bar = bar

Re: RotatingFileHandler key error when parsing a logging config file

2009-12-22 Thread Jean-Michel Pichavant
jordilin wrote: Hi, I've a config for logging where I set up a file rotation with handlers.RotatingFileHandler and when the app parses the logging config it says keyError when trying to parse that section ('RotatingFileHandler' is not defined). Curiously enough, I can do import logging and from

Re: more efficient?

2009-12-22 Thread Jean-Michel Pichavant
Zubin Mithra wrote: I have the following two implementation techniques in mind. def myfunc(mystring): check = hello, there + mystring + !!! print check OR structure = [hello, there,,!!!] def myfunc(mystring): structure[2] = mystring output = ''.join(mystring) i heard that

Re: code review

2009-12-23 Thread Jean-Michel Pichavant
Zubin Mithra wrote: Hello, I`m pretty new to developing applications using python and i would like advance on this script i recently created which helps linux programmers on the linux terminal. The code is very simple to understand(i hope) and serves a simple purpose; however i am not sure if

Re: Problem with Dynamically unloading a module

2009-12-23 Thread Jean-Michel Pichavant
lordofcode wrote: Hi All Not an expert in Python, so sorry if this sounds like a silly question. I went through other few threads in the mailing list but they are not helping me much. I have run into a problem related to dynamically loading and unloading a module. I need to dynamically load a

Re: Problem with Dynamically unloading a module

2009-12-23 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: lordofcode wrote: Hi All Not an expert in Python, so sorry if this sounds like a silly question. I went through other few threads in the mailing list but they are not helping me much. I have run into a problem related to dynamically loading and unloading a module

Re: Problem with Dynamically unloading a module

2009-12-23 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Wed, 23 Dec 2009 13:37:06 +0100, Jean-Michel Pichavant wrote: But believe me, you don't want to mess up with the python import mechanism. Unless you understand how it works. Let me quote the OP: 'Not an expert in Python' I was just answering the OP

Re: Problem with Dynamically unloading a module

2009-12-23 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Wed, 23 Dec 2009 13:37:06 +0100, Jean-Michel Pichavant wrote: 3/ if you really need to unload the previous module, it's a little bit tedious. import mod1 del mod1 sys.modules['mod1'] = None Assigning sys.modules[name] to None is not the same as deleting

Re: Problem with Dynamically unloading a module

2009-12-24 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Wed, 23 Dec 2009 15:31:53 +0100, Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Wed, 23 Dec 2009 13:37:06 +0100, Jean-Michel Pichavant wrote: But believe me, you don't want to mess up with the python import mechanism

Re: Another Sets Problem

2009-12-29 Thread Jean-Michel Pichavant
Matt Nordhoff wrote: Victor Subervi wrote: On Mon, Dec 28, 2009 at 1:41 PM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: DON'T USE BARE EXCEPTS! (There are 2 in your code.) There are times when they are *necessary*. No, there aren't. Even if

Re: Bare Excepts

2009-12-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: Hi; I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot the others that don't (seem to) cause problems later. Here's a new one: for optionsStore, storeOptions in ourOptions().iteritems(): if store == optionsStore: for option in

Re: Bare Excepts

2009-12-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi victorsube...@gmail.com mailto:victorsube...@gmail.com wrote: Anyway, you should definitely use a coding rule checker, like pylint or pyckeck. It would sometimes point you into the correct direction. For

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: En Mon, 04 Jan 2010 05:24:56 -0300, David Williams da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a =

Re: Recommended new way for config files

2010-01-07 Thread Jean-Michel Pichavant
Peter wrote: Hi There seems to be several strategies to enhance the old ini-style config files with real python code, for example: 1) the documentation tool sphinx uses a python file conf.py that is exefile(d) , but execfile is suppressed in Python 3 2) there is a module cfgparse on

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jean-Michel Pichavant
tiago almeida wrote: Hello all, I'd like to ask how you'd implement a function /f/ that transforms a list of elements into a list of lists of elements by grouping contiguous elements together. Examples: a=[1,2,3,4,5] print( f(a, 2) ) # - [ [1, 2], [3, 4], [5] ] print( f(a, 3) ) # - [

Re: getfirst and re

2010-01-08 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden st...@holdenweb.com mailto:st...@holdenweb.com wrote: MRAB wrote: Victor Subervi wrote: [snip] Code snippet: def cgiFieldStorageToDict(fieldStorage):

Re: How to validate the __init__ parameters

2010-01-11 Thread Jean-Michel Pichavant
Aahz wrote: In article mailman.2244.1261418090.2873.python-l...@python.org, Jean-Michel Pichavant jeanmic...@sequans.com wrote: class A: def __init__(self, foo = None, bar = None): if len(foo) 5: raise ValueError('foo cannot exceed 5 characters') Bad Idea

Re: Easy Q

2010-01-11 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron gher...@islandtraining.com mailto:gher...@islandtraining.com wrote: Victor Subervi wrote: Hi; I have a string.join statement on a variable that comes from a cgi.FieldStorage().getlist. The variable

Re: Interesting (?) problem

2010-01-11 Thread Jean-Michel Pichavant
mk wrote: Incidentally, it *seems* that list comprehension preserves order: hostips_limited = [ h for h in hostips if h in thread_results ] Empirically speaking it seems to work (I tested it on real ips), but please correct me if that's wrong. Regards, mk Sounds good to me. List are

Re: Interesting (?) problem

2010-01-11 Thread Jean-Michel Pichavant
mk wrote: mk wrote: Hello everyone, I have two lists of IP addresses: hostips = [ 'a', 'b', 'c', 'd', 'e' ] thread_results = [ 'd', 'b', 'c' ] I need to sort thread_results in the same order as hostips. P.S. One clarification: those lists are actually more complicated (thread_result is a

Re: Writing a string.ishex function

2010-01-14 Thread Jean-Michel Pichavant
Phlip wrote: MRAB wrote: BTW, ishex('') should return False. So should int('')! Did you mean isint('') ? JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Jean-Michel Pichavant
Paul Rubin wrote: a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF area looking for a job near Mountain View? I'm surprised there aren't a ton of Python programmers there, given that's where

Re: Changing var names

2010-01-15 Thread Jean-Michel Pichavant
Victor Subervi wrote: Hi; Well it took me *less than a day* to fix the following problems: -- bare excepts (accidentally left a couple I think) -- sql injection attacks -- recreating tables to make them more reasonable ** Programming is an ITERATIVE

Re: Changing var names

2010-01-18 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Fri, Jan 15, 2010 at 3:15 PM, Adam Tauno Williams awill...@opengroupware.us mailto:awill...@opengroupware.us wrote: On Fri, 2010-01-15 at 13:27 -0400, Victor Subervi wrote: Hi; Well it took me *less than a day* to fix the following problems: -- bare

Proper display of XMLRPCserver exceptions

2010-01-18 Thread Jean-Michel Pichavant
To all using xmlrpclib, I had trouble getting a proper display of my exceptions occuring on the server. Basically, xmlrpclib only display the exception itself without any traceback, on the client side. Something like Fault 1: type 'exceptions.KeyError':2 Ok then there's a key error, but how

Re: not and is not problem

2010-01-18 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 18 Jan 2010 16:43:25 +0100, superpollo wrote: hi: #!/usr/bin/env python data = seq=123 name , value = data.split(=) print name print value if not name == seq: print DOES NOT PRINT OF COURSE... if name is not seq: print WTF! WHY DOES IT PRINT?

using super

2010-01-18 Thread Jean-Michel Pichavant
class SubClass(Base): colour = Red def parrot(self): docstring for Subclass return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if return super(self.__class__, self).parrot() would have made it. What if Subclass has more than

Re: using super

2010-01-18 Thread Jean-Michel Pichavant
Duncan Booth wrote: Jean-Michel Pichavant jeanmic...@sequans.com wrote: class SubClass(Base): colour = Red def parrot(self): docstring for Subclass return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if return

Re: using super

2010-01-19 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: I see. Then is there a reason why return super(Subclass, self).parrot() would be prefered over the classic return Base.parrot(self) ? Or is it just a matter of preference ? For a longer explanation, see: James Knight: Python's Super Considered Harmful

Re: how to check if a module is importable?

2010-01-20 Thread Jean-Michel Pichavant
Robert P. J. Day wrote: finally getting back to clawing my way thru the python 3 book so probably a number of newbie questions coming up. first one -- can i check if a module is importable (equivalently, exists on sys.path, i assume) without trying to import it first? i can see that i can

Re: why the super class can access the subclass's attribute

2010-01-21 Thread Jean-Michel Pichavant
yousay wrote: I have sees aprogram like this ,i confusing why super class can access the subclass's attribute ,this is the program,thanks in advance: class MyThread(threading.Thread): def join(self): super(MyThread,self).join() return self.result class Worker(MyThread):

Re: deleting, then re-importing a class method

2010-01-21 Thread Jean-Michel Pichavant
Robert P. J. Day wrote: (once again, never ashamed to ask the dumb questions.) still playing with python3, and testing whether i can delete/unimport a specific method, then re-import it: import sys print(sys.__doc__) ... blah blah blah ... del(sys.__doc__)

Re: Symbols as parameters?

2010-01-21 Thread Jean-Michel Pichavant
Martin Drautzburg wrote: Hello all, When passing parameters to a function, you sometimes need a paramter which can only assume certain values, e.g. def move (direction): ... If direction can only be up, down, left or right, you can solve this by passing strings, but

Re: Symbols as parameters?

2010-01-22 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: (3) Then somone suggested to tie the constants to the function itself, as in def move(direction): print moving %s % direction move.UP = 'up' move.DOWN = 'down' This is quite nice. I would call it a horrible, horrible, horrible code smell. A stench in fact.

Re: Symbols as parameters?

2010-01-22 Thread Jean-Michel Pichavant
Ben Finney wrote: Jean-Michel Pichavant jeanmic...@sequans.com writes: Steven D'Aprano wrote: I would call it a horrible, horrible, horrible code smell. A stench in fact. […] As soon as it is properly documented, as a public interface should be, it becomes an acceptable

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jean-Michel Pichavant
Gilles Ganault wrote: Hello I use a dictionary to keep a list of users connected to a web site. To avoid users from creating login names that start with digits in order to be listed at the top, I'd like to sort the list differently every minute so that it'll start with the next letter, eg.

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Gilles Ganault wrote: Hello I use a dictionary to keep a list of users connected to a web site. To avoid users from creating login names that start with digits in order to be listed at the top, I'd like to sort the list differently every minute so that it'll start

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jean-Michel Pichavant
Gilles Ganault wrote: On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Sorry, the code I provided produce this output: ['1a', 'a', 'ac', 'av', 'b', 'c'] ['a', 'ac', 'av', 'b', 'c', '1a'] ['b', 'c', '1a', 'a', 'ac', 'av'] ['c', '1a', 'a', 'ac', 'av', 'b

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Gilles Ganault wrote: On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Sorry, the code I provided produce this output: ['1a', 'a', 'ac', 'av', 'b', 'c'] ['a', 'ac', 'av', 'b', 'c', '1a'] ['b', 'c', '1a', 'a', 'ac', 'av

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-25 Thread Jean-Michel Pichavant
Ron wrote: Sikuli is the coolest Python project I have ever seen in my ten year hobbyist career. An MIT oepn source project, Sikuli uses Python to automate GUI tasks (in any GUI or GUI baed app that runs the JVM) by simply drag and dropping GUI elements into Python scripts as function arguments.

Re: ANN: Urwid 0.9.9.1 - Console UI Library

2010-01-25 Thread Jean-Michel Pichavant
Ian Ward wrote: Announcing Urwid 0.9.9.1 Urwid home page: http://excess.org/urwid/ Screen shots: http://excess.org/urwid/examples.html Tarball: http://excess.org/urwid/urwid-0.9.9.1.tar.gz About this release: === This maintenance release fixes

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-26 Thread Jean-Michel Pichavant
Terry Reedy wrote: On 1/25/2010 9:14 AM, Javier Collado wrote: I think the site is under maintenance. I tried a couple of hours ago and it worked fine. As an alternative, I found that this link also worked: http://www.sikuli.org/ This just redirects to the link below

Re: Accessing the name of an actual parameter

2010-01-26 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a)

pylint and the 'missing docstring' warning

2010-01-26 Thread Jean-Michel Pichavant
Hello, Does anyone using pylint knows a way to make pylint ignore these 'missing docstring' warnings when the base class version of the method actually defines the docstring ? 'Cause my doc builder (epydoc) handle it properly and propagate docstrings if asked to. Too bad pylint is complaining

Re: pylint and the 'missing docstring' warning

2010-01-26 Thread Jean-Michel Pichavant
John Posner wrote: On 1/26/2010 8:43 AM, Jean-Michel Pichavant wrote: Hello, Does anyone using pylint knows a way to make pylint ignore these 'missing docstring' warnings when the base class version of the method actually defines the docstring ? 'Cause my doc builder (epydoc) handle

Re: Accessing the name of an actual parameter

2010-01-26 Thread Jean-Michel Pichavant
Duncan Booth wrote: Gary Herron gher...@islandtraining.com wrote: It's naive to think this question even makes sense. There are many ways f can be called which don't involve a parameter: f(42) f(time()) f(a+123) f(sin(a)) f(f(1)) and so on. So long as the OP doesn't care if they

Re: pylint and the 'missing docstring' warning

2010-01-26 Thread Jean-Michel Pichavant
John Posner wrote: On 1/26/2010 9:22 AM, Jean-Michel Pichavant wrote: John Posner wrote: On 1/26/2010 8:43 AM, Jean-Michel Pichavant wrote: Hello, Does anyone using pylint knows a way to make pylint ignore these 'missing docstring' warnings when the base class version of the method actually

Re: myths about python 3

2010-01-27 Thread Jean-Michel Pichavant
Daniel Fetchinson wrote: Hi folks, I was going to write this post for a while because all sorts of myths periodically come up on this list about python 3. I don't think the posters mean to spread false information on purpose, they simply are not aware of the facts. My list is surely

Re: Need help with a program

2010-01-28 Thread Jean-Michel Pichavant
evilweasel wrote: I will make my question a little more clearer. I have close to 60,000 lines of the data similar to the one I posted. There are various numbers next to the sequence (this is basically the number of times the sequence has been found in a particular sample). So, I would need to

Re: Need help with a program

2010-01-28 Thread Jean-Michel Pichavant
D'Arcy J.M. Cain wrote: On Thu, 28 Jan 2010 18:49:02 +0100 Jean-Michel Pichavant jeanmic...@sequans.com wrote: Using regexp may increase readability (if you are familiar with it). If you have a problem and you think that regular expressions are the solution then now you have two

Re: Function name unchanged in error message

2010-01-29 Thread Jean-Michel Pichavant
andrew cooke wrote: Is there any way to change the name of the function in an error message? In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like the wrapper function to give the same name) def foo(): ...

Re: SimpleXMLRPCServer daemon

2010-02-01 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: En Fri, 29 Jan 2010 12:54:23 -0300, Thomas Allen thomasmal...@gmail.com escribió: I have a script that runs an instance of SimpleXMLRPCServer and in general it works as expected. In its __del__, it is supposed to clean up its PID file (written on boot). I have two

Re: How to guard against bugs like this one?

2010-02-02 Thread Jean-Michel Pichavant
Carl Banks wrote: On Feb 1, 7:33 pm, Tim Chase python.l...@tim.thechases.com wrote: Stephen Hansen wrote: First, I don't shadow built in modules. Its really not very hard to avoid. Given the comprehensive nature of the batteries-included in Python, it's not as hard to

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Jean-Michel Pichavant
Masklinn wrote: When trying to load the following config file, I get an error ``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled configparser in 3.1): [loggers] keys=root,0

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-02 Thread Jean-Michel Pichavant
Masklinn wrote: Jean-Michel Pichavant wrote: To add a custom level, I would proceed that way: logging.ALERT = 45 logging.addLevelName(logging.ALERT, 'ALERT !!') logging.getLogger().log(logging.ALERT, 'test') Passing a string to the log method as you did is incorrect. I know it's

Re: How to guard against bugs like this one?

2010-02-02 Thread Jean-Michel Pichavant
Carl Banks wrote: On Feb 2, 2:49 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Carl Banks wrote: Name your modules send_email.py or sort_email.py or if it's a library module of related functions, email_handling.py. Modules and scripts do things (usually), they should

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Jean-Michel Pichavant
The reason is that log takes an *int* as first argument that defines the logging level. You gave a string. So There is definitely a reason for it to be incorrect. That's not a reason, that's just what currently happens. I know it doesn't work, and I know why, I went and checked the

Re: Logging oddity: handlers mandatory in every single logger?

2010-02-03 Thread Jean-Michel Pichavant
Masklinn wrote: On 3 Feb 2010, at 11:50 , Jean-Michel Pichavant wrote: You don't neeed to check the code for that ! It is written in the documentation. The logging module designer choose to ask for a level, not a level name, possibly because 2 different levels can have the same name

Re: Dreaming of new generation IDE

2010-02-03 Thread Jean-Michel Pichavant
Adam Tauno Williams wrote: Yes, it certainly does. Not that you'll get many Pythonistas to confess to that fact. Somehow those who brag about the readability and expressiveness of source code just cannot admit that: class.method(sting name, int count) - is *obviously* more expressive than

Re: Repeat an exception

2010-02-04 Thread Jean-Michel Pichavant
MRAB wrote: In other words: for attempt in range(2): try: spanish_field = translate(english_field, lang_to='es', lang_from='en') break except TranslationError: pass else: # Didn't break out of the loop, therefore not successful. print Translation failed

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-05 Thread Jean-Michel Pichavant
News123 wrote: Yhanks a lot I'll check whether this is the root cause. Currently my machine could live without IPV6 bye N Gabriel Genellina wrote: En Thu, 04 Feb 2010 19:34:20 -0300, News123 news...@free.fr escribió: I wrote a small xmlrpc client on Windows 7 with python 2.6

Re: Your beloved python features

2010-02-05 Thread Jean-Michel Pichavant
Ethan Furman wrote: Julian wrote: Hello, I've asked this question at stackoverflow a few weeks ago, and to make it clear: this should NOT be a copy of the stackoverflow-thread hidden features of Python. I want to design a poster for an open source conference, the local usergroup will have a

Re: which

2010-02-05 Thread Jean-Michel Pichavant
mk wrote: if isinstance(cmd, str): self.cmd = cmd.replace(r'${ADDR}',ip) else: self.cmd = cmd or self.cmd = cmd if isinstance(cmd, str): self.cmd = cmd.replace(r'${ADDR}',ip) I would vote for the first one. But I could use the second as well, I would'nt fight for it. What is

Re: Your beloved python features

2010-02-05 Thread Jean-Michel Pichavant
Bruno Desthuilliers wrote: Julian a écrit : Hello, I've asked this question at stackoverflow a few weeks ago, and to make it clear: this should NOT be a copy of the stackoverflow-thread hidden features of Python. I want to design a poster for an open source conference, the local usergroup

Re: which

2010-02-05 Thread Jean-Michel Pichavant
mk wrote: Jean-Michel Pichavant wrote: What is worrying me the most in your code sample is that self.cmd can hold diferrent types (str, and something else). That is usually a bad thing to do (putting None aside). However, my remark could be totally irrelevant of course, that depends

Re: method to intercept string formatting % operations

2010-02-05 Thread Jean-Michel Pichavant
bradallen wrote: Hello, For container class derived from namedtuple, but which also behaves like a dictionary by implementing __getitem__ for non-integer index values, is there a special reserved method which allows intercepting % string formatting operations? I would like for my container type

Re: which

2010-02-05 Thread Jean-Michel Pichavant
John Posner wrote: On 2/5/2010 9:21 AM, mk wrote: if isinstance(cmd, str): self.cmd = cmd.replace(r'${ADDR}',ip) else: self.cmd = cmd or self.cmd = cmd if isinstance(cmd, str): self.cmd = cmd.replace(r'${ADDR}',ip) (lunatic fringe?) Last August [1], I offered this

xmlrcp - how to marshall objects

2010-02-05 Thread Jean-Michel Pichavant
Deos anyone knows where to find an code sample describing how to implement the interface to marshall one object into XMLRPC compliant structures ? I googled without any success, and what google does not find does not exist. Let say I have this very simple class: class Point: def

Re: which

2010-02-05 Thread Jean-Michel Pichavant
mk wrote: Jean-Michel Pichavant wrote: If you can change your program interface, then do it, if not then you're right you don't have much choice as you are suffering from the program poor interface. You can fix this problem by explicitly asking for the thing you want to do, instead

Re: Drawing a zig-zag Trail in Python?

2010-02-05 Thread Jean-Michel Pichavant
mk wrote: W. eWatson wrote: I'd like to draw something like an animal track. Between each point is a line. Perhaps the line would have an arrow showing the direction of motion. There should be x-y coordinates axises. PIL? MatPlotLib, ?? Pycairo? turtle

Re: xmlrcp - how to marshall objects

2010-02-05 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Deos anyone knows where to find an code sample describing how to implement the interface to marshall one object into XMLRPC compliant structures ? I googled without any success, and what google does not find does not exist. Let say I have this very simple class

Re: xmlrcp - how to marshall objects

2010-02-05 Thread Jean-Michel Pichavant
mk wrote: Jean-Michel Pichavant wrote: Why not dump the whole thing and use Pyro, which works beautifully and handles all the serialization business by itself, you get a Python object on the other side? Unless xmlrpc has to be at the other end, that is. Company stuff. We are all using

Re: xmlrcp - how to marshall objects

2010-02-06 Thread Jean-Michel Pichavant
Adam Tauno Williams wrote: On Fri, 2010-02-05 at 18:24 +0100, Jean-Michel Pichavant wrote: Jean-Michel Pichavant wrote: Deos anyone knows where to find an code sample describing how to implement the interface to marshall one object into XMLRPC compliant structures ? I googled without

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-06 Thread Jean-Michel Pichavant
News123 wrote: Hi JM, Jean-Michel Pichavant wrote: import socket # server server = SimpleXMLRPCServer((socket.gethostname(), 5000), logRequests=False, allow_none=True) # client xmlrpclib.ServerProxy(http://%s.yourdomain.com:%s; % (socket.gethostname(), 5000)) Well

Re: Calendar GUI

2010-02-06 Thread Jean-Michel Pichavant
Michael Torrie wrote: Gabriel wrote: On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wgaggi...@gmail.com wrote: I'm working on setting up some software for a Peruvian non-profit to help them organize their incoming volunteers. One of the features I'd like to add is a calendar-like

  1   2   3   4   5   6   7   8   9   10   >