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
> 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
> > 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-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: 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] 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: [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: 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: 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: 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: 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: 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: Organising packages/modules - importing functions from a common.py in a separate directory?

2013-10-29 Thread Jean-Michel Pichavant
- Original Message - > Hi, > > If I try to use: > > from .common.common_foo import setup_foo_logging > > I get: > > ValueError: Attempted relative import in non-package If you're using python 3, forget what I said about not using relative imports. I think they've implemented t

Re: Organising packages/modules - importing functions from a common.py in a separate directory?

2013-10-28 Thread Jean-Michel Pichavant
- Original Message - > Hi, > > I have a collection of Python scripts I'm using to load various bits > of data into a database. > > I'd like to move some of the common functions (e.g. to setup loggers, > reading in configuration etc.) into a common file, and import them > from there. > >

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

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: 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: 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: 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: 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: 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: Understanding other people's code

2013-07-16 Thread Jean-Michel Pichavant
- Original Message - > Thanks for all the suggestions, I'm afraid I didn't get a chance to > view them over the weekend but I will get started with them this > morning. I'm currently using sublime 2 for my text editor and tried > to create a UML diagram using Pylint to try and get a map ove

Re: Python - remote object protocols and security

2013-07-15 Thread Jean-Michel Pichavant
- Original Message - > On 15-7-2013 13:17, Dave Angel wrote: > > On 07/15/2013 06:20 AM, Jean-Michel Pichavant wrote: > >> In text format... sorry for my previous html post > >> > >> Hello everyone, > >> > >> I'd like to ex

Re: Python - remote object protocols and security

2013-07-15 Thread Jean-Michel Pichavant
- Original Message - > > What I think I need to care about, is malicious code injections. > > Because > > both client/server will be in python, would someone capable of > > executing > > code by changing one side python source ? > > > > How do I prevent this and still provide the source to

Re: Python - remote object protocols and security

2013-07-15 Thread Jean-Michel Pichavant
- Original Message - > > I don't mind encrypting data, if someone wants to sniff what I'm > > sending, he's welcome. > > > > I don't think the word you need there is "mind," but I get the idea. You're right, I wanted to state actually the opposite, I don't want to encrypt data because

Re: Python - remote object protocols and security

2013-07-15 Thread Jean-Michel Pichavant
In text format... sorry for my previous html post Hello everyone, I'd like to exchange some simple python objects over the internet. I initially planned to use Pyro, after reading http://pythonhosted.org/Pyro4/security.html I'm still puzzled. I don't mind encrypting data, if someone wants to

Python - remote object protocols and security

2013-07-15 Thread Jean-Michel Pichavant
Hello everyone, I'd like to exchange some simple python objects over the internet. I initially planned to use Pyro, after reading http://pythonhosted.org/Pyro4/security.html I'm still puzzled. I don't mind encrypting data, if someone wants to sniff what I'm sending, he's welcome. What I

Re: Debugging parallel nose tests?

2013-06-12 Thread Jean-Michel Pichavant
- Original Message - > In article , > Dave Angel wrote: > > > On 05/23/2013 09:09 AM, Roy Smith wrote: > > > > > > > > > > > > nosetests --process-timeout=60 --processes=40 test_api.py > > > > > > > Do you have a 40-processor system? > > No, but many of the tests are I/O bound.

Re: python 2.7 vs 2.5

2013-05-16 Thread Jean-Michel Pichavant
- Original Message - >I am using python 2.7 to write > the cgi file and my web server is using python 2.5. The answer lies in your question. JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the inten

Re: Unicode humor

2013-05-15 Thread Jean-Michel Pichavant
- Original Message - > On Wed, 15 May 2013 15:19:00 +0200 (CEST) > Jean-Michel Pichavant wrote: > > > British humour includes "double entendre", which is not > > > French-compliant. > > > > I didn't get that one. Which possibly confirm

Re: Unicode humor

2013-05-15 Thread Jean-Michel Pichavant
- Original Message - > On 15/05/2013 14:19, Jean-Michel Pichavant wrote: > >> >> >> This reflects a lack of understanding of Unicode. > >> >> > >> >> >> jmf > >> >> > >> >> > A

Re: Unicode humor

2013-05-15 Thread Jean-Michel Pichavant
> >> >> This reflects a lack of understanding of Unicode. > >> > >> >> jmf > >> > >> > And this reflects a lack of a sense of humor. :) > >> > >> Isn't that a crime in the UK? > >> > >> ChrisA > > > > The problem with English humour (as against standard humor) is that > > its not unicode compliant

