Update to Python 3 Cheat Sheet

2017-01-28 Thread Laurent Pointal
Hi, I updated the cheat sheet on the aesthetic side. Parts bloc and their title are now more easily identified with colors (but its nice with B&W printing too). French and german versions have also been updated. See https://perso.limsi.fr/pointal/python:memento A+ L.Pointal. -- https://mail.p

[ANN] German translation of Python 3 Cheat Sheet

2016-09-14 Thread Laurent Pointal
Hello, The Python 3 Sheet Cheat (Mémento Bases Python 3) has been translated into german by StR Martin Putzlocher. Thanks to him. It can be downloaded on the same page as english and french versions: https://perso.limsi.fr/pointal/python:memento A+ L.Pointal. -- https://mail.python.org/mailman

Re: logging: getLogger() or getLogger(__name__)?

2016-07-27 Thread Laurent Pointal
Malcolm Greene wrote: > I've read that best practice for logging is to place the following line > at the top of all modules: > > logger = getLogger(__name__) > > I'm curious why the following technique wouldn't be a better choice: > > logger = getLogger() > > Are there scenarios that favor

Re: an error

2016-07-19 Thread Laurent Pointal
en parenthesis, brackets, square brackets with missing close one. A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Touch screen development in Python

2016-07-13 Thread Laurent Pointal
a try, even on your mouse controlled interface. A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Touch screen development in Python

2016-07-11 Thread Laurent Pointal
Jahn wrote: > Hi , > Does anyone use Python for developping applications that work with a > touch screen? You should take a look at Kivy: https://kivy.org/ A+ L.Pointal. -- https://mail.python.org/mailman/listinfo/python-list

Re: What the deal with python3.5m.so and python3.5.so ??

2016-07-03 Thread Laurent Pointal
Steven Truppe wrote: > Hi all, > > can someone tell me the difference between python3.5m.so and python3.5.so > ?? The 'm' tagged version is for a Python compiled with PyMalloc: https://www.python.org/dev/peps/pep-3149/ (found it with Blender's bundled Python) > > Tanks in advance, > Steven T

Re: I need a pure python module from PyPI without additional packages on my OS.

2016-07-03 Thread Laurent Pointal
Seti Volkylany wrote: > I heard about cairo, but it required installed on my computer before. Some precision would be wellcome. Do you need any pure Python module from PyPI ? Do you need a "cairo compatible" pure Python module from PyPI ? A+ L.P. -- https://mail.python.org/mailman/listinfo/py

Re: Request for opinions: A cross language development tool

2016-06-23 Thread Laurent Pointal
Tal Zion wrote: > Bridge compiles Python modules into native code, What is "native", really microprocessor executable binary ? How do you adapt to diversity? > which requires us to > support Python *language* features (for, while, class, generators, etc) > but it reuses CPython's libraries (li

Re: A tough one: split on word length?

2016-05-16 Thread Laurent Pointal
00 (UTC) 584324 Fri 13 May 2016 13:44:40 -0400 584325 13 May 2016 17:45:25 GMT 584326 Fri 13 May 2016 13:47:28 -0400' >>> re.split("(\d{6})(.*?)", s) ['', '584323', '', ' Fri 13 May 2016 17:37:01 - (UTC) ', '584324', '&

Re: Performance with and without the garbage collector

2016-05-14 Thread Laurent Pointal
0)] >>> b = [a] >>> a.append(b) >>> del a# a remain referenced in b list >>> del b# b remain referenced in a list Now, how to test for performance impact… A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: After a year using Node.js, the prodigal son returns

2016-05-07 Thread Laurent Pointal
Brython (http://www.brython.info/) (ok, its translated into JavaScript for execution in the web browser… maybe somedays it will be asmsjs) A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: from a module return a class

2016-03-19 Thread Laurent Pointal
John Gordon wrote: > In > kevind0...@gmail.com writes: > >> ## prompt the user for a User name a& pWord >> user_pword = promptUser_PWord() > >> I get the error >> File "H:\dev\eclipse\workspace\genXls\src\genXls\promptUser_PWord.py", >> line 58 >> return user_pword >> SyntaxErr

Re: from a module return a class

2016-03-19 Thread Laurent Pointal
function). > The final line of promptUser_PWord become: user_pword = Unamepword(dbUser, pWord) def get_user_pword(): return user_pword and call get_user_pword() from within genXLS: user_pword = promptUser_PWord.get_user_pword() A+ Laurent > > Many thanks for your attention to this matter. > > KD -- https://mail.python.org/mailman/listinfo/python-list

