Re: How to pass a global variable to a module?

2009-09-29 Thread Jean-Michel Pichavant
Mars creature wrote: Dear Python users, I just start to use python and love this language. I met this problem when I try to save my functions in a separate file. The question is how I can pass a global variable to a function which is saved in another file. If I save the function I defined in th

Re: How to pass a global variable to a module?

2009-09-30 Thread Jean-Michel Pichavant
understand the point that global variables tends to mess up programs. Assume that I have 10 parameters need to pass to the function. If these parameters are fixed, I can use another module to store these 10 parameters, and import to the module, as suggested by jean-michel. But what if these 10 param

Re: epydoc - can I provide multiple dirs to parse

2009-10-05 Thread Jean-Michel Pichavant
Medi wrote: Can I present multiple directories to epydoc to process. For example epydoc -option -option -option dir_1 dir_2 dir_3 where dir_i is a directory containing some python src codes ? I am currently running it on two directories with about 10M + 20 Meg which takes a very long time (mor

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-05 Thread Jean-Michel Pichavant
Philip Semanchuk wrote: Hi all, Our project uses some libraries that were written by 3rd parties (i.e. not us). These libraries fit into a single Python file and live in our source tree alongside other modules we've written. When our app is distributed, they'll be included in the installation.

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Jean-Michel Pichavant
It doesn't really matter in the end. Cheers, Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list

Re: epydoc - can I provide multiple dirs to parse

2009-10-06 Thread Jean-Michel Pichavant
Montaseri wrote: Thank you It looks like it is possible to feed multiple dirs, Also, can you explain the --inheritance=STYLE for me. What does the author mean by values like "grouped", "listed", "included" I could not find any good document explaining these... Thanks Medi Sorry, I don't reme

Re: When ‘super’ is not a good idea

2009-10-07 Thread Jean-Michel Pichavant
Ben Finney wrote: Scott David Daniels writes: Scott David Daniels wrote: class Initialized(ClassBase): @classmethod def _init_class(class_): class_.a, class_.b = 1, 2 super(Initialized, class_)._init_class() Mea culpa: Here super is

Re: When ‘super’ is not a good id ea

2009-10-07 Thread Jean-Michel Pichavant
alex23 wrote: Jean-Michel Pichavant wrote: a possible answer: - explicit >> implicit I'm not sure this is the correct one though :) To me, the explicit reference to the base class violates DRY. It also means you need to manually change all such references should the base

Re: best vi / emacs python features

2009-10-07 Thread Jean-Michel Pichavant
OdarR wrote: hello, * this is not a troll * which kind of help you have with your favorite editor ? personnally, I find emacs very nice, in the current state of my knowledge, when I need to reindent the code. you know how this is critical in python...:-) I don't use other python-mode features

Re: best vi / emacs python features

2009-10-07 Thread Jean-Michel Pichavant
Apart of trolling which is also an activity I like, what are the features vim proposes to Python ? Olivier Many, but none that you won't find with emacs, so when I'm stating it is just a matter of personal preference, I mean it :o) "Vi or Emacs" is the same question as "straight or gay"

Re: best vi / emacs python features

2009-10-08 Thread Jean-Michel Pichavant
Chris Jones wrote: On Wed, Oct 07, 2009 at 07:06:08PM EDT, TerryP wrote: [..] I am a freak: I do not use nor want syntax highlighting. I don't want my editor to understand mail, irc, or the www either, I want it to edit text efficiently so I can go on with the rest of my life as soon as pos

Re: When ‘super’ is not a good id ea

2009-10-08 Thread Jean-Michel Pichavant
alex23 wrote: Jean-Michel Pichavant wrote: alex23 wrote: To me, the explicit reference to the base class violates DRY. It also means you need to manually change all such references should the base class ever change, something that using super() avoids. I found the correct

Re: Is there a better way to code variable number of return arguments?

2009-10-08 Thread Jean-Michel Pichavant
Dr. Phillip M. Feldman wrote: I currently have a function that uses a list internally but then returns the list items as separate return values as follows: if len(result)==1: return result[0] if len(result)==2: return result[0], result[1] (and so on). Is there a cleaner way to accomplish the s

Re: New hire