Re: Python's sad, unimaginative Enum

2013-05-14 Thread Jean-Michel Pichavant
- Original Message - > On Mon, 13 May 2013 13:00:36 +0200, Jean-Michel Pichavant wrote: > > > - Original Message - > >> That's the title of this little beast > >> http://www.acooke.org/cute/Pythonssad0.html if anybody's > >&g

Re: global variable not working inside function. Increment

2013-05-13 Thread Jean-Michel Pichavant
> Thank You for setting that straight. I'm just learning Python and > NONE of the tutorials I read said anything about that . In fact they > all say a global can be called from inside a Function. If possible > please contact the ppl that write these things.I've heard of > Ocam's razor but not H

Re: Python's sad, unimaginative Enum

2013-05-13 Thread Jean-Michel Pichavant
- Original Message - > That's the title of this little beast > http://www.acooke.org/cute/Pythonssad0.html if anybody's interested. > > -- > If you're using GoogleCrap™ please read this > http://wiki.python.org/moin/GoogleGroupsPython. > > Mark Lawrence > > -- > http://mail.python.org/ma

Re: Efficient way of looging in python

2013-04-25 Thread Jean-Michel Pichavant
- Original Message - > Hi, > > I need an efficient way of logging using python. > My problem statemnt: > 1. I have multiple processes using the same logging file. > I need solutions to the following: > a) If multiple processes are trying to write to the same file, I need > to prevent that.

Re: CSV to matrix array

2013-04-12 Thread Jean-Michel Pichavant
- Original Message - > Hello! > > I have a CSV file with 20 rows and 12 columns and I need to store it > as a matrix. I already created an array with zeros, but I don't know > how to fill it with the data from the csv file. I have this script: > > import numpy > from numpy import array >

Re: mock django cache

2013-04-08 Thread Jean-Michel Pichavant
- Original Message - > In my settings.py , I have specified my cache as : > CACHES = { > 'default': { > .. > } > } > > In my views.py, I have > > import requests > from django.core.cache import cache, get_cache > > def aview(): > #check cache > if not get_ca

Re: python mock Requests and the response

2013-04-02 Thread Jean-Michel Pichavant
- Original Message - > I am a beginner to using mock in python and trying to use > http://www.voidspace.org.uk/python/mock. > > Please tell me the basic calls to get me working in below scenario. I > am using python's Requests module > (http://docs.python-requests.org/en/latest/) . > > In

Re: No errors displayed but i blank scren nstead.

2013-03-29 Thread Jean-Michel Pichavant
> I am trying my best with the little knowledge i have and i expect no > help from you. You are more inclinded to criticize that to actually > help. And if i pay someone that certainly not gonna be you. > > And i told you about gethostbyaddr, tht its not an issue its because > the script bein ru

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Jean-Michel Pichavant
- Original Message - > On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant > wrote: > > - Original Message - > > > notepad_1 = start("Notepad") > > > notepad_2 = start("Notepad") > > > notepad_1.wri

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Jean-Michel Pichavant
- Original Message - > notepad_1 = start("Notepad") > notepad_2 = start("Notepad") > notepad_1.write("Hello World!") > notepad_1.press(CTRL + 'a', CTRL + 'c') > notepad_2.press(CTRL + 'v') > > The problem with this design is that it effectively duplicates our

Re: Writing Python framework for declarative checks?

2013-03-19 Thread Jean-Michel Pichavant
- Original Message - > HI, > > NB: I've posted this question on Reddit as well (but didn't get many > responses from Pythonistas) - hope it's ok if I post here as well. > > We currently use a collection of custom Python scripts to validate > various things in our production environment/co

Re: What are some other way to rewrite this if block?

2013-03-18 Thread Jean-Michel Pichavant
- Original Message - > This simple script is about a public transport, here is the code: > > def report_status(should_be_on, came_on): > if should_be_on < 0.0 or should_be_on > 24.0 or came_on < 0.0 or > came_on > 24.0: > return 'time not in range' > elif should_be_on == ca

Re: "eval vs operator.methodcaller" - which is better?