Re: from a module return a class

2016-03-18 Thread Laurent Pointal
John Gordon wrote: > In <56eaecc8$0$3658$426a7...@news.free.fr> Laurent Pointal > writes: > >> >> user_pword = promptUser_PWord() >> > >> > Show us the complete definition of promptUser_PWord(). > >> AFAIU It looks to be the module…

Re: ouvrir python

2016-01-06 Thread Laurent Pointal
ande de poster sur > ce forum: > > http://www.developpez.net/forums/f96/autres-langages/python-zope/ > > Vincent Il y a un groupe francophone sur Usenet: fr.comp.lang.python There is a french Usenet group: fr.comp.lang.python A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: CGI

2015-12-27 Thread Laurent Delacroix
On 26/12/15 10:41, Pol Hallen wrote: > > How can I execute a local command (like ls or similar) and show output > via browser? > Either you use a proper web framework (Flask, Bottle, Django in order of complexity) or you set up a web server with FastCGI support (e.g. nginx) and run a WSGI appli

Re: Bug in Python 3.5.1

2015-12-24 Thread Laurent Pointal
n be installed via conda as indicated on this page - you may test under common student OS). A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't os.remove work on directories?

2015-12-24 Thread Laurent Delacroix
On 23/12/15 05:29, Random832 wrote: > > This is surprising to anyone accustomed to the POSIX C remove > function, which can remove either files or directories. Is there > any known rationale for this decision? > Hello, in POSIX C the remove() function is actually rmdir() when called on a direct

Re: [ANN] Python 3 Cheat Sheet v2.0

2015-10-31 Thread Laurent Pointal
Le Sat, 31 Oct 2015 12:16:08 +1100, Steven D'Aprano a écrit : > On Sat, 31 Oct 2015 06:56 am, Laurent Pointal wrote: >> https://perso.limsi.fr/pointal/python:memento > > > Very nice! Thank you! > > > Some small typos in the English version: Thanks for

Re: Idiosyncratic python

2015-09-24 Thread Laurent Pointal
wxjmfa...@gmail.com wrote: > Le jeudi 24 septembre 2015 08:02:38 UTC+2, Steven D'Aprano a écrit : >> >> >> What are your favorite not-wrong-just-weird Python moments? >> >> > Showing how to make Python 3.5.0 crash by > just using an "é", U+00E9. Like this ? Python 3.5.0 (default, Sep 24 201

Re: [ANN] Python TreeTagger wrapper updated to 2.2.1

2015-08-25 Thread Laurent Pointal
Laurent Pointal wrote: > It is available on PyPI: … incomplete URL… Here: https://pypi.python.org/pypi/treetaggerwrapper/ -- https://mail.python.org/mailman/listinfo/python-list

[ANN] Python TreeTagger wrapper updated to 2.2.1

2015-08-25 Thread Laurent Pointal
also added a treetaggerpoll module for use in a multiprocessing context. For important (and incompatible) modifications, see http://treetaggerwrapper.readthedocs.org/en/latest/#important-modifications-notes A+ Laurent Pointal -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if dictionary empty with == {}

2015-08-20 Thread Laurent Pointal
form 'if not mydict:' is AMA the more pythonic, but it may be a source of question for beginners (what is the boolean meaning of a dictionnary…). A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Regular expression and substitution, unexpected duplication