2009-10-12 Thread Jean-Michel Pichavant
Emeka wrote: Hello All, I am new to python , and my aim is to use it to write sugar-based applications on XO(OLPC). I am not new to programming in general, I would want to know the best route to take in learning python. I have background in FP and Imperative languages. Regards, Emeka Welcom

Re: Where to find pexpect

2009-10-13 Thread Jean-Michel Pichavant
Antoon Pardon wrote: I have been looking for pexpect. The links I find like http://pexpect.sourceforge.net all end up at http://www.noah.org/wiki/Pexpect which produces a 404 not found problem. Does someone know the current location? maybe they removed the distribution so you may use "subpr

Re: python along or bash combined with python (for manipulating files)

2009-10-14 Thread Jean-Michel Pichavant
Peng Yu wrote: Bash is easy to use +JOTW :) JM -- http://mail.python.org/mailman/listinfo/python-list

Re: What command should be use when the testing of arguments is failed?

2009-10-15 Thread Jean-Michel Pichavant
Peng Yu wrote: I have the following python code snippet. I'm wondering what command I should use to terminate the program if the arguments are not right. #!/usr/bin/env python import sys import os if len(sys.argv) <= 1: print "usage:", os.path.basename(sys.argv[0]), '' return ## what comma

Re: optparse, allowing both --foo and foo=99?

2009-10-16 Thread Jean-Michel Pichavant
Carl Banks wrote: On Oct 15, 10:29 pm, Mark Harrison wrote: What's the magic to allow this? If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option("--debug") (opts, args) = p.parse_args(['--debug=22']); print opts (

Re: optparse, allowing both --foo and foo=99?

2009-10-16 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Carl Banks wrote: On Oct 15, 10:29 pm, Mark Harrison wrote: What's the magic to allow this? If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option("--debug") (opts, args)

Re: re.sub question (regular expressions)

2009-10-16 Thread Jean-Michel Pichavant
Chris Seberino wrote: What does this line do?... input_ = re.sub("([a-zA-Z]+)", '"\\1"', input_) Does it remove parentheses from words? e.g. (foo) -> foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub("(\w+)", '"\\1"', input_) blows up. Why? cs

Re: Re-enabling a logger

2009-10-22 Thread Jean-Michel Pichavant
jorma kala wrote: Hi, I'm using the logging module. At one point in my code I disable logging like this: logging.disable(logging.INFO) But how can I enable the logging again further on? I've tried the following, which doesn't work for re-enabling the logger: my_logger.setLevel(logging.INF

Re: Terminating python script easily

2009-10-22 Thread Jean-Michel Pichavant
Balban wrote: Hi, I have a python build script that calls various commands, some using os.system(). Often, if I want to terminate the script prematurely, I press ctrl-c, but I have to do this many times before I can kill the script for good. I was wondering is there a way that I define a signal

Re: Validating positional arguments in optparse

2009-10-23 Thread Jean-Michel Pichavant
Filip Gruszczyński wrote: optparse module is quite smart, when it comes to validating options, like assuring, that certain option must be an integer. However, I can't find any information about validating, that positional arguments were provided and I can't find methods, that would allow defining

Re: A new way to configure Python logging

2009-10-23 Thread Jean-Michel Pichavant
application entry point file, in python code. I'm not sure I am that concerned. However being a great fan of this module, I kindly support you for any improvements you may add to this module and appreciate all the work you've already done so far. Cheers, Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list

Best way to configure a logger hierarchy (was Re: A new way to configure Python logging)

2009-10-26 Thread Jean-Michel Pichavant
Vinay Sajip wrote: Wolodja Wentland cl.uni-heidelberg.de> writes: -- I usually register a logger 'foo' within the application and one logger for each module in the package, so the resulting logger hierarchy will look like this: foo |__bar |__baz |__n

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 communit

Re: About one class/function per module

2009-11-04 Thread Jean-Michel Pichavant
Peng Yu wrote: With some automated script, I don't think it is a nightmare to change function names. I can change function names and filenames and their reference with a simple command. I'd think that this is the limitation of current version control system. I don't aware of any version control

Re: Query about doing fortran-esque repeat formatting

