Re: idiomatic way to collect and report multiple exceptions?

2010-05-10 Thread Jean-Michel Pichavant
Ben Cohen wrote: Apologies for the TABs -- I wrote that example for demonstration purposes in my mail client -- I'll copy and paste from a real code editor in the future. Ben There's nothing to apologies for. Be wary of those trying to get you out of the right path, they will lie to you st

Re: accessing superclass methods from subclass

2010-05-10 Thread Jean-Michel Pichavant
ben wrote: Ok, thanks for the info. What would be a better way to do this? What I'm trying to do is treat things in a reasonable OOP manner (all fairly new to me, esp. in Python). Here's a made-up example with a little more context. Let's say you're making a drawing program that can draw vari

Re: Kindly show me a better way to do it

2010-05-10 Thread Jean-Michel Pichavant
Oltmans wrote: On May 9, 1:53 am, superpollo wrote: add = lambda a,b: a+b for i in reduce(add,a): print i This is very neat. Thank you. Sounds like magic to me. Can you please explain how does that work? Many thanks again. shorter <> nicer IMO. Those alternatives are intere

Re: INCREF DECREF manually

2010-05-10 Thread Jean-Michel Pichavant
moerchendiser2k3 wrote: Hi, just a small question. Is it possible to change the refcount of a reference manually? For debugging / ... Thanks! moerchendiser2k3 Why don't you just create a global reference to the object ? Unless this one is removed, the object will be kept in memory. JM --

Re: unable to get Hudson to run unit tests

