Re: A question about Python Classes

2011-04-21 Thread Jean-Michel Pichavant
chad wrote: Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call foo() when I never created an instance of BaseHandler? Cha

Re: A question about Python Classes

2011-04-22 Thread Jean-Michel Pichavant
MRAB wrote: On 21/04/2011 18:12, Pascal J. Bourguignon wrote: chad writes: Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHa

Re: Pairwise frequency count from an incidence matrix of group membership

2011-04-22 Thread Jean-Michel Pichavant
Shafique, M. (UNU-MERIT) wrote: Hi, I have a number of different groups g1, g2, … g100 in my data. Each group is comprised of a known but different set of members (m1, m2, …m1000) from the population. The data has been organized in an incidence matrix: g1 g2 g3 g4 g5 m1 1 1 1 0 1 m2 1 0 0 1 0

Re: sockets: bind to external interface

2011-04-26 Thread Jean-Michel Pichavant
Hans Georg Schaathun wrote: Is there a simple way to find the external interface and bind a socket to it, when the hostname returned by socket.gethostname() maps to localhost? What seems to be the standard ubuntu configuration lists the local hostname with 127.0.0.1 in /etc/hosts. (I checked th

Re: How to concatenate unicode strings ???

2011-04-26 Thread Jean-Michel Pichavant
Chris Rebert wrote: On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last): File "", line 1, in UnicodeDe

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Jean-Michel Pichavant
snorble wrote: I'm not a Pythonista, but I aspire to be. My current tools: Python, gvim, OS file system My current practices: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py, test2.py, etc., from random ideas I have tested), an

Re: Development tools and practices for Pythonistas

2011-04-27 Thread Jean-Michel Pichavant
Ben Finney wrote: Mercurial – are the ones to choose from. Anoyone recommending a VCS tool that has poor merging support (such as Subversion or, heaven help us, CVS) is doing the newcomer a disservice. True enough. But the modern crop of first-tier VCSen – Bazaar, Git, For a single user, there

Re: Development tools and practices for Pythonistas

2011-04-27 Thread Jean-Michel Pichavant
Chris Angelico wrote: On Wed, Apr 27, 2011 at 7:24 PM, Jean-Michel Pichavant wrote: For a single user, there would be no merge issue. And svn is very simple to use. That would not be a such bad advice for a beginner with VCS systems. As someone who for years had "nightly backup

Re: Development tools and practices for Pythonistas

2011-04-27 Thread Jean-Michel Pichavant
Anssi Saari wrote: Jean-Michel Pichavant writes: For a single user, there would be no merge issue. Really? What about a single user with many computers and environments? I find myself merging files on occasion because I edited them separately and forgot to check in changes before

Re: Need your help

2011-04-28 Thread Jean-Michel Pichavant
1011_wxy wrote: Hi friends: Here I need some help. #encoding="utf-8" #moudle a.py def a(): print " function a!" #encoding="utf-8" #moudle b.py def b(): print " function b!" #encoding="utf-8" #moudle c.py import a import b def c(): a.a() b.b() Here in function c,How ca

Re: 回复: Re: Need your help

2011-04-28 Thread Jean-Michel Pichavant
1011_wxy wrote: Hi JM: *python c.py > afile.log* could you pls give me the whole example? I am so sorry that I am a beginner in Python. Your module a and b that you cannot modify given your original description, are printing data using the print statement. That means these module only

Re: Read-write lock for Python

2011-04-28 Thread Jean-Michel Pichavant
Geoff Bache wrote: Hi all, I currently find myself needing a Python read-write lock. I note that there is none in the standard library, but googling "python read-write lock" quickly produced 6 different competing examples, including two languishing patch proposals for the standard library. I ca

Re: Composition instead of inheritance

2011-04-28 Thread Jean-Michel Pichavant
Ethan Furman wrote: For anybody interested in composition instead of multiple inheritance, I have posted this recipe on ActiveState (for python 2.6/7, not 3.x): http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/ Comments welcome! ~Ethan~ Sounds

Re: Composition instead of inheritance

2011-04-29 Thread Jean-Michel Pichavant
Ben Finney wrote: Ethan Furman writes: Carl Banks wrote: That's not what we mean by composition. Composition is when one object calls upon another object that it owns to implement some of its behavior. Often used to model a part/whole relationship, hence the name. Hmmm. Okay -

