RE: Python-list Digest, Vol 196, Issue 26

2020-01-26 Thread Francois van Lieshout
for x in range( 0,10 ): stars = "" count = 0 while count < x: stars += "x" count += 1 print( stars ) x xx xxx x xx xxx x You've got already an "x" placed in your variable stars that's why. -Oorspronkelijk bericht- Van: Python-list

Fwd: permission denied using python 3.8

2019-11-04 Thread Francois van Lieshout
Outlook voor Android downloaden<https://aka.ms/ghei36> Van: Francois van Lieshout Verstuurd: maandag 4 november 2019 18:19 Aan: python-list@python.org Onderwerp: permission denied using python 3.8 Hi, i installed python 3.8 the latest version but it d

Re: How can I verify if the regex exist in a file without reading ?

2018-06-15 Thread francois . rabanel
Le vendredi 15 juin 2018 12:36:40 UTC+2, Steven D'Aprano a écrit : > On Fri, 15 Jun 2018 01:01:03 -0700, francois.rabanel wrote: > > > I work with a file which contains millions lines, a simply file.read() > > and I'm running out of memory > > Assuming each line is on average a hundred characters

Re: How can I verify if the regex exist in a file without reading ?

2018-06-15 Thread francois . rabanel
Le vendredi 15 juin 2018 02:42:12 UTC+2, Cameron Simpson a écrit : > On 15Jun2018 00:24, Steven D'Aprano > wrote: > >On Fri, 15 Jun 2018 10:00:59 +1000, Cameron Simpson wrote: > >> Francois, unless your regex can cross multiple lines it is better to > >> searc

How can I verify if the regex exist in a file without reading ?

2018-06-14 Thread francois . rabanel
Hi, Here is my script : It propose to replace some words in a file with a regular expression. It create a copy to write on it, and if there isn't an error, it delete the original by the copy with "os.rename" at the end. My problem is, if I work on a huge file, I'll try to avoid to read the file

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-06 Thread Francois Lafont
Le 07/08/2013 01:18, Francois Lafont a écrit : > For the inheritance of common options, I'll used something like > that (even if I prefer the oriented object side of the argparse > module): But I admit that this is a very simple and intelligent module. ;-) -- François L

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-06 Thread Francois Lafont
Hi, On relfection, it's clear that: 1. the "(-a -b VALUE-B | -c -d VALUE-D)" syntax is not implemented by the argparse module; 2. and get this syntax with "argparse + hacking" is not very clean. So, finally I'll use the docopt module version 0.6.1. For the inheritance of common options, I'll us

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-05 Thread Francois Lafont
Le 05/08/2013 22:01, Rafael Durán Castañeda a écrit : > I think you are looking for exclusive groups: > > http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_exclusive_group Yes... but no. The doc explains you can do this: my-script (-b VALUE-B | -d VALUE-D) ie mutally excl

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-05 Thread Francois Lafont
Le 05/08/2013 16:11, Miki Tebeka a écrit : > You can probably do something similar using sub commands > (http://docs.python.org/2/library/argparse.html#sub-commands). Yes, but this is not the same syntax. I want this syntax : my-script (-a -b VALUE-B | -c -d VALUE-D) I don't want this syntax:

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-04 Thread Francois Lafont
Hello, Up. ;-) Le 04/08/2013 04:10, Francois Lafont a écrit : > Is it possible with argparse to have this syntax for a script? > > my-script (-a -b VALUE-B | -c -d VALUE-D) > > I would like to do this with the argparse module. > > Thanks in advance. I have f

[argparse] mutually exclusive group with 2 sets of options

2013-08-03 Thread Francois Lafont
Hi, Is it possible with argparse to have this syntax for a script? my-script (-a -b VALUE-B | -c -d VALUE-D) I would like to do this with the argparse module. Thanks in advance. -- François Lafont -- http://mail.python.org/mailman/listinfo/python-list

Re: New instance of a class : not reset?

2011-01-24 Thread Jean-Francois
Great thank you -- http://mail.python.org/mailman/listinfo/python-list

New instance of a class : not reset?

2011-01-20 Thread Jean-Francois
Hi, In the following example, I don't understand why attribute 'data' is not reset when I get the new instance of Bag It works if I make a copy (data[:]) but I want to understand why Thanks class Bag(object): def __init__(self, data = []): self.data = data

Regex url

2011-01-15 Thread Jean-Francois
Hi, I try to match the following url with one regex /hello /hello/ /hello/world /hello/world/ world is a variable, I can put toto instead Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

How to clear a list (3 ways).

2008-03-07 Thread francois . petitjean
(second try with an enhanced version) Executive summary : What idiom do you use for resetting a list ? lst = |] # (1) lst[:] = [] # (2) del lst[:] # (3) Consider the following code : #!/usr/bin/env python # -*- coding: latin_1 -*- """ container.py how to clear a container """ c

How to clear a list (3 ways).