2013-03-18 Thread Jean-Michel Pichavant
- Original Message - > Hi, > > I have a program that picks module and method name from a > configuration file and executes the method. I have found two ways to > achieve this. > > Apporach 1: > --- > moduleName = 'mymodule'#These two variables are read from con

Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Jean-Michel Pichavant
- Original Message - > On Sat, Mar 16, 2013 at 1:52 AM, Jean-Michel Pichavant > > couper is probably a french word, I've seen some of the OP's > > threads written in french. > > > > It means "cut". > > > > He probably want

Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Jean-Michel Pichavant
- Original Message - > > I dont usually bother about spelling/grammar etc. And I think it > silly > to do so on a python list. > > However with this question: > > On Mar 14, 5:16 pm, olsr.ka...@gmail.com wrote: > > how to couper all the obejcts in a canvas in an auther canvas? > > "obej

Re: editing a HTML file

2013-03-14 Thread Jean-Michel Pichavant
- Original Message - > Hi all, > > I'would like to make a script that automatically change some text in > a > html file. > > I need to make some changes in the text of tags > > My question is: there is a way to just "update/substitute" the text > in > the html tags or do i have to make

Re: Sphinx highlighting

2013-03-14 Thread Jean-Michel Pichavant
- Original Message - > What controls the yellow highlight bar that Sphinx sometimes puts in > the > documentation? > E.g.: > .. py:function:: basic_parseStrTest () > generates bold-face text, where > .. py:function:: basicParseStrTest () > generates text with a yellow bar highlight. > > I

Re: Store a variable permanently

2013-03-13 Thread Jean-Michel Pichavant
- Original Message - > On Tue, 12 Mar 2013 12:54:11 +0100, Jean-Michel Pichavant wrote: > > >> > import pickle > >> > a = 758 > >> > pickle.dump(a, open('test.pickle', 'w')) > >> > !cat test.pickle > >> &g

Re: Finding the Min for positive and negative in python 3.3 list

2013-03-12 Thread Jean-Michel Pichavant
- Original Message - > For example: > a=[-15,-30,-10,1,3,5] > I want to find a negative and a positive minimum. > example: negative > print(min(a)) = -30 > positive > print(min(a)) = 1 > -- > http://mail.python.org/mailman/listinfo/python-list min(a) and min([e for e in a if e >=0]

Re: Store a variable permanently

2013-03-12 Thread Jean-Michel Pichavant
- Original Message - > On Mon, 11 Mar 2013 11:19:49 +0100, Jean-Michel Pichavant wrote: > > [...] > > While your point about security is fair, the others aren't. Pickle > > uses > > by default an ascii representation of the data, it's readable and

Re: comment récupérer les valeurs de canvas dans python

2013-03-11 Thread Jean-Michel Pichavant
- Original Message - > comment récupérer la couleur d'un canvas ou id d'un canvas? > -- > http://mail.python.org/mailman/listinfo/python-list Hello, I'll take my chance : http://effbot.org/tkinterbook/canvas.htm JM PS : write in english, or frenglish like I do, something that has a c

Re: Advice regarding multiprocessing module

2013-03-11 Thread Jean-Michel Pichavant
- Original Message - > Dear all, > I need some advice regarding use of the multiprocessing module. > Following is the scenario: > * I am running gradient descent to estimate parameters of a pairwise > grid CRF (or a grid based graphical model). There are 106 data > points. Each data po

Re: Store a variable permanently

2013-03-11 Thread Jean-Michel Pichavant
- Original Message - > On Fri, 01 Mar 2013 11:19:22 +0100, Jean-Michel Pichavant wrote: > > > - Original Message - > >> So i have a variable called funds that i want to store the value > >> of > >> even after the program is exited.

Re: Do you feel bad because of the Python docs?

2013-03-01 Thread Jean-Michel Pichavant
[snip hostile replies] It's somehow funny to read such posts on a thread about someone complaining about the community python being hostile. I think we should really try to resist the urge of answering trolls because no matter how many times we slap them, they'll stay trolls and probably get eve

Re: Store a variable permanently

2013-03-01 Thread Jean-Michel Pichavant
- Original Message - > So i have a variable called funds that i want to store the value of > even after the program is exited. My funds variable holds the total > value of funds i have. I add a certain number of funds each time i > run the program by entering how much i want to add. How wou

Re: How would you do this?

2013-03-01 Thread Jean-Michel Pichavant
- Original Message - > How would you find the slope, y intercept, and slope-intercept form > equation for a line in python? > -- > http://mail.python.org/mailman/listinfo/python-list > See http://docs.scipy.org/doc/scipy/reference/interpolate.html -- IMPORTANT NOTICE: The contents o

Re: Project Based python tutorials