2015-08-19 Thread Laurent Pointal
MRAB wrote: > On 2015-08-18 22:42, Laurent Pointal wrote: >> Hello, >> ellipfind_re = re.compile(r"((?=\.\.\.)|…)", re.IGNORECASE|re.VERBOSE) >> ellipfind_re.sub(' ... ', >> "C'est un essai... avec différents caractères… pour

Regular expression and substitution, unexpected duplication

2015-08-18 Thread Laurent Pointal
... avec différents caractères ... pour voir." ^^^ I tested with/without group capture, same result. My Python version: Python 3.4.3 (default, Mar 26 2015, 22:03:40) [GCC 4.9.2] on linux Any idea ? Thanks. Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-09 Thread Laurent Pointal
random...@fastmail.us wrote: > On Sat, Aug 8, 2015, at 13:59, Laurent Pointal wrote: >> > Level? >> >> Graduate (post-Bac in france) > > Yours or your students? My students. > >> > 1. Are you >> > grade school (1=12)? >> >> (so

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-08 Thread Laurent Pointal
Terry Reedy wrote: > There have been discussions, such as today on Idle-sig , about who uses > Idle and who we should design it for. If you use Idle in any way, or > know of or teach classes using Idle, please answer as many of the > questions below as you are willing, and as are appropriate I t

Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ?

2015-07-12 Thread Laurent Pointal
ng a r to disable escape sequences: r"C:\Beautiful Soup\ecologicalpyramid.html" A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to import numpy

2015-07-07 Thread Laurent Pointal
sourceforge.net/projects/numpy/files/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python2.7.exe/download And install it with the installer. A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug in floating point multiplication

2015-07-02 Thread Laurent Pointal
= 0.9999 >>> for i in range(1, 100): ... if int(i*x) == i: ... print(i); break ... >>> A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: HOPE: A Python just-in-time compiler for astrophysical computations

2015-06-23 Thread Laurent Pointal
an ? https://github.com/serge-sans-paille/pythran For heavy computing, you may loose some time before running computation, to have (generate) the right tool, then do the job with real bonus. … A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: PYTHON QUESTION

2015-06-14 Thread Laurent Pointal
adebayo.abra...@gmail.com wrote his student exercise as raw text: > Help with this problem! > > Temperature converter > Description > > Write two functions that will convert temperatures back and forth from the > Celsius and Fahrenheit temperature scales. The formulas for making the > conversion

Re: should "self" be changed?

2015-05-26 Thread Laurent Pointal
> itch that couldn't be scratched. «Explicit is better than implicit» I think that googling for that idea you will find other people already proposing it (I've seen propositions to directly remove part before the dot like this: .dummy = None). Just read it. > Anyone else have any

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-18 Thread Laurent Pointal
Aditya Raj Bhatt wrote: > On Wednesday, March 18, 2015 at 1:04:39 PM UTC-5, Laurent Pointal wrote: >> > Can someone also provide a sort of a 'guide' to triple-quoted > comments >> > in general? >> >> A triple ' or " string is a Python st

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-18 Thread Laurent Pointal
Laurent Pointal wrote: (oups) > Take care of indent: > > def f(x): > a = 5 > """an correctly indented expression to be > inside the function""" > return a * x Here only the first indent of """ at beginning of

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-18 Thread Laurent Pointal
with no stored result (ie. no assignment to a name), and this is how are used triple quoted strings as comments. a = 5 """a comment""" Take care of indent: def f(x): a = 5 """an correctly indented expression to be inside the function""" return a * x A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

[Annonce] Une introduction à Python 3 - nouvelle version

2015-01-18 Thread Laurent Pointal
[updated book in french] Bonjour, L'ouvrage d'introduction à la programmation avec Python3 de B.Cordeau et L.Pointal a été mis à jour en version 1.618. Outre des améliorations dans la mise en page, les modifications suivantes ont été réalisées: * Tous les dessins ont été refaits en utilisant l

Re: Help understanding list operatoins inside functions in python 3

2015-01-13 Thread Laurent Pointal
d for your problem, its the same with Python2 and Python3) Or… A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: dynamic values in yaml

2014-08-20 Thread Laurent Pointal
raphi...@gmail.com wrote: > Note that in my example the content to be inserted is not the result of a > variable substitution, but the result of a call to a function. format > doesn't seem to work in this case. And jinja2 doesn't seem to provide a > straight forward solution either > > Thx Yoy

Re: dynamic values in yaml

2014-08-19 Thread Laurent Pointal
raphi...@gmail.com wrote: > Hi, > > I'm using pyyaml, and need some values in a yaml files to be dynamic, for > example somethin like: > > filename: /tmp/backup_{% time.strftime('%Y-%m-%d') }.tgz > > Is there a simple way to achieve this? (Eg with a templating system that > would first hand

Re: Begginer in python trying to load a .dll

2014-08-19 Thread Laurent Pointal
c1234 py wrote: > This appear in the terminal: > > runfile('C://Python Scripts') > File "C:\\sitecustomize.py", line 585, in runfile > execfile(filename, namespace) > File "C://Sin título 38.py", line 19, in > hllApi = hllApiProto (("HLLAPI", hllDll), hllApiParams) > AttributeE

Re: Python in financial services

2014-08-19 Thread Laurent Pointal
re information. >>> print("€"*10) €€ >>> With IDLE and Python 2.7, there seem to be an encoding problem: >>> s = u"€"*10 >>> >>> import sys >>> sys.stdout.encoding 'utf-8' >>> print s.encode(&q

protect psycopg script from sql injection?

2014-06-25 Thread celati Laurent
Hello, I coded this following python script via psycopg; web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? 2/ Could you tell me how to protect this script from SQL injections please?

RE: Controlling buffer alignment in file.read()

2014-03-22 Thread Laurent Pointal
ffered) ? Eventually going to os.open() which map tp low level (eventually followed by an os.fdopen()) http://docs.python.org/2/library/os.html#os.open A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-22 Thread Laurent Pointal
tandalone C++. https://github.com/serge-sans-paille/pythran A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: decimal numbers

2014-02-15 Thread Laurent Pointal
dividing by floating point numbers, like res2 = res / 1000. Note: should take a lok at the log10() function from math module. (with Python3) In [1]: from math import log10 In [2]: r = 132828378723 In [3]: int(log10(r)) Out[3]: 11 In [4]: r / 10**int(log10(r)) Out[4]: 1.32828378723 A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list

Re: run command line on Windows without showing DOS console window

2013-11-20 Thread Laurent Pointal
-nd http://example.com/packages/ >> >> the path to wget is C:\Program Files\GnuWin32\bin\wget.exe >> > > subprocess.call(["wget", "-r", "-np", "-nd", "http://example.com";]) Complement: use .pyw extension for

Re: understanding someone else's program

2013-11-18 Thread Laurent Pointal
gt; making it difficult to trace what happens to a certain variable > > Am using ERIC4 IDE. To help for documentation, you may test pycallgraph, eventually depgraph if there are multiple modules. http://pycallgraph.slowchop.com/en/master/ http://www.tarind.com/depgraph.html A+ Laurent. --

Re: Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-10 Thread Laurent Pointal
piler tool. See discussions and links in http://stackoverflow.com/questions/9353444/how-to-use-install-gcc-on-mac-os-x-10-8-xcode-4-4 There may be other solutions, but you should prefer ask in a specific MacOS usenet group. A+ > > Thanks for any advice you may have. -- Laurent POIN

Re: Aide pour bien démarrer en Python

2013-09-29 Thread Laurent Pointal
tion qui > pourrait répondre à mes intérogations ? http://w2.syronex.com/jmr/python-paradox http://dirtsimple.org/2004/12/python-is-not-java.html Et deux textes dont on a l'impression qu'ils résultent d'un traducteur automatique: http://fr.softuses.com/231303 http://fr.softuses.com/1

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Laurent Pointal
> each error. (Before "integrated" development environments) This is a + for compiled environments that you effectively cannot have with Python, non-syntaxic errors found at runtime. A+ Laurent. -- Laurent POINTAL - laurent.poin...@laposte.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a text over an image

2012-11-07 Thread Laurent Pointal
photo on top of his name and room number). http://www.reportlab.com/software/opensource/ Once created the pdf, you must find a solution to send it to the printer... > > Thanks in advance, > > Martha A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list

Re: argparse limitations

2012-07-31 Thread Benoist Laurent
rks that way. I'll do this way. Thank a lot. Ben Le Jul 31, 2012 à 3:04 PM, Oscar Benjamin a écrit : > > > On 31 July 2012 13:51, Benoist Laurent wrote: > > Le Jul 31, 2012 à 1:45 PM, Oscar Benjamin a écrit : > >> >> >> On 31 July 2012 12:03, Benoist L

Re: argparse limitations

2012-07-31 Thread Benoist Laurent
Le Jul 31, 2012 à 1:45 PM, Oscar Benjamin a écrit : > > > On 31 July 2012 12:03, Benoist Laurent wrote: > Finally. > > The code I proposed doesn't work in this case: if you add any positional > argument to one of the subparsers, then the parsing doesn't work

Re: argparse limitations

2012-07-31 Thread Benoist Laurent
d choice: '10' (choose from 'foo', 'bar') Any solution? Cheers, Ben Le Jul 31, 2012 à 12:37 PM, Benoist Laurent a écrit : > Really sorry about that. > > So, for the community, below is the full code for a tool that behaves like a > Unix standard tool

Re: argparse limitations

2012-07-31 Thread Benoist Laurent
else: for fname in args.fname: with(open(fname, "rt")) as f: content = f.read() # do somet Benoist Le Jul 31, 2012 à 11:55 AM, Oscar Benjamin a écrit : > > On Jul 31, 2012 10:32 AM, "Benoist Laurent" wrote: &

Re: argparse limitations

2012-07-31 Thread Benoist Laurent
2 bar.txt:42 $ cat foo.txt | grep 42 42 $ grep -c 42 foo.txt 1 Cheers, Ben Le Jul 27, 2012 à 7:08 PM, Benoist Laurent a écrit : > > > Yes basically looks like you get it. > I have to further test it but my first impression is that it's correct. > > So actually t

Re: argparse limitations

2012-07-27 Thread Benoist Laurent
Yes basically looks like you get it. I have to further test it but my first impression is that it's correct. So actually the point was to use nargs="?". Thank you very much. Ben Le Jul 27, 2012 à 5:44 PM, Peter Otten a écrit : > Benoist Laurent wrote: > >> I&#x

Re: argparse limitations

2012-07-27 Thread Benoist Laurent
Le Jul 27, 2012 à 4:43 PM, Oscar Benjamin a écrit : > > > On 27 July 2012 15:26, Benoist Laurent wrote: > Hi, > > I'm impletting a tool in Python. > I'd like this tool to behave like a standard unix tool, as grep for exemple. > I chose to use the argparse mo

argparse limitations

2012-07-27 Thread Benoist Laurent
Hi, I'm impletting a tool in Python. I'd like this tool to behave like a standard unix tool, as grep for exemple. I chose to use the argparse module to parse the command line and I think I'm getting into several limitations of this module. > First Question. How can I configure the the ArgumentPa

Re: how can I implement "cd" like shell in Python?

2012-06-28 Thread Laurent Pointal
> > plus you could add some error-handling code. To have a shell / python script interaction for cwd management, you can take a look at autojump https://github.com/joelthelion/autojump/wiki Its a Python script + different shells glue. A+ Laurent. -- Laurent POINTAL - laurent

Re: use Python to post image to Facebook

2012-06-24 Thread Laurent Pointal
ould appreciate it ever so much, Dave:) Note: if you develop such a tool, make it a "Web Out Of Browser" module. http://weboob.org/ -- Laurent POINTAL - laurent.poin...@laposte.net -- http://mail.python.org/mailman/listinfo/python-list

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Laurent Pointal
Ulrich Eckhardt wrote: > Am 05.06.2012 19:32, schrieb Laurent Pointal: >> I started a first translation of my document originally in french. Could >> some fluent english people read it and indicate errors or bad english >> expressions. > > Just one note up front: Lan

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Laurent Pointal
Paul Rubin wrote: > Laurent Pointal writes: >>> There are a few other things like that, and I'll try to look more >>> carefully tonight, I can't spend more time on it right now. >> I updated the document into 1.0.5a (and fix some other errors). > > A f

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-05 Thread Laurent Pointal
Paul Rubin wrote: > Laurent Pointal writes: >> I started a first translation of my document originally in french. Could >> some fluent english people read it and indicate errors or bad english >> expressions. >> >> http://perso.limsi.fr/pointal/python:memento

English version for Mémento Python 3 (draft, readers needed)

2012-06-05 Thread Laurent Pointal
Hello, I started a first translation of my document originally in french. Could some fluent english people read it and indicate errors or bad english expressions. http://perso.limsi.fr/pointal/python:memento Thanks. A+ Laurent. -- Laurent POINTAL - laurent.poin...@laposte.net -- http

Re: Converting a string to list for submission to easygui multenterb​ox

2012-05-02 Thread Laurent Pointal
title,qstack): > if choice[0] == None: > print ("No entries made") > break > > > print("CHOICE IS: ",choice). CHOICE IS: > ('', 'ksals', '', '',

Re: Naming future objects and their methods

2012-04-15 Thread Laurent Pointal
ata) if dataput.sent(timeout=1.0): print "Data has been sent." else: print "Data hasn't been sent within one second." -- Laurent POINTAL - laurent.poin...@laposte.net 3 allée des Orangers - 91940 Les Ulis - France Tél. 01 69 29 06 59 -- http://mail.python.org/mailman/listinfo/python-list

Re: string interpolation for python

2012-04-02 Thread Laurent Claessens
ot;.format(b['name'],b['job']) In the case in which b is an object having "job" and "name" attribute, the dynamic string will write "$b.name$ works as $b.job$" instead of "{0}.name works as {0}.job".format(b) Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Distribution

2012-03-20 Thread Laurent Claessens
for information.| -- sage: from scipy import stats sage: X=stats.poisson.rvs sage: X(4) 5 sage: X(4) 2 sage: X(4) 3 Hope it helps Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: what is best method to set sys.stdout to utf-8?

2012-03-07 Thread Laurent Claessens
te(x) sys.stdout=MyStdOut() ... well ... a part of the fact that it is much longer ? Laurent Claessens -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming convention for in-house modules (Newbie question)

2012-02-09 Thread Laurent Claessens
This is not 100% an answer to the question, but you should read that : http://www.python.org/dev/peps/pep-0008/ The OP mentions PEP 8 in the bit of his message that you *don't* quote. Well... I've to sleep. Sorry :( Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming convention for in-house modules (Newbie question)

2012-02-09 Thread Laurent Claessens
kages. Thanks. This is not 100% an answer to the question, but you should read that : http://www.python.org/dev/peps/pep-0008/ This explain you WhatCaseToChoose for_naming youVariables. Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing threads, and os.system()

2012-01-31 Thread Laurent Claessens
2.6+, I'd recommend converting from os.system() to subprocess.Popen(). .Popen() objects now have .terminate() and .kill() methods. Ok, I'll try that Popen. Indeed I think that my threads are stuck waiting os.system to complete. Thanks Laurent -- http://mail.python.org/mailman/listi

Killing threads, and os.system()

2012-01-30 Thread Laurent Claessens
t were called by os.system() ? My aim is of course to write an ultimate log file containing the status of the program when KeyboardInterupt was raised. (if not, the unix command "kill" does the job ;) ) Thanks for any help have a good day Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: ERROR:root:code for hash md5 was not found

2012-01-11 Thread Laurent Claessens
ing) File "/usr/lib/python2.6/hashlib.py", line 80, in __get_builtin_constructor raise ValueError, "unsupported hash type" ValueError: unsupported hash type You should give us a more comprehensive example of your problem. Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Complete beginner, any help appreciated :) - For Loops

2011-12-01 Thread Laurent Claessens
opython.pdf (page 58) Have a nice day Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: suitability of python

2011-11-24 Thread Laurent Claessens
situations, Sage is the "correct" successor of Fortran instead of plain python. Well, it does not answers the question, but ... Laurent [1] http://sagemath.org -- http://mail.python.org/mailman/listinfo/python-list

Re: property decorator and inheritance

2011-11-11 Thread Laurent
Hey yes it's working that way. But I don't like it very much either. If as OKB said the whole point is that outside functions can't detect a property then I'm going to stick with the non-decorator way. Thanks anyway. -- http://mail.python.org/mailman/listinfo/python-list

Re: property decorator and inheritance

2011-11-10 Thread Laurent
Yes using a separate class variable would transfer the problem to the class level. But adding 10 class variables if I have 10 properties would be ugly. Maybe I should reformulate the subject of this thread to "is there some python magic to pass parameters to decorator-declared properties ?" --

property decorator and inheritance

2011-11-10 Thread Laurent
Hi. I couldn't find a way to overwrite a property declared using a decorator in a parent class. I can only do this if I use the "classic" property() method along with a getter function. Here's an example: #!/usr/bin/python3 class Polite: def __init__(self): self._greeting = "He

Re: Extracting elements over multiple lists?

2011-11-07 Thread Laurent Claessens
r the loop. Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting elements over multiple lists?

2011-11-07 Thread Laurent Claessens
don't want new lists, I would do : a=[1,2,3,4,5] b=["one", "two", "three", "four", "five"] c=["cat", "dog", "parrot", "clam", "ferret"] for x in [a,b,c]: x.remove(x[0]) print a pri

Re: Entre local et global

2011-10-28 Thread Laurent Claessens
Woops. This was aimed to the french speaking python's usenet. Sorry. Laurent Le 28/10/2011 11:29, Laurent a écrit : Le 28/10/2011 10:43, ll.snark a écrit : On 27 oct, 17:06, Laurent Claessens wrote: > J'aimerais donc pouvoir indiquer dans fonca, que la variable lst es

Re: Entre local et global

2011-10-28 Thread Laurent
Le 28/10/2011 10:43, ll.snark a écrit : On 27 oct, 17:06, Laurent Claessens wrote: > J'aimerais donc pouvoir indiquer dans fonca, que la variable lst est > celle définie dans fonc1. > Je ne veux pas d'une variable locale à fonca, ni une variable globale > à tout m

Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens
just two of the biggest python parts in Sage, but there are many others ... 'till sage itself. Have a good afternoon Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens
l never be the default in 2.x. Thanks all for your ansers. I'll import division from __future__ Most of what I'm using in Python is with Sage[1]. Thus I'm not about to step to 3.x :( Laurent [1] www.sagemath.org -- http://mail.python.org/mailman/listinfo/python-list

Re: 1/2 evaluates to 0

2011-10-12 Thread Laurent
Include from __future__ import division on the top of your file from __future__ import division 1/2 0.5 Wohaw. This means that this behavior is going to be default in a foreseeable future ? Thanks Laurent -- http://mail.python.org/mailman/listinfo/python-list

1/2 evaluates to 0

2011-10-12 Thread Laurent Claessens
python says : There should be one-- and preferably only one --obvious way to do it. and I don't believe that float(1)/2 is an "obvious way" (I'm not Dutch) Have a good afternoon Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting the number of call of a function

2011-09-30 Thread Laurent Claessens
The keys of globals() are the _names_. You're giving it the function itself. Ow, ok. I didn't caught it. I understand now. > A decorator would be better. Yes. I keep the solution with foo=Wraper(foo) Thanks a lot all ! Laurent -- http://mail.python.org/mailman/listinfo/python-list

Counting the number of call of a function

2011-09-29 Thread Laurent Claessens
he way, I tried to print globals() inside __init__() to see what happens. It turns out that the entry 'foo' is never modified. Any idea ? I fact what I have to do is to add a decorator _a posteriori_ ... Have a good night Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on Manipulating List and on Python

2011-09-29 Thread Laurent Claessens
ogram inside Word macros, I guess the answer ;) If he is used to program in C, I'm less sure. It really depends on the context of the question. Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: using python in web applications

2011-09-11 Thread Laurent
+1 for PostgreSQL. It's faster than MySQL for years now, and is much more seriously featured. If you don't need ACID properties (transactions stuff) you should also give Document-based databases like MongoDB a try. It changed my code life. -- http://mail.python.org/mailman/listinfo/python-list

Re: using python in web applications

2011-09-10 Thread Laurent
Well PyPy is just an implementation of Python among many others (but limited to version 2.7). It is not a web server. If you want to make PyPy interact with a web server (such as nginx) you have to use a special protocol such as WSGI or Fast-CGI. For best performances you can for instance use uW

Re: using python in web applications

2011-09-10 Thread Laurent
[troll] For a serious web based MMO you'd rather stick to low level and forget about bloated Object Relational Mapping java-like layered kind of frameworks that are made for Rapid Applications Development, not for efficiency. [/troll] "Eve Online", a well known MMORPG was developped with stackle

Re: Running Python Demo on the Web?

2011-09-07 Thread Laurent
Neat. But I can see some "print(x)" and some "print x". What is the Python version? -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
> I don't think this question is meaningful. There are basically two > fundamental types of iterables, sequences and iterators. > > Sequences have random access and a length, so if the "start" and "end" of > the sequence is important to you, just use indexing: > > beginning = sequence[0] > end =

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Interesting. I will check that yield functionality out. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Yes, I was just hoping for something already included that I wouldn't know (i'm new to Python). -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   >