2008-03-06 Thread francois . petitjean
Consider the following code : #!/usr/bin/env python # -*- coding: latin_1 -*- """ container.py how to clear a container """ class Container(object): def __init__(self): self.elts = {} self.parts = [] def clear(self): self.elts.clear() # for a dictionary it's cl

RE: Simple calculation error

2008-01-04 Thread Francois Liot
No the change of sign is due to a fake copy and past, My question was related to decimal calculation. Thanks, Francois Liot -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul McGuire Sent: Friday, January 04, 2008 1:46 PM To: python-list@python.org

Simple calculation error

2008-01-04 Thread Francois Liot
Thanks in advance, Francois Liot -- http://mail.python.org/mailman/listinfo/python-list

Re: Real time plot

2007-10-05 Thread Jean-Francois Canac
"Lawson Hanson" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Nicholas Bastin wrote: >> On 10/4/07, Jean-Francois Canac <[EMAIL PROTECTED]> wrote: >>> [EMAIL PROTECTED] >>>> I would draw dots on a suitably sized Tk

Please Help me

2007-10-05 Thread Jean-Francois Canac
I am very new in Python and I would like to write an application which takes records from a COM port (or from a file to replay) and draw a real time Plot. But I am confused I have looked at Matplotlib, and a little at hippodraw, I have seen that there are many plot interfaces . But I really don

Re: Real time plot

2007-10-04 Thread Jean-Francois Canac
"Hendrik van Rooyen" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Jean-Francois Canac wrote: > >>I am reading a large amount of data from a COM port (or from a file) at a >>rate > of 20 records per second. It is about >pos

Real time plot

2007-10-03 Thread Jean-Francois Canac
I am reading a large amount of data from a COM port (or from a file) at a rate of 20 records per second. It is about positioning of a vehicle on a race track. In each record we have time, position (lat and long) speed, course all from GPS equipment. I would like to Produce a graph in real time wi

Re: Tell me the truth

2007-03-08 Thread francois . petitjean
Duncan Booth wrote : > francois.petitjean at bureauveritas.com wrote: >> After much head scrating and experimenting with dis.dis() I have found >> that chaining comparisons (with is or ==) a == b == c in Python is >> never a good idea. It is interpreted as >> ( a == b ) and ( b == c) >> Such a m

Tell me the truth

2007-03-08 Thread francois . petitjean
In the python-ideas mailing list http://mail.python.org/pipermail/python-ideas/2007-March/thread.html there was a discussion about the fact that python has opeartors 'and', 'or' and 'not' (keywords of the language) but 'bool' is a type. Naturally we have (not not x) == bool(x) # always True If

Re: NOT Python: Taxonomy list reference

2006-03-21 Thread Francois
This taxonomy is described in the Python Cookbook 2nd Ed,. Chapter 6, Introduction written by Alex Martelli, on page 234. The author explains that "multiple inheritance frees you from these contraints" - of fitting into a single taxonomy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
ion) to prevent ambiguity rather than depending on heuristics. Also "consistency" meant doing things as uniformly as possible (for example always call a function with the same syntax, whether the variable referencing it is the original name or an alias). -- Francois -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
[EMAIL PROTECTED] wrote: > What happened to 3)? > "4)" should have read "3)". I found the typo after I posted. I guess I lack "rigor" myself ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
hod) to prevent ambiguity rather than depending on heuristics. Also "consistency" meant doing things as uniformly as possible (for example always call a method with the same syntax, whether the variable referencing it is the original name or an alias). -- Francois -- http://mail.python.org/mailman/listinfo/python-list

Why I chose Python over Ruby

2006-03-05 Thread Francois
I discovered Python a few months ago and soon decided to invest time in learning it well. While surfing the net for Python, I also saw the hype over Ruby and tried to find out more about it, before I definitely embarked on studying and practicing Python. I recently found two sufficient answers for

Re: Dealing with Excel

2005-10-19 Thread Francois Lepoutre
riter/ We use the latter one in the past. As long as your output is plain enough. It's effective and MS-free. The former should be more powerful. Not tested here. Hope this helps Francois -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Robert Kern wrote: >Francois De Serres wrote: > > > >>I'll pick ('%c' * len(t)) % t, for it's readability and the fact that >>join() is on the deprec'd list. >> >> > >''.join() is certainly not deprecated. What m

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Francois De Serres wrote: >hiho, > >what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to >the string 'spam'? > >TIA, >Francois > > thanks to all! I'll pick ('%c' * len(t)) % t, for it's readability and the

tuple to string?

2005-07-22 Thread Francois De Serres
hiho, what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to the string 'spam'? TIA, Francois -- http://mail.python.org/mailman/listinfo/python-list

Exception in callback => GPF?

2005-07-15 Thread Francois De Serres
ta->deviceIndex, data->timestamp, data->buffer, data->size);// 0, 0, "test", 4);// result = PyEval_CallObject(my_callback, arglist); Py_DECREF(arglist); Py_DECREF(result); PyGILState_Release(gil);

Re: Documenting extension modules?