2009-11-09 Thread Jean-Michel Pichavant
Glenn Hutchings wrote: Rob Briggs 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], tmp[i][8], tmp[i

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 writes: 2009/11/16 Yasser Almeida Hernández : How is the sintaxis for set the TODO and FIXME tags...? ... There's no widely-followed “syntax” for this convention, though. Except for _not_ doing what is sugg

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 subproc

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 ter

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

2009-11-25 Thread Jean-Michel Pichavant
ileHandler("client.log")) rootLogger.handlers[-1].setFormatter(logging.Formatter("%(asctime)s %(name)-12s %(levelname)-8s %(message)s")) rootLogger.setLevel(logging.DEBUG) ser = Server() cli = Client() ser.util() cli.client_test() Happy logging, Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Jean-Michel Pichavant
, cause I will end up handling with asserts what I should in fact handle properly in what you call the production code. Anyway that does not answer your question I'm sorry to be off topic, 'tis just a thought. Simon gave you the proper answer. Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list

Re: SimpleXMLRPCServer daemon

2010-02-01 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: En Fri, 29 Jan 2010 12:54:23 -0300, Thomas Allen 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 problems with this server

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 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 accidentally shadow a built-in, unknown

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

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

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 code

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

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 escribió: I wrote a small xmlrpc client on Windows 7 with python 2.6 srv = xmlrpclib.S

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 w

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 wi

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

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 alternative

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 __init__(s

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,

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 http://docs.python.org/library/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)) Wel

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 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 view of the different v

Re: python admin abuse complaint

2010-02-07 Thread Jean-Michel Pichavant
Steve Holden wrote: Shashwat Anand wrote: LOL pow(funny, sys.maxint) Yes, funny, but it overlooks the point that Xah is a nuisance to multiple communities, not just to ours, and quite often concurrently. I'm all in favor of tolerance, but I'd like to see some evidence that rehabilitat

Re: convention for documenting function parameters in doc strings

2010-02-08 Thread Jean-Michel Pichavant
danielx wrote: Is there a convention for how to document function (or method) parameters in doc strings? Recently, I've been doing alot of PHP programming, and in PHPdoc, you'd do it like this: /* * @param type $foo Description. * * @return type Description. */ function bar($foo) { ... }

Re: use strings to call functions

2010-02-08 Thread Jean-Michel Pichavant
Klaus Neuner wrote: Hello, I am writing a program that analyzes files of different formats. I would like to use a function for each format. Obviously, functions can be mapped to file formats. E.g. like this: if file.endswith('xyz'): xyz(file) elif file.endswith('abc'): abc(file) ... Y

Re: use strings to call functions

2010-02-08 Thread Jean-Michel Pichavant
Aahz wrote: In article <0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>, OdarR wrote: and with eval(), did you try ? WARNING: eval() is almost always the wrong answer to any question Some say that eval is evil ! JM -- http://mail.python.org/mailman/listinfo/py

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
Carl Banks wrote: On Feb 8, 12:20 pm, spike wrote: Has anyone been able to come across a Python logic map or Python logic flow chart? An example can be seen on the right under History:http://en.wikipedia.org/wiki/Usenet#History This would be very helpful for all users. Begin |

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
I use this one: Begin | | V Start Mail client | | V Ask python-list <-+ | | | | Vwhat a bunch of dumbass wait 2 min| | | | | No. V | Did you get any answer

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I have a simple tcp server and client where the server sits and waits for a message and then processes it, my client sends its first message to the server. On the server I receive: socket.error: [Errno 107] Transport endpoint is not connected when calling msg = self.socket.r

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I found my car ;) here's the server: class commServer: """Class to hold a tcp server and interact with with it allows for a wrapper around socket class to keep code clean""" def __init__ (self, host, hostid, port, buff =1024): self.host = host se

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread Jean-Michel Pichavant
CyclingGuy wrote: Can anyone recommend a PostgreSQL driver for Python that supports selecting and inserting bytea types? I'm not looking to write server functions in Python, just client applications. Thank you Eric. Did you try any ? I know about pgdb, and since it has a function called esca

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: http://docs.python.org/library/socketserver.html JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? docstring of

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Jean-Michel Pichavant
Grant Edwards wrote: What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple

Re: New to Python