2010-05-10 Thread Jean-Michel Pichavant
j vickroy wrote: Stefan Behnel wrote: j vickroy, 07.05.2010 20:44: I apologize if this is not the appropriate forum for a question about Hudson (http://hudson-ci.org/), but I did not know where else to ask and my web searches have not been fruitful. Certainly nice to read something about Hu

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Jean-Michel Pichavant
Phlip wrote: On May 10, 1:51 pm, Phlip wrote: On May 10, 1:39 pm, Chris Rebert wrote: Sphinx is in vogue right now:http://sphinx.pocoo.org/ Okay, we have ten thousand classes to document. How to add them all to index.rst? I remember trying using Sphinx for auto documented

Re: how to import a module for global use in a library package ?

2010-05-11 Thread Jean-Michel Pichavant
Auré Gourrier wrote: [snip] My question is the following: I need to import an external package, say numpy, for use in various submodules. So far, I simply do an import numpy as _numpy where needed, say sub1module1 and sub2module2. This means that I import this package a number of times which d

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Jean-Michel Pichavant
Phlip wrote: On May 11, 3:54 am, Jean-Michel Pichavant wrote: I remember trying using Sphinx for auto documented APIs, but it was not suitable at that time. You can include API docs generated from the code, but you still need to write the docs around. If I'm correct, Sphinx is one o

Re: how to import a module for global use in a library package ?

2010-05-12 Thread Jean-Michel Pichavant
Terry Reedy wrote: On 5/11/2010 8:04 AM, Auré Gourrier wrote: I might make one submodule for imports and then do 'from rootlib.util import importmod as m' in the template. But I have no need now for such. Terry Jan Reedy We did that, and we so regret it. After 5 years of intensive dev on tha

Re: How to add callbacks that is the same function with different argument in Tkinter python26?

2010-05-12 Thread Jean-Michel Pichavant
chen zeguang wrote: code is in the end. I want to print different number when pressing different button. Yet the program outputs 8 no matter which button is pressed. I guess it's because the callback function is not established untill the button is pressed, and i has already reached to 8. then

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-12 Thread Michel Claveau - MVP
Hi! If you are under Vista, or Windows 7, have you unactivate UAC, before the update? @+ MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Discover PyH

2010-05-19 Thread Michel Claveau - MVP
Bonsoir ! La démarche me semble intéressante. Je testerai le module quand j'aurai un peu de temps. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: launching vi/vim from console

2010-05-24 Thread Jean-Michel Pichavant
adm wrote: I am newbie to python. Is there a way to launch vi/vim or any other editor from python console? I find editing in console very limiting. I can either have a console which launches vi and remembers it's content and then executes or invoke python interpreter from vim. Since I could not

Re: Email in 2.6.4

2010-05-24 Thread Jean-Michel Pichavant
dirknbr wrote: I am trying to run from email.mime.text import MIMEText but I get an ImportError: No module named mime.text Since email was pre-installed how do I fix this? Dirk Did you make sure you didn't hide the standard email module by one of your own. Check print email.__file__ /us

Re: Email in 2.6.4

2010-05-24 Thread Jean-Michel Pichavant
dirknbr wrote: I have now easy_installled email and I still get errors. It doesn't error on 'import email' but does on call to MimeText. import email msg = MIMEText('test') NameError: name 'MIMEText' is not defined What should I do? Using easy_install will not prevent the standard lib to b

Re: function that counts...

2010-05-24 Thread Jean-Michel Pichavant
Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n): """How many positive integers less than n hav

Re: Email in 2.6.4

2010-05-24 Thread Jean-Michel Pichavant
Dirk Nachbar wrote: Sorry guys, I had named my file email.py and hence the error. On 24 May 2010 15:22, Jean-Michel Pichavant <mailto:jeanmic...@sequans.com>> wrote: dirknbr wrote: I have now easy_installled email and I still get errors. It doesn't er

Re: function that counts...

2010-05-25 Thread Jean-Michel Pichavant
superpollo wrote: Jean-Michel Pichavant ha scritto: Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def pr

Re: if, continuation and indentation

2010-05-27 Thread Jean-Michel Pichavant
HH wrote: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. When I write an if statement with many conditions, I prefer to use a parenthesis around the whole block and get the implicit continuation, r

Re: if, continuation and indentation

2010-05-27 Thread Jean-Michel Pichavant
MRAB wrote: HH wrote: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. When I write an if statement with many conditions, I prefer to use a parenthesis around the whole block and get the implicit co

Re: if, continuation and indentation

2010-05-28 Thread Jean-Michel Pichavant
Jonathan Hartley wrote: On May 27, 1:57 pm, Jean-Michel Pichavant wrote: HH wrote: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. When I write an if statement with many conditions

Re: Problems with relative imports and pep 366

2010-06-01 Thread Jean-Michel Pichavant
Gabriele Lanaro wrote: I've yet asked this question on SO, I'll copy the contents: I have a "canonical file structure" like that (I'm giving sensible names to ease the reading): mainpack/ __main__.py __init__.py - helpers/ __init__.py path.py - network/ __init__.py

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Jean-Michel Pichavant
Michele Simionato wrote: I would like to announce to the world the first public release of plac: http://pypi.python.org/pypi/plac Plac is a wrapper over argparse and works in all versions of Python starting from Python 2.3 up to Python 3.1. With blatant immodesty, plac claims to be the easie

Re: How to run a python script with a configuration file at command line ?

2010-06-03 Thread Jean-Michel Pichavant
Andreas Jung wrote: optparse is your friend. -aj 2010/6/3 steph_awk > I have been searching for quite some times without success. I have a python script that needs to start from command line and it should have a config file to fill out the

Re: great

2010-06-04 Thread Jean-Michel Pichavant
joblack wrote: Great - it works. Thanks a lot. Thread of the week :) JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing DLL in win98

2010-06-07 Thread Jean-Michel Pichavant
Spyder42 wrote: On Fri, 04 Jun 2010 14:03:48 -0400, Terry Reedy wrote: On 6/4/2010 9:08 AM, Spyder42 wrote: On Fri, 04 Jun 2010 14:50:28 +0200, Christian Heimes Python 2.6 is not supported on Windows 98 and earlier. You need at least Windows 2000 with a recent service pack. C

Python + vim + spaces vs tab

2010-06-07 Thread Jean-Michel Pichavant
Hello, Does anyone knows a way to configure vim so it automatically select to correct expandtab value depending on the current buffer 'way of doing' ? I need to edit different files, some are using spaces, others tabs. Those belong to different projects, and changing all spaces to tabs is not

Re: optparse: best way

2010-06-08 Thread Jean-Michel Pichavant
hiral wrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option("-oexe', dest=exe_file...) parser.add_option("-otxt', dest=t

Re: assign class variable in __init__

2010-06-08 Thread Jean-Michel Pichavant
Peter Otten wrote: Jason Scheirer wrote: On Jun 8, 9:37 am, Peter Otten <__pete...@web.de> wrote: Ross Williamson wrote: Hi Everyone, Just a quick question - Is it possible to assign class variables in the __init__() - i.e. somthing like: def __init__(self,se

Re: optparse: best way

2010-06-09 Thread Jean-Michel Pichavant
hiral wrote: On Jun 8, 3:03 pm, Jean-Michel Pichavant wrote: hiralwrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' e

Re: Python + vim + spaces vs tab

2010-06-09 Thread Jean-Michel Pichavant
Robin Becker wrote: On 07/06/2010 22:18, Hans Mulder wrote: Jean-Michel Pichavant wrote: Hello, Does anyone knows a way to configure vim so it automatically select to correct expandtab value depending on the current buffer 'way of doing' ? I need to edit different files, some

Re: GUIs - A Modest Proposal

2010-06-09 Thread Jean-Michel Pichavant
ant wrote: Most of those don't use a GUI. But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? In the industry, most of the people knows how to use a comand line. In my company, 99% of the applications written in p

Re: if, continuation and indentation

2010-06-09 Thread Jean-Michel Pichavant
Pete Forman wrote: HH writes: > I have a question about best practices when it comes to line > wrapping/ continuation and indentation, specifically in the case of > an if statement. There are several good suggestions for formatting but no-one has mentioned rewriting the code. Use a boolean

Re: regarding the dimensions in gui

2010-06-10 Thread Jean-Michel Pichavant
Chris Rebert wrote: On Thu, Jun 10, 2010 at 1:27 AM, Andreas Waldenburger wrote: On Thu, 10 Jun 2010 08:37:21 +0100 Simon Brunning wrote: On 10 June 2010 08:19, Shashwat Anand wrote: And please stop using 'sir' for heaven's sake. Not least because list list isn't ma

Re: passing environment variable path to open command

2010-06-11 Thread Jean-Michel Pichavant
Mahmood Naderan wrote: Hi, I am new to python so my question may be very basic. Suppose I have a file (sc_1.sh) which the path to that file is in system path: SOMETHING=/home/mahmood/scripts Now I want to open that file with respect to the environment variable: import os env = os.g

Re: GUIs - A Modest Proposal

2010-06-11 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Thu, 10 Jun 2010 23:00:37 -0700 (PDT) rantingrick wrote: On Jun 11, 12:17 am, ant wrote: I like the points about backwards compatibility. Presumably that reason alone is enough to keep Tkinter in the standard library for a long while. I don't se

Re: Which is the best implementation of LISP family of languages for real world programming ?

2010-06-14 Thread Jean-Michel Pichavant
Andrew Philpot wrote: On 06/11/10 08:48, Elena wrote: On 10 Giu, 23:33, bolega wrote: I mean ordinary people, who may want to do things with their computers for scripting, tasks that python can do... Lisp is not for ordinary people, Python is. Python is for ordinary people. Lisp is for ext

Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-14 Thread Jean-Michel Pichavant
Nathan Rice wrote: I've been running into a problem lately where I have an architecture like so: Main class -> facade/configuration class -> low level logic class. The main class is what the user interacts with. The facade/config class is responsible for loading and managing the lower level cl

Re: pythonize this!

2010-06-15 Thread Jean-Michel Pichavant
superpollo wrote: superpollo ha scritto: Peter Otten ha scritto: superpollo wrote: goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) from itertools import cycle, izip sum

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Jean-Michel Pichavant
genkuro wrote: On Jun 15, 8:49 am, Mark Lawrence wrote: On 15/06/2010 16:35, genkuro wrote: Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__)

Re: Possible to make subprocess.Popen jobs run serially rather than in parallel?

2010-06-16 Thread Jean-Michel Pichavant
Chris Seberino wrote: On Jun 15, 2:03 pm, Stephen Hansen wrote: Just call "process.wait()" after you call process = subprocess.Popen(...) I may have not been clear. I *don't* want web app to block on Popen.wait. I *do* want the Popen process to run in the background which web app

Re: super() woes (n00b)

2010-06-18 Thread Jean-Michel Pichavant
Deadly Dirk wrote: I cannot get right the super() function: Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] on linux2 Type "copyright", "credits" or "license()" for more information. No Subprocess class P: def __init__(__class__,self): print("I

Re: variable variables

2010-06-18 Thread Jean-Michel Pichavant
someone wrote: On Jun 18, 12:49 pm, James Mills wrote: On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: I was looking for a "short way" to do it because I have a lot "some_object.attr.attr or some_object.other_attr.attr" in code. it looks like I cannot replace attr with just other vari

Re: super() woes (n00b)

2010-06-18 Thread Jean-Michel Pichavant
Deadly Dirk wrote: On Fri, 18 Jun 2010 11:19:56 +0200, Jean-Michel Pichavant wrote: Deadly Dirk wrote: I cannot get right the super() function: Python 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] on linux2 Type "copyright", "credits" or "licens

Re: constructing an object from another instance of the same class

2010-06-21 Thread Jean-Michel Pichavant
Christoph Groth wrote: Dear all, sometimes it is handy to have a function which can take as argument anything which can be converted into something, e.g. def foo(arg): arg = float(arg) # ... I would like to mimic this behavior of float for a user-defined type, e.g. def bar(arg):

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Jean-Michel Pichavant
Josef Tupag wrote: I've been programming (when I do program) mainly in Perl for the last 10 years or so. But I've been itching to learn a new language for a while now, and the two near the top of the list are Ruby and Python

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Jean-Michel Pichavant
Jerry Rocteur wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/22/2010 01:32 PM, Jerry Rocteur wrote: My input is NOT CSV, I used this format to try and make the question shorter. Although I could create a CSV file, I'd like to learn how to code a class to work the way I describ

Re: Should I Learn Python or Ruby next?

2010-06-23 Thread Jean-Michel Pichavant
rantingrick wrote: --- On Jun 22, 4:29 am, Jean-Michel Pichavant wrote: This is a python list, fully dedicated to our dutch semi God. So how can you even immagine that someone here will suggest you to go for rub... sorry I can't prononce this blasphemous name. --- ...After re

Problem PIL-1.1.7 & _imagingft

2010-06-24 Thread Michel Claveau - MVP
IL-1.1.6 all run OK. I found a solution: - install PIL-1.1.7, - then, copy these two files from PIL 1.1.6: _imaging.pyd & _imagingft.pyd But, is it a good way? Thanks -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract doc strings

2010-07-01 Thread Jean-Michel Pichavant
moerchendiser2k3 wrote: Hi all, when I have a PyCodeObject, is there any way to extract a doc string from the code? For instance the following script <---script> """ Hello World! """ def main(): pass main() I would like to get "Hello World!". Any chance? Thanks in advance!! Bye, moer

Re: Why are String Formatted Queries Considered So Magical?

2010-07-01 Thread Jean-Michel Pichavant
Stephen Hansen wrote: On 6/30/10 11:58 PM, Jorgen Grahn wrote: On Wed, 2010-06-30, Steven D'Aprano wrote: On Wed, 30 Jun 2010 14:14:38 +, Jorgen Grahn wrote: On Tue, 2010-06-29, Stephen Hansen wrote: There's nothing silly about it. It is an exaggeration though: but it does represent a g

Re: optphart (alpha2)

2010-07-01 Thread Jean-Michel Pichavant
Stephen Hansen wrote: On 6/28/10 11:50 PM, rantingrick wrote: You just don't get the point, do you? And just what *point* an i supposed to be "getting" Stephen? That you don't like my contribution? If thats your point then i very much "get" it. This garbage: "optphart is the nemisis of the

Re: [ANN] eric 5.0.0 released

2010-07-05 Thread Jean-Michel Pichavant
Detlev Offenbach wrote: Hi, I just uploaded eric 5.0.0. This is the first official release. It is available via the eric web site. http://eric-ide.python-projects.org/index.html What is it? --- eric5 is the Python3 variant of the well know eric4 Python IDE and is the first developme

Re: 'reload M' doesn't update 'from M inport *'

2010-07-09 Thread Jean-Michel Pichavant
Frederic Rentsch wrote: I develop in an IDLE window. Module M says 'from service import *'. Next I correct a mistake in function 'service.f'. Now 'service.f' works fine. I do 'reload (service); reload (M)'. The function 'M.f' still misbehaves. 'print inspect.getsource (service.f)' and 'print i

Re: Hello

2010-07-09 Thread Jean-Michel Pichavant
Dani Valverde wrote: Sorry, I forgot to mention that I am using Linux. In fact, my first test have been with gedit. Is there any way to directly run the Python code into the console? Cheers! Dani Bradley Hintze wrote: There are lots of great editors out there. It really depends on personal

Re: 'reload M' doesn't update 'from M inport *'

2010-07-12 Thread Jean-Michel Pichavant
Aahz wrote: In article , Jean-Michel Pichavant wrote: PS : You're misusing the del statement. It does not remove any object >from mmory, however, it removes the reference to it, the object is still in memory. They are very few cases where del is usefull in python, so try

Re: 'reload M' doesn't update 'from M inport *'

2010-07-12 Thread Jean-Michel Pichavant
Hi, Don't use reload, this is nothing but a trap, espacially if your using it to update your objects with the code you are writting. JM I've found "reload" very usable for development in IDLE. IDLE memorizes my input, and the variables I assign output to. If restart IDLE I lose it all

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: My complaint (an oddly enough the title of this thread!) concerns the fact that Python treats 0 as False and every integer above and below 0 as True. Which is another example of how *some* aspects of Python support bad coding styles. Yes, Python does support bad codi

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-12 Thread Jean-Michel Pichavant
rantingrick wrote: On Jul 11, 3:03 am, "Günther Dietrich" wrote: So, it is not a disadvantage that the functions you listed above are named in this way. In the contrary, it is an advantage, as it keeps newcomers from using stupid variable names. "int" for an Integer is stupid? "list"

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-13 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 12 Jul 2010 19:28:28 -0600, Ian Kelly wrote: On Mon, Jul 12, 2010 at 6:18 PM, Steven D'Aprano wrote: I prefere to explicitly write what I want to test: if myInt <> 0: I would argue against that. Why do you, the coder, care about the specific d

Re: Check if a command is valid

2010-07-13 Thread Jean-Michel Pichavant
Kenny Meyer wrote: Hello, I have to figure out if a string is callable on a Linux system. I'm actually doing this: def is_valid_command(command): retcode = 100 # initialize if command: retcode = subprocess.call(command, shell=True) if retcode is 0:

Re: Code generator and visitor pattern

2010-07-16 Thread Jean-Michel Pichavant
Karsten Wutzke wrote: Yes, typo, I meant strictly. Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten Stringly is the perfect combination of strictly and strongly. Nice one :) JM -- http://mail.python.org/mailman/listinfo/pytho

Re: Difference between import in script and from interpreter

2010-07-19 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 19 Jul 2010 00:53:56 -0400, Edward Diener wrote: In a python script a: from xxx.yyy.zzz import aaa fails with the message: "ImportError: No module named xxx.yyy.zzz" but from within the python interpreter the same line succeeds. What would be the causes of

Re: hasattr + __getattr__: I think this is Python bug

2010-07-20 Thread Jean-Michel Pichavant
dmitrey wrote: hi all, I have a class (FuncDesigner oofun) that has no attribute "size", but it is overloaded in __getattr__, so if someone invokes "myObject.size", it is generated (as another oofun) and connected to myObject as attribute. So, when I invoke in other code part "hasattr(myObject,

Re: hasattr + __getattr__: I think this is Python bug

2010-07-20 Thread Jean-Michel Pichavant
dmitrey wrote: On 20 июл, 15:00, Jean-Michel Pichavant wrote: dmitrey wrote: hi all, I have a class (FuncDesigner oofun) that has no attribute "size", but it is overloaded in __getattr__, so if someone invokes "myObject.size", it is generated (as another oof

Re: loading configuration files that are themselves python

2010-07-29 Thread Jean-Michel Pichavant
Ben Finney wrote: Lawrence D'Oliveiro writes: In message <7j8w5tylmw@rapun.sel.cam.ac.uk>, Matthew Vernon wrote: Is there a more idiomatic way of loading in a configuration file that's python code ... Is it really a good idea to have a configuration language that’s Turing

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-29 Thread Jean-Michel Pichavant
Robert Kern wrote: On 7/23/10 7:08 PM, Lawrence D'Oliveiro wrote: In message, Robert Kern wrote: There are also utilities for mounting ISOs directly without burning them to a physical disk. You need special utilities to do this?? On at least some versions of Windows, Yes. You need the

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-29 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Sun, 25 Jul 2010 13:58:00 +1200, Gregory Ewing wrote: Lacrima wrote: But what if SuperClass1 is from third party library? If it hasn't been designed for super(), then you can't use super() with it. super() only works when *every* class in the hierarc

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-29 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: [snip] super() is just as explicit as len(), or str.upper(). It says, explicitly, that it will call the method belonging to one or more superclass of the given class. Come on Steven, you're better than this :) . Everybody can accurately guess what len and upper are d

Re: stdout of external program.

2010-07-30 Thread Jean-Michel Pichavant
Paul Lemelle wrote: HELP! :) I am trying to output the following program's output to either a file or variable, how can this be done? # Writing the output to a standard argv argument #1/usr/bin/python import sys for arg in sys.argv: print arg #END Thanks, Paul Hi Paul, after reading

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: [snip] As someone already said in this list, the main problem with super is that it tends to refer to the superclass method while in fact it calls the next MRO method. Why do you think that

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Fri, 30 Jul 2010 19:37:29 +1200, Gregory Ewing wrote: Steven D'Aprano wrote: On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: > "mro" would have been the proper name for "super".

Re: Basic Information about Python

2010-07-30 Thread Jean-Michel Pichavant
Durga D wrote: Hi All, I am new to python based application developement. I am using Windows XP. 1. Can I create desktop application (just hello world program) with Python language like exe in VC++? yes http://www.py2exe.org/ 2. If First statement is Yes, Can I include this applicati

Re: Access stdout from external program.

2010-07-30 Thread Jean-Michel Pichavant
Paul Lemelle wrote: JM, Thanks for the response. I am trying to capture the stdout of a program from another program. Example, I want to launch the below program from a second python script then capture the first's program stdout to a file or variable. Is this possible? Thanks again, Paul

Re: Access stdout from external program.

2010-08-02 Thread Jean-Michel Pichavant
Paul Lemelle wrote: Hi JM, My last dumb question: When I try to run the below script as an executable, I get the following error: ptt...@ptttestvm:~$ ./argv.py 4 import: unable to open X server `/tmp/launch-c8feFG/org.x:0' @ import.c/ImportImageCommand/361. ./argv.py: line 8: syntax error n

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Jean-Michel Pichavant
Paul Rubin wrote: Michele Simionato writes: I am actually more radical than that. From http://www.artima.com/weblogs/viewpost.jsp?thread=237121: In this series I have argued that super is tricky; I think nobody can... When I look at that URL, I see a Java stack dump: java.lang.Runt

Re: namespaces, scoping and variables

2010-08-03 Thread Jean-Michel Pichavant
rantingrick wrote: On Aug 2, 3:12 pm, Chris Hare wrote: Also you should use 4 space indention and never use tabs. This is the accepted way. Then ask yourself why tabs are still in python 3. Nice troll by the way. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: simple (I hope!) problem

2010-08-03 Thread Jean-Michel Pichavant
samwyse wrote: I'm writing for the Google app engine and have stubbed my toe yet again on a simple obstacle. Non-trivial app engines programs require the import of several modules that aren't normally in my PYTHONPATH. I'd like to be able to test my code outside of the app engine framework. I'v

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been modified in such as way. (T

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue t

Re: Why is python not written in C++ ?

2010-08-04 Thread Jean-Michel Pichavant
Carl Banks wrote: On Aug 3, 7:07 pm, Paul Rubin wrote: Mozilla is fed up with C++ and seems to be working on its own language, called Rust: http://lambda-the-ultimate.org/node/4009 That looks much better than Go. It's like all the cool features of Go without the annoying polemics

Re: Global variables problem

2010-08-04 Thread Jean-Michel Pichavant
Navkirat Singh wrote: On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh > wrote: Hey guys, I am using a multiprocessing program, w

Re: A new syntax for writing tests

2010-08-05 Thread Jean-Michel Pichavant
Jonathan Fine wrote: Hi I just discovered today a new syntax for writing tests. The basic idea is to write a function that contains some statements, and run it via a decorator. I wonder if anyone had seen this pattern before, and how you feel about it. For myself, I quite like it. Let's

Re: simple (I hope!) problem

2010-08-05 Thread Jean-Michel Pichavant
samwyse wrote: On Aug 3, 1:20 am, Steven D'Aprano wrote: On Mon, 02 Aug 2010 17:19:46 -0700, samwyse wrote: Fortunately, I don't need the functionality of the object, I just want something that won't generate an error when I use it. So, what is the quickest way to to create such an ob

Re: subprocess escaping POpen?!

2010-08-05 Thread Jean-Michel Pichavant
Chris Withers wrote: Hi All, I have a script that does the following: from subprocess import Popen,PIPE,STDOUT def execute(command,cwd): return Popen( command, stderr=STDOUT, stdout=PIPE, universal_newlines=True, cwd=cwd, shell=True,

Re: subprocess escaping POpen?!

2010-08-05 Thread Jean-Michel Pichavant
Chris Withers wrote: Jean-Michel Pichavant wrote: You did not redirect stdin, so it is expected you can still read input from the console. Okay, so if I definitely wanted no input, what should I pass as the stdin parameter to the POpen constructor? You do want an input don't you ? &

Re: A new syntax for writing tests

2010-08-05 Thread Jean-Michel Pichavant
jfine wrote: On 5 Aug, 10:17, Jean-Michel Pichavant wrote: Jonathan Fine wrote: Hi I just discovered today anewsyntaxfor writing tests. The basic idea is to write a function that contains some statements, and run it via a decorator. I wonder if anyone had seen this pattern

Re: easy question on parsing python: "is not None"

2010-08-05 Thread Jean-Michel Pichavant
wheres pythonmonks wrote: How does "x is not None" make any sense? "not x is None" does make sense. I can only surmise that in this context (preceding is) "not" is not a unary right-associative operator, therefore: x is not None === IS_NOTEQ(X, None) Beside "not in" which seems to work simila

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Thu, 05 Aug 2010 12:07:53 -0400, wheres pythonmonks wrote: P.S. Sorry for the top-post -- is there a way to not do top posts from gmail? I haven't used usenet since tin. Er, surely you can just move the cursor before you start typing??? CTRL+END will b

Re: Python Script Cannot Write to Directory

2010-08-06 Thread Jean-Michel Pichavant
Lawrence D'Oliveiro wrote: In message <4c5a6d00$0$29614$426a3...@news.free.fr>, News123 wrote: The original question lacks necessary information That seems to be very common in this newsgroup. ... JM -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: "is not None"

2010-08-10 Thread Jean-Michel Pichavant
Ben Finney wrote: Peter Pearson writes: Hey, that's a cute example, but . . . what a trap! Is it possible to document the use-the-object-not-the-string requirement loudly enough that people won't get caught? Don't use strings for such values. The data isn't going to be used, so there

Re: Python "why" questions

2010-08-10 Thread Jean-Michel Pichavant
Ben Finney wrote: "D'Arcy J.M. Cain" writes: No. You are giving me math and logic but the subject was common sense. Common sense is often unhelpful, and in such cases the best way to teach something is to plainly contradict that common sense. Common sense, for example, would have t

Re: GUI automation tool (windows)

2010-08-11 Thread Jean-Michel Pichavant
Grant Edwards wrote: On 2010-08-11, Lawrence D'Oliveiro wrote: In message , Alex Barna wrote: On Aug 10, 10:05 am, Lawrence D'Oliveiro Can???t understand the point to it. ???GUI automation??? is a contradiction in terms, because a GUI is designed for use by humans to do man

Re: Access lotus notes using Python 2.5.1

2010-08-11 Thread Michel Claveau - MVP
Hi! In several cases, Notes is not registred as COM server. Depending of installation. @-salutations -- MCi -- http://mail.python.org/mailman/listinfo/python-list

Re: How to swallow traceback message

2010-08-11 Thread Jean-Michel Pichavant
Back9 wrote: Hi, I run my py app to display a file's contents, and it is normally very long. So I use it like below: python myapp.py input_file | more to see them step by step. But when I try to exit it, normally I use Ctrl+ C key to quit it. Problem is every time I do like it, it shows Traceb

Re: Confused: Newbie Function Calls

2010-08-11 Thread Jean-Michel Pichavant
fuglyducky wrote: I am a complete newbie to Python (and programming in general) and I have no idea what I'm missing. Below is a script that I am trying to work with and I cannot get it to work. When I call the final print function, nothing prints. However, if I print within the individual functio

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread Jean-Michel Pichavant
Baba wrote: level: beginner exercise: given that packs of McNuggets can only be bought in 6, 9 or 20 packs, write an exhaustive search to find the largest number of McNuggets that cannot be bought in exact quantity. exercise source: http://ocw.mit.edu/courses/electrical-engineering-and-computer

Re: __class__ of what

2010-08-12 Thread Jean-Michel Pichavant
Eric J. Van der Velden wrote: Hello, I have, class C: n=0 def __init__(s): __class__.n+=1 Should be class C: n = 0 def __init__(self): self.__class__.n+=1 C.n+=1 # equivalent to this line (I prefer this one, more readable, less refactor-

writing \feff at the begining of a file

2010-08-13 Thread Jean-Michel Pichavant
Hello python world, I'm trying to update the content of a $Microsoft$ VC2005 project files using a python application. Since those files are XML data, I assumed I could easily do that. My problem is that VC somehow thinks that the file is corrupted and update the file like the following: -

Re: Dump logging configuration

2010-08-16 Thread Jean-Michel Pichavant
Kxepal wrote: Hi all! Sorry for dumb question if it is - I'd tried to google it before but have found nothing. Is there any way to dump current logging configuration for future loading it via fileConfig/dictConfig? I may be wrong but I don't think so. JM -- http://mail.python.org/mailman/li

<    5   6   7   8   9   10   11   12   13   >