2013-02-28 Thread Jean-Michel Pichavant
- Original Message - > On Wednesday, February 27, 2013 2:31:11 AM UTC-6, Alvin Ghouas wrote: > > > So, I desided to start learning programming a few months > > ago and by now i feel pretty confident about the basics of > > the python language, and programming in general. > > Variables, l

Re: Nuitka now supports Python 3.2

2013-02-27 Thread Jean-Michel Pichavant
- Original Message - > On 02/26/2013 05:18 AM, Steven D'Aprano wrote: > > Nuitka now supports Python 3.2 syntax and compiles the full CPython > > 3.2 > > test suite. > > Interestingly, GvR seemed to be quite critical of it in his comment > at > the end of this post: > https://ep2013.europy

Re: "Daemonizing" an application.

2013-02-27 Thread Jean-Michel Pichavant
- Original Message - > Hello, > > Sorry for the obscure title, but I can't make short to explain what > I'm searching for. :) > > I made an app (kind of proxy) that works without UI within it's > process. So far, so good. > > Now I need to change "live" some controls of this application,

Re: Python Newbie

2013-02-26 Thread Jean-Michel Pichavant
- Original Message - > Hi guys, > > Question. Have this code > > intX = 32 # decl + init int var > intX_asString = None # decl + init with NULL string var > > intX_asString = intX.__str__ ()# convert int to string > > What are these ugly under

Re: Issues a longer xpath expression

2013-02-22 Thread Jean-Michel Pichavant
- Original Message - > I am having issues with the urllib and lxml.html modules. > Here is my original code: import urllib import lxml . html > down = 'http://v.163.com/special/visualizingdata/' file = urllib . > urlopen ( down ). read () root = lxml . html . document_fromstring ( > file

Re: Python Newbie

2013-02-22 Thread Jean-Michel Pichavant
- Original Message - > Hi Chris, > > Thanks for this. Regarding ambiguity, you will never find me write > ambiguous code. I don't sabotage my own work. But the reality is > that in addition to writing my own code, I have to maintain > existing. I find it incredibly confusing then I see a s

Re: subclassable types

2013-02-22 Thread Jean-Michel Pichavant
- Original Message - > Dear all, > I am wondering what the rules are that determine whether a built-in > type is > subclassable or not. > As examples, why can you base your classes on int or set, > but not on bool or range? > Also: can you use introspection to find out whether a type is val

Re: Making unhashable object

2013-02-19 Thread Jean-Michel Pichavant
- Original Message - > I am trying to define a class whose instances should not be hashable, > following: > http://docs.python.org/2/reference/datamodel.html#object.__hash__ > > class A: > def __init__(self,a): > self.value=a > __hash__=None > > > Then: > > >>> a=A(3

Re: Instances as dictionary key, __hash__ and __eq__

2013-02-19 Thread Jean-Michel Pichavant
> > Additionally, If I'm making things much more complicated than they > > need to be, let me know. > > You are. There are ways to achieve what you want, but it requires a > lot more setup and discipline. The simplest way is probably to have > a _equal_fields() method that subclasses override, r

Instances as dictionary key, __hash__ and __eq__

2013-02-18 Thread Jean-Michel Pichavant
Greetings, I opened something like a month ago a thread about hash functions and how I could write classes which instances can be safely used as dictionary keys. I though I had it but when I read back my code, I think I wrote yet another bug. Consider the following simple (buggy) class, python 2

Re: python mail box

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - > I want to display mail to django apps from my google accout. > and when the fetch all unread message,i want to replay them from my > apps so i need replay option also. > by point: > 1. First Fetch all unread mail from google account. > 2. If replay from apps it's repl

Re: Python trademark - A request for civility

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - > Folks, > > It seems that people have been sending threats and abuse to the > company > claiming a trademark on the name "Python". And somebody, somewhere, > may > have launched a DDOS attack on their website. > > The Python Software Foundation has asked the communit

Re: Python-list Digest, Vol 113, Issue 111

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - > Hi, I don't know if I should ask this on here, or in the tutor > section, but I heard that http://www.lighttable.com was an > innovative IDE, so I was wondering if it works for python since I'm > learning python over time. Thanks Hi, Please do not use html f

Re: Struggling with program

2013-02-18 Thread Jean-Michel Pichavant
> So your assignment is a bit misleading when it says a constructor is > not > required, because if you want to initialize some instance attributes, > it > has to be done in a method, usually the constructor, which in Python > is > __init__. By constructor, he may actually refer to the __new__ met

Re: Struggling with program

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - > I'm trying to do this assignment and it not working, I don't > understand why... > > This is what I have to do: > > Write the definition of a class Player containing: > An instance variable name of type String , initialized to the empty > String. > An instance va

Re: Logwatch python

2013-02-12 Thread Jean-Michel Pichavant
- Original Message - > In article <1de56e5b-4f9b-477d-a1d4-71e7222a2...@googlegroups.com>, > Cleuson Alves wrote: > > > Hello, I am trying to run this code, but I get an answer incorrect > > arguments > > numbers. someone could put an example of arguments for me to use in > > the / var

Re: LangWart: Method congestion from mutate multiplicty

2013-02-12 Thread Jean-Michel Pichavant
> Yeah, this is, pardon the french, just batshit crazy. huh ? :) JM -- 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 conten