2010-02-09 Thread Jean-Michel Pichavant
Quin wrote: s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython Th

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I'm willing to bet money that it is not. If ironPython had a broken if statement, don't you think we would have known, already ? There's a rule when test writing/testin

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Well, now you know! "Jean-Michel Pichavant" wrote in message news:mailman.2286.1265797348.28905.python-l...@python.org... Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I&#x

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: You know, Jack, that was the point of my original post: to determine why things weren't working. Do you still want to bet money that it is? I can screenshot you TD. Another flaming war starting... IronPython implements python 2.5 and you're still complaining about your py3 cod

Re: looking for some libraries

2010-02-10 Thread Jean-Michel Pichavant
Vision wrote: hi all, I am doing some stuffs with some software, which has similar layout like this: Editbox1 Editbox2 Editbox3 _OK_ ___ |output| |output| |output| |output| |output

Re: SimpleXMLRPCServer and client address

2010-02-10 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I'm trying to right a server that needs specific information for each client accessing it. The easiest way I could think of doing this is keeping this information based on ip address (the information is only valid for a short time). I know there is no was to get the client's

Re: SimpleXMLRPCServer and client address

2010-02-11 Thread Jean-Michel Pichavant
Stephen Hansen wrote: On Wed, Feb 10, 2010 at 5:36 PM, Jean-Michel Pichavant mailto:jeanmic...@sequans.com>> wrote: I don't know exactly what you are trying to do, but if your server requires informations from the client, it would be better to ask explicitly the clien

Re: ANN: obfuscate

2010-02-12 Thread Jean-Michel Pichavant
Bob Martin wrote: in 16 20100212 034121 Paul Rubin wrote: See http://en.wikipedia.org/wiki/Colossus_computer That was almost at the end of the war though. Colossus was working by the end of 1943 - the year that the Americans first dropped bombs on Germany ;-) sept 1939 -

Re: concatenate fasta file

2010-02-12 Thread Jean-Michel Pichavant
PeroMHC wrote: Hi All, I have a simple problem that I hope somebody can help with. I have an input file (a fasta file) that I need to edit.. Input file format name 1 tactcatacatac name 2 acggtggcat name 3 gggtaccacgtt I need to concatenate the sequences.. make th

Re: Replace various regex

2010-02-15 Thread Jean-Michel Pichavant
Martin wrote: Hi, I am trying to come up with a more generic scheme to match and replace a series of regex, which look something like this... 19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft) 5.0, 4.0, 2.0, 4.0, 1.0 ! lai(1:npft) Ideally match the pattern to the right of the "!" sign (e.g

Re: Replace various regex

2010-02-15 Thread Jean-Michel Pichavant
Martin wrote: On Feb 15, 2:03 pm, Jean-Michel Pichavant wrote: Martin wrote: Hi, I am trying to come up with a more generic scheme to match and replace a series of regex, which look something like this... 19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft) 5.0, 4.0, 2.0

Re: how to structure a directory with many scripts and shared code

2010-02-15 Thread Jean-Michel Pichavant
Benedict Verheyen wrote: Hi, i wanted to ask how you guys structure your code. I mainly have scripts that automate small tasks. These scripts use a common set of utility code. My code is structured like this, for example: script_1.py script_2.py script_3.py tools\ |->__init__.py |->logu

Re: Loop problem while generating a new value with random.randint()

2010-02-15 Thread Jean-Michel Pichavant
Paulo Repreza wrote: Greetings, I'm having problems with a little script that I'm trying to finish, I don't know if I'm in the right track but I know somebody is going to help me. The script: # Import modules random for function randint import random # Generating a constant. var = 65 #

Re: get a field

2010-02-15 Thread Jean-Michel Pichavant
mierdatutis mi wrote: Hi, I have this: pe="http://www.rtve.es/mediateca/videos/20100211/saber-comer---patatas-castellanas-costillas-11-02-10/691046.shtml"; I would like to extract this: 691046.shtml But is dynamically. Not always have the same lenght the string. Could you help me how could

Re: Using class attributes

2010-02-16 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: Leo Breebaart writes: Chris Rebert writes: On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: I have a base class Foo with a number of derived classes FooA, FooB, FooC, etc. Each of these derived classes needs to read (upon initialisation) text

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread Jean-Michel Pichavant
Benedict Verheyen wrote: sstein...@gmail.com wrote: On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote: python_scripts | |-->trunk ..|-> my big script 1 |-> setup.py ..|-> my big script 2 |-> setup.py ..|-> database