2005-07-15 Thread Francois De Serres
Simon Dahlbacka wrote: >Re: assigning a PyStr object to __doc__, take a look at Py_InitModule3, >which does that for you. > > > got it, thx. >Then you have the PyDoc_STRVAR macro in python.h that you might want to >use (see definition below). But as Robert already told you, you'll need >to prov

Re: Documenting extension modules?

2005-07-15 Thread Francois De Serres
Robert Kern wrote: >Francois De Serres wrote: > > >>Hiho, >> >>I can't seem to find a proper way to document my extension module. >>Following the C API doc: >> >>static PyMethodDef ioMethods[] = { >>{"o_count", o_c

Documenting extension modules?

2005-07-15 Thread Francois De Serres
function parameters Also, I'd like to know if there's a typical format for the help string (but in C), compatible with docstring's """short desription long description""" Any pointers please? TIA, Francois -- http://mail.python.org/mailman/listinfo/python-list

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Scott David Daniels wrote: >Francois De Serres wrote: > > >>Francois De Serres wrote: >> >> >>>Having a string: "dothat" >>>and a tuple: (x, y) >>>1. What's the best way to build a function call like: dothat(x,y)? >>

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Duncan Booth wrote: >Francois De Serres wrote: > > > >>Sorry, I was unclear about the fact that the args are formals. I'm >>trying to do something like: >> >>func = "dothat" >>args = ('x','y') >>localcontext =

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Steven D'Aprano wrote: >On Wed, 13 Jul 2005 06:16:54 -0700, Robert Kern wrote: > > > >>Duncan Booth wrote: >> >> >>>Francois De Serres wrote: >>> >>> >>> >>>>Having a string: "dothat"

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Francois De Serres wrote: >Hiho, > >Having a string: "dothat" >and a tuple: (x, y) >1. What's the best way to build a function call like: dothat(x,y)? > >Assuming dothat is def'd in the same module, >2. is: eval("dothat(x,y)", None, ((

Re: **kwargs?

2005-07-13 Thread Francois De Serres
Michael Hoffman wrote: >Peter Hansen wrote: > > >>Francois De Serres wrote: >> >> >> > > > >>>*args is documented in the Tutorial. I reckon **kwargs represents a >>>dictionary of arguments. But I don't quite get the semant

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Peter Hansen wrote: >Roland Heiber wrote: > > >>Not the best (not at all) but one way: >> >>def dothat(x,y): >> print "Called with:", x, y >> >>c = (1,2) >> >>locals().get("dothat")(*c) >> >> > >As you say, not the best, but in fact not really advisable under any >circumstances. locals()

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Roland Heiber wrote: >Francois De Serres wrote: > > >>Hiho, >> >>Having a string: "dothat" >>and a tuple: (x, y) >>1. What's the best way to build a function call like: dothat(x,y)? >> >> > >Not the best (not at

**kwargs?

2005-07-13 Thread Francois De Serres
se, I wish I was, but I'm not a scientist). TIA, Francois -- http://mail.python.org/mailman/listinfo/python-list

Building a function call?

2005-07-13 Thread Francois De Serres
it executed? If dothat is def'd in another module: 3. what would be the right way to initialize the globals to pass to eval ? TIA, Francois -- http://mail.python.org/mailman/listinfo/python-list

The GIL, callbacks, and GPFs

2005-07-06 Thread Francois De Serres
: while True: print q.get() if __name__ == '__main__': spam.setCallback(callback) t = threading.Thread(job) t.start() raw_input() Please point me to what I'm doing wrong... TIA, Francois PS: I've already submitted my issue under "(Win32 API) callback to Python, threading hiccups", but I guess it was poorly formulated. -- http://mail.python.org/mailman/listinfo/python-list

Re: (Win32 API) callback to Python, threading hiccups

2005-07-05 Thread Francois De Serres
Christopher Subich wrote: >Francois De Serres wrote: > > >>- so, on callback, I create a new thread, after checking that the >>previous one has returned already (WaitOnSingleObject(mythread)) so we >>only have one thread involved. >> >> > >

(Win32 API) callback to Python, threading hiccups

2005-07-05 Thread Francois De Serres
ll I figure out what's really happening. Could someone save my precious and already sparse sleeping time, by pointing me to what I'm missing here? WinXP SP1 Python 2.4.1 MinGW GCC 3.4.2 TIA, Francois De Serres -- http://mail.python.org/mailman/listinfo/python-list

Re: MS SQL Server/ODBC package for Python

2005-04-18 Thread Francois Lepoutre
sed applications (such as wxpython-based ones). Regards to you Francois -- http://mail.python.org/mailman/listinfo/python-list

Re: MS SQL Server/ODBC package for Python

2005-04-16 Thread Francois Lepoutre
Peter, May my I apologize for knocking against your information, as well. > For what it is worth, my experience is as follows: Using a PIII > 550MHz, 256MB RAM, running WinNT 4.0 and Python 2.3.4 and connecting > to a Sybase Adaptive Server Anywhere 8.0 database, mx.ODBC took > approximately 8 wal