Re: (-1)**1000

2014-10-22 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > To: python-list@python.org > Sent: Wednesday, 22 October, 2014 10:27:34 AM > Subject: (-1)**1000 > > Hello > > If i am writing (-1)**1000 on a python program, will the > interpreter do (-1)*(-1)*...*(-1) or something clever ? > > In fact i have (-1)*

Re: extending class

2011-09-23 Thread Jean-Michel Pichavant
Andrea Crotti wrote: On 09/23/2011 10:31 AM, Peter Otten wrote: Inside __getattribute__() you ask for self.first_var which triggers another __getattribute__() call that once again trys to determine the first_var attribute before it returns... Try using __getattr__() instead which is only tri

Re: Advise on using logging.getLogger needed.

2011-10-03 Thread Jean-Michel Pichavant
Steven W. Orr wrote: I hope I don't sound like I'm ranting :-( I have created a module (called xlogging) which sets up logging the way I want it. I found out that if I set up my logger without a name, then it gets applied to every logger that is referenced by every module that ever gets imported

Re: A tuple in order to pass returned values ?

2011-10-06 Thread Jean-Michel Pichavant
faucheuse wrote: Hi, (new to python and first message here \o/) I was wondering something : when you do : return value1, value2, value3 It returns a tuple. So if I want to pass these value to a function, the function have to look like : def function(self,(value1, value2, value3)) #self because

Re: A tuple in order to pass returned values ?

2011-10-07 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: Jean-Michel Pichavant wrote: In a general manner, ppl will tend to use the minimum arguments required. However, do not pack values into tuple if they are not related. How would you return multiple values if not in a tuple? Tuples are *the* mechanis

Re: 1/2 evaluates to 0

2011-10-12 Thread Jean-Michel Pichavant
Laurent Claessens wrote: Hi all This is well known : >>> 1/2 0 This is because the division is an "integer division". My question is : how can I evaluate 1/2 to 0.5 ? Is there some non integer division operator ? Up to now I workarounded writing float(1)/2. Is there an other way ? My Zen

Re: Problem with inheritance

2011-10-21 Thread Jean-Michel Pichavant
Sverre wrote: I have to classes a and b class a(object): def __init__(self,x): self.x = x self.build() def build(self): return class b(a): def __init__(self,x): a.__init__(self,x) self.y = 0 # ??? def build(self): # do somethi

Re: logging: warn() methods and function to be deprecated.

2011-10-24 Thread Jean-Michel Pichavant
Vinay Sajip wrote: I think that is a real shame - it seems to be gratuitous breakage for almost zero benefit. That issue shows that Trac makes heavy use of .warn, I've use .warn almost exclusively for many years, and code.google.com shows it is used extensively in the wild. Ok

Re: Data acquisition

2011-10-25 Thread Jean-Michel Pichavant
spintronic wrote: Dear friends, I have a trouble with understanding the following. I have a very short script (shown below) which works fine if I "run" step by step (or line by line) in Python shell (type the first line/command -> press Enter, etc.). I can get all numbers (actually, there are no

Re: __init__ with multiple list values

2011-11-02 Thread Jean-Michel Pichavant
Gnarlodious wrote: Initializing a list of objects with one value: class Order: def __init__(self, ratio): self.ratio=ratio def __call__(self): return self.ratio ratio=[1, 2, 3, 4, 5] Orders=[Order(x) for x in ratio] But now I want to __init__ with 3 values: class Order: def __init__(s

Re: parsing text from "ethtool" command

2011-11-02 Thread Jean-Michel Pichavant
extraspecialbitter wrote: I'm still trying to write that seemingly simple Python script to print out network interfaces (as found in the "ifconfig -a" command) and their speed ("ethtool "). The idea is to loop for each interface and print out its speed. I'm looping correctly, but have some issu

Re: python-based downloader (youtube-dl) missing critical feature ...

2011-11-04 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Fri, 04 Nov 2011 11:48:02 +, lbrt chx _ gemale wrote: python-based youtube-dl ~ http://rg3.github.com/youtube-dl/ ~ is sorely missing a flag in order to indicate the maximum file length of the data feed it would download (well, unless, for some reason, it is

Re: logging: handle everything EXCEPT certain loggers

2011-11-07 Thread Jean-Michel Pichavant
Gábor Farkas wrote: hi, is there a way to setup log-handlers in a way that they log logs from every logger, exept certain ones? basically i want the handler to handle everything, except log-records that were generated by loggers from "something.*" can this be done? i tried to create filters, b

Re: Extracting elements over multiple lists?

2011-11-07 Thread Jean-Michel Pichavant
JoeM wrote: Thanks guys, I was just looking for a one line solution instead of a for loop if possible. Why do you consider [x.remove(x[0]) for x in [a,b,c]] cheating? It seems compact and elegant enough for me. Cheers This is a one liner, but since you asked something *pythonic*, John's

Re: Help catching error message

2011-11-08 Thread Jean-Michel Pichavant
Gnarlodious wrote: What I say is this: def SaveEvents(self,events): try: plistlib.writePlist(events, self.path+'/Data/Events.plist') # None if OK except IOError: return "IOError: [Errno 13] Apache can't write Events.plist file" Note that success returns"None" while failure ret

Re: Help catching error message

2011-11-08 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Gnarlodious wrote: What I say is this: def SaveEvents(self,events): try: plistlib.writePlist(events, self.path+'/Data/Events.plist') # None if OK except IOError: return "IOError: [Errno 13] Apache can't write Events.plist file

Re: Execute a command on remote machine in python

2011-11-15 Thread Jean-Michel Pichavant
Martin P. Hellwig wrote: On 11/15/11 12:04, Roark wrote: Hi, I am first time trying my hands on python scripting and would need some guidance from the experts on my problem. I want to execute a windows command within python script from a client machine on a remote target server, and would want

Re: suppressing import errors

2011-11-15 Thread Jean-Michel Pichavant
David Riley wrote: On Nov 15, 2011, at 12:35 PM, Andreea Babiuc wrote: On 15 November 2011 17:24, Chris Kaynor wrote: As with any Python code, you can wrap the import into a try: except block. try: import badModule except: pass # Or otherwise handle the exception - possibly importing

Re: Got some problems when using logging Filter

2011-11-16 Thread Jean-Michel Pichavant
sword wrote: The logging cookbook gives an Filter example, explainning how to add contextural info to log. I can't figure out how to filter log from it. Suppose I have 3 file, a.py, b.py and main.py #file: a.py import logging logger=logging.getLogger(__name__) def print_log(): logger.debug(

Re: Dynamically Generate Methods

2011-11-18 Thread Jean-Michel Pichavant
GZ wrote: Hi, I have a class Record and a list key_attrs that specifies the names of all attributes that correspond to a primary key. I can write a function like this to get the primary key: def get_key(instance_of_record): return tuple(instance_of_record.__dict__[k] for k in key_attrs) Ho

Re: Got some problems when using logging Filter

2011-11-21 Thread Jean-Michel Pichavant
sword wrote: On Nov 16, 7:40 pm, Jean-Michel Pichavant wrote: sword wrote: The logging cookbook gives an Filter example, explainning how to add contextural info to log. I can't figure out how to filter log from it. Suppose I have 3 file, a.py, b.py and main.py #file:

Re: Is there any way to unimport a library

2011-11-21 Thread Jean-Michel Pichavant
ported pass Using this code allows you to import your library only if all conditions are met, preventing you from rolling back in case of error. Jean-Michel -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any way to unimport a library

2011-11-21 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Gelonida N wrote: I wondered whether there is any way to un-import a library, such, that it's occupied memory and the related shared libraries are released. My usecase is following: success = False try: import lib1_version1 as lib1 import lib2_ver

Re: Automatic import of submodules

2011-11-25 Thread Jean-Michel Pichavant
Massi wrote: Hi everyone, in my project I have the following directory structure: plugins | -- wav_plug | -- __init__.py -- WavPlug.py -- mp3_plug | -- __init__.py -- Mp3Plug.py ... -- etc_plug | --

Re: Pragmatics of the standard is() function

2011-11-28 Thread Jean-Michel Pichavant
candide wrote: In which cases should we use the is() function ? The is() function compares identity of objects rather than values so I was wondering in which circumstances comparing identities of objects is really vital. Examining well reputated Python source code, I realize that is() functio

Re: Cursor.fetchall

2011-11-28 Thread Jean-Michel Pichavant
Jayron Soares wrote: Hi Felipe, I did, however I got this error: Traceback (most recent call last): File "/home/jayron/Downloads/grafos.py", line 48, in g, e = ministro_lei() File "/home/jayron/Downloads/grafos.py", line 34, in ministro_lei for i in G.degree(): TypeError: 'int' obj

Re: Proper way to delete/kill a logger?

2011-11-28 Thread Jean-Michel Pichavant
cassiope wrote: I've been trying to migrate some code to using the standard python logging classes/objects. And they seem quite capable of doing what I need them to do. Unfortunately there's a problem in my unit tests. It's fairly common to have to create quite a few entities in the course of a

Re: Cursor.fetchall

2011-11-28 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: PS : Try to code & document in English, it's much better especially when asking for help on this list, mixing spanish and english has few benefits since you may bother both spanish and english ppl :o) Actually it is english mixed with portuguese, s

Re: platform issues?

2011-12-01 Thread Jean-Michel Pichavant
Adrian Powell wrote: I'm new to python and I'm trying to get a twitter client running on a new machine but it keeps on failing. I tracked the problem down to an issue opening URLs and wrote this little test case: import urllib2 url = 'http://www.google.com/' opener = urllib2.build_opener() url

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Jean-Michel Pichavant
Roy Smith wrote: Consider the following django snippet. Song(id) raises DoesNotExist if the id is unknown. try: songs = [Song(id) for id in song_ids] except Song.DoesNotExist: print "unknown song id (%d)" % id Is id guaranteed to be in scope in the print statement? I

Re: Scope of variable inside list comprehensions?

2011-12-06 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 05 Dec 2011 19:57:15 +0100, Jean-Michel Pichavant wrote: The proper way to propagate information with exceptions is using the exception itself: try: songs = [Song(_id) for _id in song_ids] except Song.DoesNotExist, exc: print exc I&

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have been a,

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: string are iterable, considering this, the error is correct. Yes, I understand that the exception is correct. I'm not saying the exception should be changed, just that we hav

Re: Misleading error message of the day

2011-12-09 Thread Jean-Michel Pichavant
Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible otherwise. Which

Re: Overriding a global

2011-12-12 Thread Jean-Michel Pichavant
Roy Smith wrote: MRAB wrote: or use 'globals': def function(self): logger = globals()['logger'].getChild('function') logger.debug('stuff') logger.debug('other stuff') Ah-ha! That's precisely what I was looking for. Much appreciated. Using the sa

Re: Overriding a global

2011-12-13 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general. We have namespaces precisely so you don't need to care about making names globally unique. I don't

Re: Overriding a global

2011-12-13 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Tue, 13 Dec 2011 10:54:51 +0100, Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general.

Re: logging issues

2011-12-13 Thread Jean-Michel Pichavant
Andrea Crotti wrote: I think is simple but I can't get it to work as I wish. Suppose I have a big application, my idea is that the running script sets a global logging level and then all the imported modules would act consequently. In my codebase, however, unless I set the level for each of the

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Joshua Landau wrote: On 13 December 2011 13:30, Jean-Michel Pichavant mailto:jeanmic...@sequans.com>> wrote: writing x = 1 def spam(): x = 2 is in general a bad idea. That was my point. Why? I have a few (probably wrong) guesses. Because you expect it to be th

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Chris Angelico wrote: On Wed, Dec 14, 2011 at 9:14 PM, Jean-Michel Pichavant wrote: The problem makes little sense when using names like x or func1. Besides namespace issues, naming 2 *different objects* with the same meaningful name is usually a bad idea and points the fact that your names

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Wed, 14 Dec 2011 13:05:19 +0100, Jean-Michel Pichavant wrote: Bad ideas : i = 5 def spam(): for i,v in enumerate([1,2,3,4]): for i,v in enumerate(['a','b', 'c']): print i, v print i,v # bad surprise The b

Re: Property Abuse

2011-12-14 Thread Jean-Michel Pichavant
Ian Kelly wrote: On Wed, Dec 14, 2011 at 1:28 AM, Felipe O wrote: Hi All, I was wondering what everyone's thought process was regarding properties. Lately I find I've been binging on them and have classes with > 10 properties. While pylint doesn't complain (yet), it tends to be picky about k

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Joshua Landau wrote: [snip] Using currentLogger is just padding, in my opinion. *Every *value is "current". Not always. I try to keep names on the same object because that object is supposed to be named that way. I can change one of the object attribute, but the object named that way keep bein

Re: can a subclass method determine if called by superclass?

2012-01-05 Thread Jean-Michel Pichavant
Peter wrote: Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I may have approached the problem from the wrong viewpoint :-))

Re: can a subclass method determine if called by superclass?

2012-01-05 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Peter wrote: Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I may have approached the

Re: Calling a variable inside a function of another class

2012-01-10 Thread Jean-Michel Pichavant
Yigit Turgut wrote: class test(test1): def __init__(self, device): . . . def _something(self, x=1) self.dt = data if __name__ == "__main__": test.something.dt ??? I am trying to call a variable located in a function of a class from main but couldn't succeed

Re: your feedback to my first project please

2012-01-10 Thread Jean-Michel Pichavant
patr...@bierans.de wrote: Thanks for the feedback! I took the time reading and understanding it and to let it getting into my bones. And I also lost time on reading more of this freaky and interesting documentation and was testing a lot of different stuff with my enviroment. My current code can

Re: Two questions about logging

2012-01-12 Thread Jean-Michel Pichavant
Matthew Pounsett wrote: [snip] Second, I'm trying to get a handle on how libraries are meant to integrate with the applications that use them. The naming advice in the advanced tutorial is to use __name__ to name loggers, and to allow log messages to pass back up to the using application's logg

Re: Zealotry

2012-01-13 Thread Jean-Michel Pichavant
Ben Finney wrote: Steven D'Aprano writes: On Thu, 12 Jan 2012 18:50:13 -0800, alex23 wrote: Tamer Higazi wrote: So, instead of making yourself continuously headache for an outdated OS I advise [...] Please don't recommend people use another OS when they ask an expl

Re: copy on write

2012-01-13 Thread Jean-Michel Pichavant
Eduardo Suarez-Santana wrote: El 13/01/12 11:33, Eduardo Suarez-Santana escribió: I wonder whether this is normal behaviour. Even simpler: $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> r=

Re: Zealotry

2012-01-13 Thread Jean-Michel Pichavant
Chris Angelico wrote: On Fri, Jan 13, 2012 at 9:34 PM, Jean-Michel Pichavant wrote: Recommending an OS to solve one python package installation is zealotry. At least, advise to use a virtual machine software to try it out, there are some VM softwares for free working with windows. If

Re: First python project : Tuner

2012-01-17 Thread Jean-Michel Pichavant
Jérôme wrote: Hi all. Like others before me, I'd like to show you my first python attempt, in the hope in can get advices on how to improve my coding. I started learning python and pyGTK last november. I had had a short experience of GTK with C, but had given up as I lacked time and I found it

Re: verify the return value of a function

2012-01-20 Thread Jean-Michel Pichavant
Jabba Laci wrote: Hi, In a unit test, I want to verify that a function returns a cookielib.LWPCookieJar object. What is the correct way of doing that? 1) First I tried to figure out its type with type(return_value) but it is 2) return_value.__class__ .__name__ gives 'LWPCookieJar', which is b

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

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

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: 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: 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: 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-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: "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: 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: 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: 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: 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: 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-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: 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: 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: 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: 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-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: 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: 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: 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: 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: "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: 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: 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: 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: 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: 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: 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: 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: 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: 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: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 13:40:12 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway >> <[EMAIL PROTECTED]> wrote: >>> How about PyLint / PyChecker? Can I configure one of them to te

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