Re: Logging within a class

2013-02-11 Thread Jean-Michel Pichavant
- Original Message - > Within __init__ I setup a log with self.log = > logging.getLogger('foo') then add a > console and filehandler which requires the formatting to be > specified. There a few > methods I setup a local log object by calling getChild against the > global log object. > > >

Re: Plotting syntax

2013-02-07 Thread Jean-Michel Pichavant
- Original Message - > Hi Python experts, > I am working with an array of data and am trying to plot several > columns of data which are not continuous; i.e. I would like to plot > columns 1:4 and 6:8, without plotting column 5. The syntax I am > currently using is: > oplot (t,d[:,0:4])

Re: How to improve writing code in python?

2013-02-06 Thread Jean-Michel Pichavant
- Original Message - > Hi, > I have a problem with learning Python. My code is really bad and I > can't solve many problems. I really want to improve it. Do you know > any website which helps me to learn python effectively (for > beginners)? This is my first programming language and I am s

Re: Best Practice Question

2013-02-06 Thread Jean-Michel Pichavant
- Original Message - > > [...] > > By the way, did someone ever notice that r'\' fails ? I'm sure > > there's a > > reason for that... (python 2.5) Anyone knows ? > > > > r'\' > > SyntaxError: EOL while scanning single-quoted string > > > > > "Even in a raw string, string quotes can be e

Re: Best Practice Question

2013-02-05 Thread Jean-Michel Pichavant
- Original Message - > On 02/04/2013 11:23 PM, Anthony Correia wrote: > > Just started learning Python. I just wrote a simple copy files > > script. I use Powershell now as my main scripting language but I > > wanted to extend into the linux platform as well. Is this the > > best way to

Re: Opinion on best practice...

2013-02-05 Thread Jean-Michel Pichavant
- Original Message - > I need to pick up a language that would cover the Linux platform. I > use Powershell for a scripting language on the Windows side of > things. Very simple copy files script. Is this the best way to do > it? > > import os > > objdir = ("C:\\temp2") > colDi

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Jean-Michel Pichavant
- Original Message - > why [os.path.join(r'E:\Python', name) for name in []] returns [] ? > please explain it in detail ! > -- > http://mail.python.org/mailman/listinfo/python-list > You're mapping an empty list. "for name in []" JM -- IMPORTANT NOTICE: The contents of this email an

Re: Reading data from 2 different files and writing to a single file

2013-01-28 Thread Jean-Michel Pichavant
- Original Message - > > - Original Message - > > > In the code below I am trying to read 2 files f1 and f2 , extract > > some data from them and then trying to write them into a single > > file > > that is 'nf'. > > [snip code] > > > I think my code is not so correct , as I am

Re: Understanding while...else...

2013-01-23 Thread Jean-Michel Pichavant
- Original Message - > Several people have trouble understanding Python's while-else and > for-else constructs. It is actually quite simple agreed on the last part. [snip long story] Did you just try to make it simple by showing the compiled code ? I'm quite not sure about that... JM

Re: Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
> The flaw would be key1 == key2 and hash(key1) != hash(key2). Then the > set/dict could store equal items multiple times in different places > (unless it did a linear search of all members, which would make > hashing > pointless!). > > -- > Terry Jan Reedy My understanding of a hash function was

Re: Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
> So I'm guessing you had a key where > > key1 == key2 did not imply hash(key1) == hash(key2) > > I don't see a way to avoid that problem in a look-before-you-leap > test. > > -- > http://mail.python.org/mailman/listinfo/python-list > You guessed right. But it took me a lot of time before ju

Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
Hello people, Is there any built-in way to know if an object is a valid dictionary key ? From what I know, the object must be hashable, and from the python doc, an object is hashable if it has the __hash__ and (__cmp__ or __eq__) methods. http://docs.python.org/2/glossary.html#term-hashable I