Re: HI

2011-05-02 Thread Jean-Michel Pichavant
anvar wrote: Hello, Could you please help me with the modeling in Python the following problem: (e.g., g_t means g with index t) Min∑_(i=1)^n▒∑_(t=1)^l▒[s_i (t)-min[s ̂_i (t)×α_t×exp(g_t ),C_i (t) ] ]^2 subject to s_i (t)=f_i (t)[S_i+f_(i-1) (t)[S_(i-1)+f_(i-2) (t)[S_(i-2)+⋯f_2 (t) [S_2+f_1 (t)

Re: ctypes and twain_32.dll

2011-05-02 Thread Michel Claveau - MVP
Hi! On my system, thera are not "twain32.dll" or "twain_32.dll", but "twain.dll" @+ -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: spf-records

2011-05-03 Thread Jean-Michel Pichavant
Wim Feijen wrote: Excuse me, this message was sent to the wrong mailing list. Sorry, Wim 2011/5/3 Wim Feijen mailto:w...@go2people.nl>> Dag mannen, You're lucky that the native language of our Benevolent Dictator For Life is tolerated in this list. JM -- http://mail.python.org/mailman

Re: Running and killing a process in python

2011-05-04 Thread Jean-Michel Pichavant
James Mills wrote: On Wed, May 4, 2011 at 10:45 AM, Astan Chee wrote: Hi, I'm trying to make a python script (in windows 7 x64 using python 2.5) to start a process, and kill it after x minutes/seconds and kill all the descendants of it. Whats the best way of doing this in python? which modul

Re: PIL: The _imaging C module is not installed

2011-05-05 Thread Michel Claveau - MVP
Hi! > you need to install the appropriate libraries, among which are: > libjpeg-devel > freetype-devel > libpng-devel OK, but where can I find it? I want use PIL with Python under Windows, and I can't compile C's sources. Should I replace PIL by ImageMagick? @-salutati

Re: PIL: The _imaging C module is not installed

2011-05-05 Thread Michel Claveau - MVP
Re! And why the problem no exist with PIL 1.1.6? (only 1.1.7) Is that the version 1.1.6 does not use these libraries? @+ -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Overuse of try/except/else?

2011-05-10 Thread Jean-Michel Pichavant
James Mills wrote: On Tue, May 10, 2011 at 10:40 AM, Kyle T. Jones wrote: It has been hard for me to determine what would constitute overuse. A rule of thumb I always follow and practice is: "Let the error lie where it occurred." or "Don't hide errors.". It's good practice to foll

Re: obviscating python code for distribution

2011-05-16 Thread Jean-Michel Pichavant
Littlefield, Tyler wrote: Hello: Thanks all for your information and ideas. I like the idea of open source; I have a fairly large (or large, by my standards anyway) project that I am working on that is open source. Here's kind of what I want to prevent. I want to write a multi-player online

Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Jean-Michel Pichavant
Cathy James wrote: f = open ('c:/testing.txt'', 'r') replace the double quote by a single quote. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Obtaining a full path name from file

2011-05-24 Thread Jean-Michel Pichavant
RVince wrote: Ha! You;re right -- but is there a way to get it without the filename appended at the end? On May 24, 11:52 am, Tim Golden wrote: On 24/05/2011 16:36, RVince wrote: s = "C:\AciiCsv\Gravity_Test_data\A.csv" f = open(s,"r") How do I obtain the full pathname given t

Re: Beginner needs advice

2011-05-25 Thread Jean-Michel Pichavant
Lew Schwartz wrote: So, if I read between the lines correctly, you recommend Python 3? Does the windows version install with a development environment? If you want to use python 3, make sure before that all the good stuff you need (==modules) have been ported to python 3. If you are a complet

Re: change volume of single audio device

2013-11-13 Thread Jean-Michel Pichavant
- Original Message - > hi, > > i'd like to change the volume of my av-receiver (HDMI) and speakers > (analogue) simultaneously. in order to use both outputs i'm using > virtual audio cable but if i set it as default device and change > volume, hdmi and analogue remains unchanged. > i inten

Re: understanding someone else's program

2013-11-15 Thread Jean-Michel Pichavant
- Original Message - > Hi all, > > Please suggest how I can understand someone else's program where > - documentation is sparse > - in function A, there will be calls to function B, C, D and in > those functions will be calls to functions R,S,T and so on so > forth... making it dif

Re: Having trouble setting up an extremely simple server...

2013-11-22 Thread Jean-Michel Pichavant
- Original Message - > Please help! I'm very > new to networking, but I've been using Python for a while now, just > recent;y getting into networking, trying to get things down. Hi, Nothing wrong with diving into the muddy waters of network programming. If you like blue lagoons like me, t

Re: Use of logging module to track TODOs

2013-11-27 Thread Jean-Michel Pichavant
- Original Message - > Hey list, Greetings ! > How do you do with your TODOs? > > Regards, > Jordi TODOs always share the same fate : they get forgotten and wander the code until the project dies. Unless you have the required mental resilience to stop the urgent work to fix your TO

Re: python for everyday tasks

2013-11-27 Thread Jean-Michel Pichavant
- Original Message - > On Saturday 23 November 2013 02:01:26 Steven D'Aprano wrote: > > * Python is not Java, and Java is not Python either: > > > > http://dirtsimple.org/2004/12/python-is-not-java.html > > http://dirtsimple.org/2004/12/java-is-not-python-either.html > > Thanks for all th

Re: [newbie] problem trying out simple non object oriented use of Tkinter

2013-12-06 Thread Jean-Michel Pichavant
- Original Message - > I'm trying out Tkinter with the (non object oriented) code fragment > below: > It works partially as I expected, but I thought that pressing "1" > would > cause the program to quit, however I get this message: > TypeError: quit() takes no arguments (1 given), I tried

Re: [newbie] problem trying out simple non object oriented use of Tkinter

2013-12-06 Thread Jean-Michel Pichavant
> I tried out your suggestions and discovered that I had the line > import sys to the program. So you can see below what I came up with. > It works but it's not all clear to me. Can you tell me what > "label.bind("<1>", quit)" is standing for? What's the <1> meaning? > > > > #!/usr/bin/env pytho

Re: Does Python optimize low-power functions?

2013-12-06 Thread Jean-Michel Pichavant
- Original Message - > The following two functions return the same result: > > x**2 > x*x > > But they may be computed in different ways. The first choice can > accommodate non-integer powers and so it would logically proceed by > taking a logarithm, multiplying by the power (in

Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Jean-Michel Pichavant
- Original Message - > I have an ethernet-rs232 adapter which allows me to connect to a > measurement instrument by means of netcat on a linux system. > e.g. entering nc 10.128.59.63 7000 > allows me to enter e.g. > *IDN? > after which I get an identification string of the measurement > ins

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
> > Such equipment often implements a telnet protocol. Have use try > > using the telnetlib module ? > > http://docs.python.org/2/library/telnetlib.html > > > > t = Telnet(host, port) > > t.write('*IDN?') > > print t.read_until('Whateverprompt') > > # you can use read_very_eager also > > > > JM > >

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
> Did you try > > import telnetlib > > ? > > Note that in the code above I forgot the EOF, which is very much > dependent of the equipment itself. > > You may have to write > t.write('*IDN?\n') > or > t.write('IDN?\n\r') > > JM Additionally, here's the code we're using for our signal generat

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
> Here is the code: > #!/usr/bin/env python > import telnetlib > host = '10.128.59.63' > port = 7000 > t = Telnet(host, port) > t.write('*IDN?\n') > print t.read_until('Whateverprompt') > # you can use read_very_eager also > > and this is the result of executing the code(from which I deduce I > ha

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
- Original Message - > Op maandag 16 december 2013 13:05:41 UTC+1 schreef Jean-Michel > Pichavant: > > > Here is the code: > > > #!/usr/bin/env python > > > import telnetlib > > > host = '10.128.59.63' > > > port = 7000 >

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
> This is what I got using telnet: > [jean:~] $ telnet 10.128.59.63 7000 > Trying 10.128.59.63... > Connected to 10.128.59.63. > Escape character is '^]'. > *IDN? > KEITHLEY INSTRUMENTS INC.,MODEL 2425,1078209,C32 Oct 4 2010 > 14:20:11/A02 /E/ >

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
- Original Message - > On Tue, Dec 17, 2013 at 5:26 AM, Jean Dubois > wrote: > >> Try something simple first: > >> import telnetlib > >> host = '10.128.59.63' > >> port = 7000 > >> t = Telnet(host, port) > >> def flush() > >> t.read_very_eager() > >> def sendCmd(cmd) > >> t.write('%s

Re: [newbie] trying socket as a replacement for nc

2013-12-17 Thread Jean-Michel Pichavant
> I'm a newbie in Python programming that is very much true, and > contrary to what you seem to suggest I did my homework At no point that was my intention, my apologies. If you fixed the syntax error, you should be pretty close to the solution though. JM -- IMPORTANT NOTICE: The contents of

Re: Logger module in python

2013-12-18 Thread Jean-Michel Pichavant
Original Message - > On Wednesday, December 18, 2013 8:52:11 AM UTC+5:30, > smileso...@gmail.com wrote: > > Hi, > > I am a newbie in python. I am looking for a existing module which > > I can import in my program to log the objects to a file? > > > I know there is a module Data::Dumpe

Re: Struggling for inspiration with lists

2013-12-18 Thread Jean-Michel Pichavant
- Original Message - > Hi > > I have a list of data that presents as: > > timestamp: value > > Timestamps are used solely to determine the sequence of items in the > list. > > I want to find the longest repeated sequence of values in the list. > Example, in the following list: > > data

Re: seeking a framework to automate router configurations

2013-12-18 Thread Jean-Michel Pichavant
- Original Message - > Hi Pythoners, > I'm looking for a tool or framework in which I can do a slight > modification to achieve the following task: > "Asynchronously reset a large number of cisco routers back to their > original configurations and push prepared initial configurations to

Re: How to import Wave files into python?

2013-12-18 Thread Jean-Michel Pichavant
- Original Message - > How exactly do I import a .wav file and run it? > also is it possible to run it inside a while loop if so or it just > start playing when its run? - Tom 14 > -- > https://mail.python.org/mailman/listinfo/python-list I think the pygame module should be able to do so.

Re: how to develop code using a mix of an existing python-program and console-commands

2013-12-23 Thread Jean-Michel Pichavant
- Original Message - > Am 18.12.13 21:17, schrieb Jean Dubois: > > I have a python-program which I want to perform its task first, > > then > > switch to > > the python console to experiment with further commands, using what > > was > > already > > defined in the python-program. > > Excell

Re: Variables in a loop, Newby question

2013-12-24 Thread Jean-Michel Pichavant
- Original Message - > Hello, for the first time I'm trying te create a little Python > program. (on a raspberri Pi) > > I don't understand the handling of variables in a loop with Python. > > > Lets say i want something like this. > > x = 1 > while x <> 10 > var x = x > x =

Re: word replacing in a paragraph

2014-01-06 Thread Jean-Michel Pichavant
- Original Message - > Hey guys, > I'm trying to automate a process by initially creating a standard > template and then replace some text fields with variable values. > [for example, "DATE" in the paragraph will be replaced by the current > date value. it doesn't have to be a literal

Re: nested dictionaries and functions in data structures.

2014-01-07 Thread Jean-Michel Pichavant
- Original Message - > Hello all. > > I have some questions again. :-) > > I wish to be able to place a function within a data structure. I > would like to use a dictionary because I could pass it a key and > then the function could be called. I couldn't find anything on the > net to s

Re: nested dictionaries and functions in data structures.

2014-01-07 Thread Jean-Michel Pichavant
- Original Message - > Thanks for that. It resolved the issue and it was so simple compared > to everything else I saw on the net. > > Only outstanding thing I have to work out is how to execute functions > from a dictionary. I will continue searching on the net. > > > Sean This may hel

Re: Editor for Python

2014-01-08 Thread Jean-Michel Pichavant
- Original Message - > On Friday, 23 November 2001 04:13:40 UTC+5:30, MANUEL FERNANDEZ PEREZ > wrote: > > Hello, > > I'm looking for an editor for Python.I' m interested it works on > > Windows.Can > > anybody help me? > > > > Thank you > > > > Manuel http://lmgtfy.com/?q=python+editor+

Re: Editor for Python

2014-01-08 Thread Jean-Michel Pichavant
- Original Message - > I've been pleased with Komodo, and certainly prefer it over > Notepad++. > Komodo: > http://www.activestate.com/komodo-ide?gclid=COHE4eLj7rsCFQISMwodOUQAiw Komodo is an IDE and costs 385$. I certainly expect it to better than notepad++. JM -- IMPORTANT NOTICE:

Re: Editor for Python

2014-01-08 Thread Jean-Michel Pichavant
> > -- IMPORTANT NOTICE: > > > > The contents of this email and any attachments are confidential and > > may > > also be privileged. If you are not the intended recipient, please > > notify > > the sender immediately and do not disclose the contents to any > > other > > person, use it for any purp

Re: Editor for Python

2014-01-09 Thread Jean-Michel Pichavant
- Original Message - > > On Jan 8, 2014, at 10:53 AM, Jean-Michel Pichavant > wrote: > > >>> -- IMPORTANT NOTICE: > >>> > >> > >> too late you have sent this to a public forum > > > > No pb with that, the python li

Re: a web UI to invoke a python script at server side

2014-01-14 Thread Jean-Michel Pichavant
- Original Message - > Hey guys, > I'm working on to provide a lightweight web UI for providing an > interface to invoke a python script(a sequential script which could > involve some system calls) at the server side. The UI should collect > some parameters for input into this python sc

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Jean-Michel Pichavant
- Original Message - > I would like to build an array of dictionaries. Most of the > dictionary example on the net are for single dictionary. > > dict = {'a':'a','b':'b','c':'c'} > dict2 = {'a':'a','b':'b','c':'c'} > dict3 = {'a':'a','b':'b','c':'c'} > > arr = (dict,dict2,dict3) > > What

Re: interactive help on the base object

2014-01-17 Thread Jean-Michel Pichavant
- Original Message - > On 17/01/2014 01:00, Terry Reedy wrote: > > On 12/6/2013 8:35 PM, Terry Reedy wrote: > >> On 12/6/2013 12:03 PM, Mark Lawrence wrote: > >>> Is it just me, or is this basically useless? > >>> > >>> >>> help(object) > >>> Help on class object in module builtins: > >>>

Re: Pyro4 - reading files

2014-01-29 Thread Jean-Michel Pichavant
- Original Message - > Hello there. > > I am currently working on a project involving the use of Pyro4. > > I have a scenario. > > We have the pc named A, and a pc named B. > > On pc B lies a python script, that includes pyro, and a method for > reading files. > > On pc A, we create an

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread Jean-Michel Pichavant
- Original Message - > generator slides review and Python doc > > > I do not know what tool is used to produce such > slides. > > When the mouse is over a a text like a title ( ... <\H*> ???) > the text get transformed and a colored eol is appearing. Used to get a link to the given chap

Using virtualenv to bypass sudoer issues

2014-02-06 Thread Jean-Michel Pichavant
Greetings, Assuming I have a debian workstation for which I don't have any sudo rights, i n order to be able to install / remove python packages, should I be using virtualenv ? Is it a suited solution ? JM -- IMPORTANT NOTICE: The contents of this email and any attachments are con

Re: Using virtualenv to bypass sudoer issues

2014-02-10 Thread Jean-Michel Pichavant
Thank you all for you insights. I'll probably go with virtualenv, I'll be able to distribute it among the team. There's still one point worrying me though: We're doing a lot a remote execution. We're using "execnet" http://codespeak.net/execnet/, and I'm not sure it can be compatible with virtua

Re: Using virtualenv to bypass sudoer issues

2014-02-10 Thread Jean-Michel Pichavant
> Call the venv version of python and activation is handled. > E.g. in a fabfile > > myenv/bin/python myscript.py > > -- > Pete Forman > -- > https://mail.python.org/mailman/listinfo/python-list wow, the solution is so nice and simple. JM -- IMPORTANT NOTICE: The contents of this emai

Re: Callback functions arguments

2014-10-27 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > To: python-list@python.org > Sent: Monday, 27 October, 2014 9:16:26 AM > Subject: Callback functions arguments > > Hi > > In this web site at example n°5 > http://fsincere.free.fr/isn/python/cours_python_tkinter.php > > A program is using the "Scale"

Re: Classes and the command line

2014-10-27 Thread Jean-Michel Pichavant
- Original Message - > From: "Seymore4Head" > To: python-list@python.org > Sent: Monday, 27 October, 2014 3:27:18 AM > Subject: Classes and the command line > > I am trying to learn classes. > I am currently using Python 2.7 at the command line. > If you try to type commands at the comman

Re: When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Jean-Michel Pichavant
- Original Message - > From: "Peter Otten" <__pete...@web.de> > To: python-list@python.org > Sent: Thursday, 30 October, 2014 1:45:42 PM > Subject: Re: When using a decorator exceptions raised reference the decorator > not the function > > Néstor Boscán wrote: > > > I'm using Python 2.7

Re: Classes

2014-11-03 Thread Jean-Michel Pichavant
- Original Message - > From: "Gregory Ewing" > Steven D'Aprano wrote: > > Like all good Pythonistas[1], we hate Java and think that > > getter/setter > > methods are pointless. But come on, they're not *wrong*, > > What's wrong is the statement that getters and setters > are necessary to

Re: generating unique variable name via loops

2014-11-04 Thread Jean-Michel Pichavant
- Original Message - > From: "Fatih Güven" > I have a structured and repetitive data. I want to read a .txt file > line by line and classified it to call easily. For example employee1 > has a name, a salary, shift, age etc. and employee2 and other 101 > employee have all of it. > > Call e

Re: Code review

2014-11-04 Thread Jean-Michel Pichavant
- Original Message - > From: "C Smith" > To: python-list@python.org > Sent: Tuesday, 4 November, 2014 4:28:33 PM > Subject: Code review > > I was wondering if I could get some feedback on the biggest thing I > have done as an amateur Python coder. The sidepots algorithm isn't > correct ye

Re: Code review

2014-11-05 Thread Jean-Michel Pichavant
- Original Message - > From: "C Smith" > I read that with 2.7 that I had to initialize class variables to > immutable types. I think because I was working with the lists before > they had been altered and were still empty lists. I will mess around > tomorrow with the classes you suggested

Re: Understanding "help" command description syntax - explanation needed

2014-11-05 Thread Jean-Michel Pichavant
Original Message - > From: "Ivan Evstegneev" > To: python-list@python.org > Sent: Wednesday, 5 November, 2014 12:00:16 PM > Subject: Understanding "help" command description syntax - explanation needed > So here is the question itself: > > If I use the help command to check the “range” c

Re: Most gratuitous comments

2014-12-04 Thread Jean-Michel Pichavant
- Original Message - > From: sohcahto...@gmail.com > I was trying to illustrate the point that some professors would > demand you write code like this... > > # increment the line count > lineCount += 1 > > # Check if line count is over 10 > if lineCount > 10 > # Tell the user there ar

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Jean-Michel Pichavant
- Original Message - > From: "Chris Angelico" > To: python-list@python.org > Sent: Wednesday, 3 December, 2014 12:02:17 PM > Subject: Style question: Importing modules from packages - 'from' vs 'as' > > When importing a module from a subpackage, it's sometimes convenient > to refer to it

Re: Can you use self in __str__

2014-12-04 Thread Jean-Michel Pichavant
- Original Message - > From: "Seymore4Head" > To: python-list@python.org > Sent: Friday, 28 November, 2014 4:31:50 AM > Subject: Re: Can you use self in __str__ > > On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel > wrote: > > class Hand: > def __init__(self): > self.hand = []

Re: Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

2014-12-08 Thread Jean-Michel Pichavant
- Original Message - > From: "Aahan Krish" > To: python-list@python.org > Sent: Monday, 8 December, 2014 3:15:43 AM > Subject: Maintaining Maximum Line Length When Using Tabs Instead of Spaces? > > My understanding from talking to different people is that many do use > tabs (instead of sp

Re: module import questions and question about pytest and module imports

2014-12-08 Thread Jean-Michel Pichavant
- Original Message - > From: "sam pendleton" > Having to put the garage package on the sys.path seems a little off, > why wouldn't relative imports work? > > Do most people somehow put their packages in sys.path when bundling > their python packages up to be shared with setuptools or othe

Re: [newbie] how to make program suggest to install missing modules

2014-12-08 Thread Jean-Michel Pichavant
- Original Message - > From: sohcahto...@gmail.com > try: > import someModule > except ImportError: > print "Module is missing" > # handle it! > > Just make sure to attempt to import it again after making the call to > pip to install it. Note that ImportError may be raised for

Re: serial data and web

2014-12-09 Thread Jean-Michel Pichavant
- Original Message - > From: "manduk" > > "A web page"? > > Did you mean a Web server? > not only upload in a folder of a webserver...I wish to see in real > time > the datas in a public html page. > I get the data from serial port and then I put them in a remote page. > Which is the best

Re: How to detect that a function argument is the default one

2014-12-10 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > I have the idea to write: > > def __init__(center=(0,0), radius=10, mass=None)): > > if mass == None: > self.mass = radius**2 > else: > self.mass = mass > > but maybe Python provides something clever. > > Thx If you like on

Re: How to detect that a function argument is the default one

2014-12-11 Thread Jean-Michel Pichavant
- Original Message - > From: "Chris Angelico" > > c1 = Circle((0,0), 10, None) > > print c1.mass > > 20 > > c1.radius = 20 > > print c1.mass > > 40 > > I think that juust might count as scope creep :) > ChrisA Here you go :p c1 = Circle((0,0), 10, None) print c1.mass 20 c1.gr

Re: How to detect that a function argument is the default one

2014-12-11 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > > > >> Note : what is the mass of a circle ? > > > > In fact it's a ball moving in a plan. > I will change that name. I would advise to remove the the mass parameter of your Sphere initialization. It could be inconsistent with the radius. To compute

problem with six.moves intern importError

2014-12-14 Thread jean-michel richer
le "/usr/local/lib/python2.7/dist-packages/pytools-2014.3.5-py2.7.egg/pytools/__init__.py", line 5, in from six.moves import range, zip, intern, input ImportError: cannot import name intern Is there a workaround or is it a bug ? Best regards, Jean-Michel -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie: installing setuptools

2014-12-19 Thread Jean-Michel Pichavant
- Original Message - > From: "Surbhi Gupta" > OK, the problem is now resolved: I just found out that we need to > install from prompt instead of IDLE. > Setuptools is installed, but I am not able to use easy_install from > prompt. It says: > easy_install : The term 'easy_install' is not re

Re: class-based class decorator

2015-01-12 Thread Jean-Michel Pichavant
- Original Message - > From: "Albert-Jan Roskam" > import functools > import inspect > import warnings > > warnings.simplefilter("always") > > class check_deprecated_args(object): > > def __init__(self, deprecated_params, msg=None): > self.deprecated_params = deprecated_para

Re: class-based class decorator

2015-01-13 Thread Jean-Michel Pichavant
- Original Message - > From: "Albert-Jan Roskam" > > From: Jean-Michel Pichavant > > I don't really understand how you successfuly manage positional > > parameters, > > since the caller may not name them. > > I'm asking because if

Re: Is there a more elegant way to spell this?

2015-01-27 Thread Jean-Michel Pichavant
- Original Message - > From: "Neal Becker" > To: python-list@python.org > Sent: Tuesday, 27 January, 2015 2:15:12 PM > Subject: Is there a more elegant way to spell this? > > Is there a more elegant way to spell this? > > for x in [_ for _ in seq if some_predicate]: You could use a gene

Re: How to Mock a mongodb

2015-02-09 Thread Jean-Michel Pichavant
- Original Message - > From: "Xavier Pegenaute" > To: python-list@python.org > Sent: Saturday, 7 February, 2015 11:09:10 PM > Subject: How to Mock a mongodb > > Dear, > > I am trying to mock the use of a mongo db and I am having some > trouble. > Appears that I am not able to return a de

Re: Functions help

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > On Feb 23, 2014, at 1:44 AM, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info > wrote: > > Sorry, I don't really understand your question. Could you show an > > example > > > of what you are doing? > > > Do you mean "add 5" or "*5"? "Add *5 doesn't really

Re: Problem with the console on the new python.org site

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote: > > > The new home page of python.org is very nice, congratulations ! > > The best I can say about it is that I'm extremely underwhelmed by the > design, which is far more "busy" and colourful than the old de

Re: Mac vs. Linux for Python Development

2014-02-24 Thread Jean-Michel Pichavant
- Original Message - > Hello, > > I'm sure this is a common question but I can't seem to find a > previous thread that addresses it. If one one exists, please point > me to it. > > I've been developing with python recreationally for a while on Ubuntu > but will soon be transitioning to

Re: Need help in writing some code so i can re-use it in every module or class

2014-02-26 Thread Jean-Michel Pichavant
- Original Message - > Hello Experts, > I have requirement, like i want to use below command in python > script. > --username --password arguments> > now my requirement is i want to write some class so i can re-use > " --username --password " part via > importing as module or clas

Re: How do we pass default argument value to create thread object?

2014-03-12 Thread Jean-Michel Pichavant
- Original Message - > Hi, > I am using Thread class to create threads. > > thread = threading.Thread(target=Fun, args=[arg1, arg2, arg3="val"]) > thread.start() > > This code is throwing compilation error(Ipython). > In [19]: import threading > In [20]: def Fun(agr1, arg2, arg3=No

Re: YADTR (Yet Another DateTime Rant)

2014-03-26 Thread Jean-Michel Pichavant
- Original Message - > One of my roles on this newsgroup is to periodically whine about > stupidities in the Python datetime module. This is one of those > times. > > I have some code which computes how long ago the sun set. Being a > nice > pythonista, I'm using a timedelta to represent

Re: pyflakes best practices?

2014-06-04 Thread Jean-Michel Pichavant
- Original Message - > We've recently started using pyflakes. The results seem to be > similar > to most tools of this genre. It found a few real problems. It > generated a lot of noise about things which weren't really wrong, but > were easy to fix (mostly, unused imports), and a few pl

Re: Mock pathc question

2013-08-07 Thread Jean-Michel Pichavant
- Mail original - > Hi > I would like to mock patch the attribute 'calc' in the 'Client' class > (See code below). > I have 2 unit tests: > 1) test1 - that patch an existing instance of 'Client' - it works > fine. > 1) test2 - that tries to patch the 'Client' class. My expectation is > th

Re: Mock pathc question

2013-08-08 Thread Jean-Michel Pichavant
- Mail original - > Hi > 1) I prefer to use start/stop and not the decorator . > 2) mock_play is the name of the module where the code belongs > Thanks > Avishay > Sent from my iPhone You should not neeed to refer to the Calc class using mock_play since it is defined in the very same

Re: refresing the edited python function

2013-08-20 Thread Jean-Michel Pichavant
- Original Message - > Hi, > I have been using ipython and ipython with qtconsole and working on a > code with functions. Each time I make a modification in function > I have to quit IPTHON console (in both with and with out qt console ) > and reload the function freshly. If I need to s

Re: How to execute command on remote windows machine

2013-09-03 Thread Jean-Michel Pichavant
- Original Message - > Hi alex > > I tried the command you suggested however it is giving me following > error. > > ERROR: The RPC server is unavailable. Hi, Please do not top post :) If python is installed on the remote machine, using execnet http://codespeak.net/execnet/ is very ea

Re: How to execute command on remote windows machine

2013-09-03 Thread Jean-Michel Pichavant
- Original Message - > I tried it, however it seems really complicated. > If you have used it before, can you show me how can i do it ? > Gaurang Shah > Blog: qtp-help.blogspot.com > Mobile: +91 738756556 Please don't ask question off-list. It's not complicated at all. The documenta

Re: Telnet to remote system and format output via web page

2013-09-11 Thread Jean-Michel Pichavant
- Original Message - > Hi > > > I would like to create a web app using flask or cgi library along > with telnetlib to telnet to specific servers and execute commands > and retrieve the output. > The output will then be formatted and outputted to a webpage . > > . Is this the best way

Re: Telnet to remote system and format output via web page

2013-09-13 Thread Jean-Michel Pichavant
- Original Message - > I would use something like fabric to automatically login to hosts via > ssh then parse the data myself to generate static HTML pages in a > document root. > > Having a web app execute remote commands on a server is so wrong in > many ways. Such as ? JM -- IMPORTA

<    1   2   3   4   5   6   7   8   9   10   >