Re: Is automatic reload of a module available in Python?

2010-02-17 Thread Jean-Michel Pichavant
R (Chandra) Chandrasekhar wrote: Dear Folks, I am currently developing a python program, let us call it "generic.py", and I am testing out the functions therein by testing them out interactively in the python interpreter by invoking python and doing import generic Once I hit an error, I ne

Re: Referring to class methods in class attributes

2010-02-17 Thread Jean-Michel Pichavant
mk wrote: Stephen Hansen wrote: You don't have to (and can't) refer to the class within the body. Class statements are sort of... odd. They are code which is directly executed, and the results are then passed into a metaclass/type/whatever and a class object is created. While within the clas

Re: Creating Import Hooks

2010-02-18 Thread Jean-Michel Pichavant
Sreejith K wrote: On Feb 18, 1:57 pm, Steven D'Aprano wrote: On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: On Feb 17, 10:48 pm, Sreejith K wrote: Hi everyone, I need to implement custom import hooks for an application (http://www.python.org/dev/peps/pep

Re: Creating Import Hooks

2010-02-18 Thread Jean-Michel Pichavant
Sreejith K wrote: On Feb 18, 3:49 pm, Jean-Michel Pichavant wrote: Sreejith K wrote: On Feb 18, 1:57 pm, Steven D'Aprano wrote: On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: On Feb 17, 10:48 pm, Sreejith K wrote: Hi eve

Re: Constraints on __sub__, __eq__, etc.

2010-02-18 Thread Jean-Michel Pichavant
Andrey Fedorov wrote: It may be intuitive to you, but its not true, written down anywhere, nor assumed by the language, and the mathematical meaning of the operators doesn't matter to Python. Python purposefully does not enforce anything for these methods. Right, so neither is

Re: Executing Python code on another computer

2010-02-19 Thread Jean-Michel Pichavant
SiWi wrote: On Feb 19, 5:10 pm, "D'Arcy J.M. Cain" wrote: On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script execute on the workstation pc and write

Re: Avoid converting functions to methods in a class

2010-02-23 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: I have a convention when writing unit tests to put the target of the test into a class attribute, as follows: class MyTest(unittest.TestCase): target = mymodule.someclass def test_spam(self): """Test that someclass has a spam attribute.""" self.fa

Re: Pure virtual functions in Python?

2010-02-24 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: lallous writes: Hello How can I do something similar to pure virtual functions in C++ ? Let us consider this: class C1: # Pure virtual def cb(self, param1, param2): """ This is a callback @param param1: ... @param param2:

Re: Signature-based Function Overloading in Python

2010-02-24 Thread Jean-Michel Pichavant
Michael Rudolf wrote: Just a quick question about what would be the most pythonic approach in this. In Java, Method Overloading is my best friend, but this won't work in Python: >>> def a(): pass >>> def a(x): pass >>> a() Traceback (most recent call last): File "", line 1, in

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and it has its advantages: 1 docstri

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and i

Re: Pure virtual functions in Python?

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: I still prefer not to call at all, even if it was an empty function. Regards, Elias Is there any way we could convince you that there is no point caring about this ? Even if you were trying to optimize speed, it would still require proof that an empty function is part of th

Re: Walking lists

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: Thank you all for the replies. The solution using Python 3's syntax look very intuitive. Thanks Tim, Arnaud for the idea (I am using 2.x) -- Elias On Feb 25, 1:28 pm, lallous wrote: Hello I am still learning Python, and have a question, perhaps I can shorten the code: L =

Re: Get dosctring without import

2010-02-26 Thread Jean-Michel Pichavant
Joan Miller wrote: When a package is imported, it gets the dosctring to store it in *__doc__*. Does that funcion is built in python? because I would want use it to get the docstring without import a package Epydoc, a documentation builder is able to do so with the --parse-only option. You co

Re: Docstrings considered too complicated

2010-02-26 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Thu, 25 Feb 2010 12:51:00 -0800 (PST) John Roth wrote: On Feb 24, 1:23 pm, Andreas Waldenburger wrote: a company that works with my company writes a lot of of their code in Python (lucky jerks). I've seen their code and it basically looks like this: ""

<    10   11   12   13   14   15   16   17   18   19   >