Re: PyWart: Module access syntax

2013-01-15 Thread Jean-Michel Pichavant
> > Please explain how this is a problem. As Steven said, there is NO > > > > useful difference. I don't *care* whether it's a package, a module, > > or > > > > whatever. Module with class with static member? Fine. Package with > > > > module with class? Also fine. Imported special object that u

Re: forking and avoiding zombies!

2012-12-11 Thread Jean-Michel Pichavant
- Original Message - > So I implemented a simple decorator to run a function in a forked > process, as below. > > It works well but the problem is that the childs end up as zombies on > one machine, while strangely > I can't reproduce the same on mine.. > > I know that this is not the per

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Jean-Michel Pichavant
- Original Message - > Thesaurus: A different way to call a dictionary. > > Thesaurus is a new a dictionary subclass which allows calling keys as > if they are class attributes and will search through nested objects > recursively when __getitem__ is called. > > You will notice that the

Re: A question about readability

2012-12-10 Thread Jean-Michel Pichavant
- Original Message - > On Dec 7, 6:46 pm, Marco wrote: > > Hi all, do you think this code: > > > > $ more myscript.py > > for line in open('data.txt'): > >      result = sum(int(data) for data in line.split(';')) > >      print(result) > > > > that sums the elements of the lines of this

Re: New tutorials

2012-12-06 Thread Jean-Michel Pichavant
- Original Message - > On 12/02/2012 09:54 AM, Mitya Sirenef wrote: > > Hi everyone, I'm making a series of python tutorials and I've just > > finished the introductory part: > > http://lightbird.net/larks/intro.html > > > > Feedback is appreciated.. - mitya > >

Re: Working with classes

2012-12-04 Thread Jean-Michel Pichavant
- Original Message - > Hello, I've been working on this program for a long time but can't > seem to get it to work.. The first array is the input file, then a > class, another class and the actual program. Could anyone see what > is wrong? I'm sorry if the program doesn't make any sense at

Re: New tutorials

2012-12-03 Thread Jean-Michel Pichavant
- Original Message - > Hi everyone, I'm making a series of python tutorials and I've just > finished the introductory part: http://lightbird.net/larks/intro.html > > Feedback is appreciated.. - mitya > > -- > http://mail.python.org/mailman/listinfo/p

Re: amazing scope?

2012-11-30 Thread Jean-Michel Pichavant
- Original Message - > Well I knew that this works fine, even if I feel a bit guilty to do > this, and better is: > > foo = 'bar' if some_condition else 'baz' > > Anyway for me the suprise is that something that is defined *later* > at > the module scope is found in a function which is de

Re: amazing scope?

2012-11-30 Thread Jean-Michel Pichavant
- Original Message - > 2012/11/30 andrea crotti : > > Already changing it to: > > def record_things(): > out.write("Hello world") > > def main(): > with open('output', 'w') as out: > record_things() > > if __name__ == '__main__': > main() > > makes it stops workin

Re: amazing scope?

2012-11-30 Thread Jean-Michel Pichavant
- Original Message - > I wrote a script, refactored it and then introducing a bug as below: > > def record_things(): > out.write("Hello world") > > if __name__ == '__main__': > with open('output', 'w') as out: > record_things() > > > but the shocking thing is that it did

Re: Python Interview Questions

2012-11-20 Thread Jean-Michel Pichavant
- Original Message - > Use a set when you want to represent a collection of items and the > order > is not important: An important feature of sets is that their items are unique. set(list(...)) is a good shortcut to remove duplicate in a list. JM -- IMPORTANT NOTICE: The contents of

Re: Python-list Digest, Vol 110, Issue 106

2012-11-15 Thread Jean-Michel Pichavant
- Original Message - > Hi, > I have a question about Django. I easy_installed Django1.4 and > psycopg2, and python manage.py syncdb. And gave me a error; No > module named psycopg2.extensions. posgre9.1 is installed. > It works fine on my MAC but not my Windows. Does anyone know about > t

Re: Passing functions as parameter (multiprocessing)

2012-11-13 Thread Jean-Michel Pichavant
- Original Message - > Oscar Benjamin wrote: > > > I don't know if this is to do with the way that the code was > > simplified before posting but this subproc function wrapper does > > nothing (even after Peter fixed it below). This code is needlessly > > complicated for what it does. > >

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