In a...@pythoncraft.com (Aahz) writes:
>In article , kj wrote:
>You may find this enlightening:
>http://www.python.org/doc/1.4/lib/node52.html
Indeed. Thank you.
kj
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 3, 2009 at 4:05 PM, kj wrote:
> I'm will be teaching a programming class to novices, and I've run
> into a clear conflict between two of the principles I'd like to
> teach: code clarity vs. code reuse. I'd love your opinion about
> it.
In general, code clarity is more important than r
En Mon, 06 Jul 2009 03:33:36 -0300, Gary Herron
escribió:
Gabriel Genellina wrote:
En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano
escribió:
On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote:
I wonder how many people have been tripped up by the fact that
++n
and
On Mon, Jul 6, 2009 at 9:44 AM, Martin Vilcans wrote:
> On Fri, Jul 3, 2009 at 4:05 PM, kj wrote:
>> I'm will be teaching a programming class to novices, and I've run
>> into a clear conflict between two of the principles I'd like to
>> teach: code clarity vs. code reuse. I'd love your opinion abo
Gabriel Genellina wrote:
[... re confusion over ++n etc ...]
In this case, a note in the documentation warning about the potential
confusion would be fine.
The difficulty here is knowing where to put such a warning.
You obviously can't put it against the "++" operator as such
because... there
jack catcher (nick) wrote:
Hi,
I'm thinking of using Python for capturing and showing live webcam
stream simultaneously between two computers via local area network.
Operating system is Windows. I'm going to begin with VideoCapture
extension, no ideas about other implementation yet. Do you ha
On 5 July, 17:12, Tim Harig wrote:
> On 2009-07-05, RAM wrote:
>
> > I need to start an external program and pass the keyboard events like
> > F1,Right arrow key etc to the program..I am trying to use the
> > subprocess module to invoke the external program. I am able to invoke
> > but not able t
Martin v. Löwis v.loewis.de> writes:
> > This is a good test for Python implementation bottlenecks. Run
> > that tokenizer on HTML, and see where the time goes.
>
> I looked at it with cProfile, and the top function that comes up
> for a larger document (52k) is
> ...validator.HTMLConformanceCh
In message , Tim Golden
wrote:
> The difficulty here is knowing where to put such a warning.
> You obviously can't put it against the "++" operator as such
> because... there isn't one.
This bug is an epiphenomenon. :)
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jul 6, 2009 at 1:29 AM, Lawrence
D'Oliveiro wrote:
> In message , Tim Golden
> wrote:
>
>> The difficulty here is knowing where to put such a warning.
>> You obviously can't put it against the "++" operator as such
>> because... there isn't one.
>
> This bug is an epiphenomenon. :)
Well, l
On Jul 6, 5:56 pm, Tim Golden wrote:
> Gabriel Genellina wrote:
> > In this case, a note in the documentation warning about the potential
> > confusion would be fine.
>
> The difficulty here is knowing where to put such a warning.
> You obviously can't put it against the "++" operator as such
> be
In message <4a4f91f9$0$1587$742ec...@news.sonic.net>, John Nagle wrote:
> ("It should be written in C" is not an acceptable answer.)
I don't see why not. State machines that have to process input byte by byte
are well known to be impossible to implement efficiently in high-level
languages. That
2009/7/6 RAM :
> I am trying to do this on windows. My program(executable) has been
> written in VC++ and when I run this program, I need to click on one
> button on the program GUI i,e just I am entering "Enter key" on the
> key board. But this needs manual process. So i need to write a python
>
On Jul 6, 12:32 pm, Lawrence D'Oliveiro wrote:
> I wonder how many people have been tripped up by the fact that
>
> ++n
>
> and
>
> --n
>
> fail silently for numeric-valued n.
What fail? In Python, ++n and --n are fatuous expressions which
SUCCEED silently except for rare circiumstances e
2009/7/6 Xavier Ho :
> Why is version B of the code faster than version A? (Only three lines
> different)
Here's a guess:
As the number you're testing gets larger, version A is creating very
big list. I'm not sure exactly how much overhead each list entry has
in python, but I guess it's at least
Gabriel Genellina wrote:
In this case, a note in the documentation warning about the potential
confusion would be fine.
How would that help someone who does not read the doc?
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am creating a tree data-structure in python; with nodes of the tree
created by a simple class :
class Node :
def __init__(self , other attributes):
# initialise the attributes here!!
But the problem is I am working with a huge tree (millions of nodes); and
each no
On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote:
> En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano
> escribió:
>> On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote:
>>
>>> I wonder how many people have been tripped up by the fact that
>>>
>>> ++n
>>>
>>> and
>>>
>>
On Mon, Jul 6, 2009 at 2:55 AM, mayank gupta wrote:
> Hi,
>
> I am creating a tree data-structure in python; with nodes of the tree
> created by a simple class :
>
> class Node :
> def __init__(self , other attributes):
> # initialise the attributes here!!
>
> But the prob
Xavier Ho wrote:
(Here's a short version of the long version below if you don't want to
read:)
Why is version B of the code faster than version A? (Only three lines
different)
Version A: http://pastebin.com/f14561243
Version B: http://pastebin.com/f1f657afc
Thanks for the other possibilites. I would consider option (2) and (3) to
improve my code.
But out of curiosity, I would still like to know why does an object of a
Python-class consume "so" much of memory (1.4 kb), and this memory usage has
nothing to do with its attributes.
Thanks
Regards.
On
The SQLite documentation mentions a flag, SQLITE_OPEN_READONLY, to
open a database read only. I can't find any equivalent documented in
the Python standard library documentation for the sqlite3 module (or,
for that matter, on the pysqlite library's website).
Is it possible to open a sqlite databas
Thanks for the response all, I finally got my 'net working on the mountains,
and I think your reasons are quite sound. I'll keep that in mind for the
future.
Best regards,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavi
"Terry Reedy" wrote:
> Gabriel Genellina wrote:
> >
> > In this case, a note in the documentation warning about the potential
> > confusion would be fine.
>
> How would that help someone who does not read the doc?
It obviously won't.
All it will do, is that it will enable people on this group
OK, fine, I read longobject.c at last! :)
I found that longobject is a structure like this:
struct _longobject {
struct _object *_ob_next;
struct _object *_ob_prev;
Py_ssize_t ob_refcnt;
struct _typeobject *ob_type;
digit ob_digit[1];
}
And a digit is a 15-item array of C's un
Andre Engels wrote:
On Mon, Jul 6, 2009 at 9:44 AM, Martin Vilcans wrote:
On Fri, Jul 3, 2009 at 4:05 PM, kj wrote:
I'm will be teaching a programming class to novices, and I've run
into a clear conflict between two of the principles I'd like to
teach: code clarity vs. code reuse. I'd love you
kj wrote:
I've rewritten it like this:
sense = cmp(func(hi), func(lo))
assert sense != 0, "func is not strictly monotonic in [lo, hi]"
Thanks for your feedback!
kj
As already said before, unlike other languages, sense in english does
**not** mean direction. You should rewrite th
Steven D'Aprano wrote:
... That's the Wrong Way to do it --
you're using a screwdriver to hammer a nail
Don't knock tool abuse (though I agree with you here).
Sometimes tool abuse can produce good results. For
example, using hammers to drive screws for temporary
strong holds led to making
I'm attempting to write a bootstrap script for virtualenv. I just want to do
a couple of easy_install's after the environment is created. It was fairly
easy to create the script, but I can't figure out how to implement it. The
documentation was not of much help. Can someone please point me in the r
protocol = {"start":initialiser,"hunt":hunter,"classify":classifier,other
states}
def state_machine():
next_step = protocol["start"]()
while True:
next_step = protocol[next_step]()
Woot ! I'll keep this one in my mind, while I may not be that concerned
by speed unlike t
On Jul 6, 1:12 pm, "Hendrik van Rooyen" wrote:
> "Terry Reedy" wrote:
> > Gabriel Genellina wrote:
>
> > > In this case, a note in the documentation warning about the potential
> > > confusion would be fine.
>
> > How would that help someone who does not read the doc?
>
> It obviously won't.
>
>
On Jul 6, 1:24 pm, Pedram wrote:
> OK, fine, I read longobject.c at last! :)
> I found that longobject is a structure like this:
>
> struct _longobject {
> struct _object *_ob_next;
> struct _object *_ob_prev;
For current CPython, these two fields are only present in debug
builds; for a
Hi all,
I can't figure out how to map a C variable of size_t via Python's
ctypes module. Let's say I have a C function like this:
void populate_big_array(double *the_array, size_t element_count) {...}
How would I pass parameter 2? A long (or ulong) will (probably) work
(on most platforms),
Peter Otten wrote:
Scott David Daniels wrote:
Scott David Daniels wrote:
t = timeit.Timer('sum(part[:-1]==part[1:])',
'from __main__ import part')
What happens if you calculate the sum in numpy? Try
t = timeit.Timer('(part[:-1]==part[1:]).sum()',
On Jul 6, 3:32 am, Lawrence D'Oliveiro wrote:
> I wonder how many people have been tripped up by the fact that
>
> ++n
>
> and
>
> --n
>
> fail silently for numeric-valued n.
Recent python-ideas discussion on this subject:
http://mail.python.org/pipermail/python-ideas/2009-March/003741.h
"Jean-Michel Pichavant" wrote:
> Woot ! I'll keep this one in my mind, while I may not be that concerned
> by speed unlike the OP, I still find this way of doing very simple and
> so intuitive (one will successfully argue how I was not figuring this
> out by myself if it was so intuitive).
> A
Dave Angel wrote:
[snip]
It would probably save some time to not bother storing the zeroes in the
list at all. And it should help if you were to step through a list of
primes, rather than trying every possible int. Or at least constrain
yourself to odd numbers (after the initial case of 2).
Hi all,
I would like to extract string from a PO file. To do this I have created
a little python function to parse po file and extract string:
import re
regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n")
m=r.findall(s)
where s is a po file like this:
msgctxt "write ubiquity commands.descripti
An alpha release of GMPY that supports Python 2 and 3 is available.
GMPY is a wrapper for the GMP multiple-precision arithmetic
library. The MPIR multiple-precision arithmetic library is also
supported. GMPY is available for download from
http://code.google.com/p/gmpy/
Support for Python 3 require
On Mon, 06 Jul 2009 10:58:21 +0100, Steven D'Aprano
wrote:
On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote:
En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano
escribió:
On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote:
I wonder how many people have been tripped
gialloporpora writes:
> I would like to extract string from a PO file. To do this I have created
> a little python function to parse po file and extract string:
>
> import re
> regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n")
> m=r.findall(s)
I don't know the syntax of a po file, but this works
a...@pythoncraft.com (Aahz) writes:
> In article ,
> Hendrik van Rooyen wrote:
>>
>>But wait - maybe if he passes an iterator around - the equivalent of
>>for char in input_stream... Still no good though, unless the next call
>>to the iterator is faster than an ordinary python call.
>
> Calls to
gialloporpora wrote:
Hi all,
I would like to extract string from a PO file. To do this I have created
a little python function to parse po file and extract string:
import re
regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n")
m=r.findall(s)
where s is a po file like this:
msgctxt "write ubiqu
Hello Mr. Dickinson. Glad to see you again :)
On Jul 6, 5:46 pm, Mark Dickinson wrote:
> On Jul 6, 1:24 pm, Pedram wrote:
>
> > OK, fine, I read longobject.c at last! :)
> > I found that longobject is a structure like this:
>
> > struct _longobject {
> > struct _object *_ob_next;
> > str
> Dave Angel (DA) wrote:
>DA> It would probably save some time to not bother storing the zeroes in the
>DA> list at all. And it should help if you were to step through a list of
>DA> primes, rather than trying every possible int. Or at least constrain
>DA> yourself to odd numbers (after the
On Mon, 06 Jul 2009 07:10:38 +0100, jack catcher (nick)
wrote:
Tim Roberts kirjoitti:
"jack catcher (nick)" wrote:
I'm thinking of using Python for capturing and showing live webcam
stream simultaneously between two computers via local area network.
Operating system is Windows. I'm goin
Hendrik van Rooyen wrote:
"Jean-Michel Pichavant" wrote:
Woot ! I'll keep this one in my mind, while I may not be that concerned
by speed unlike the OP, I still find this way of doing very simple and
so intuitive (one will successfully argue how I was not figuring this
out by myself if it
2009/7/4 kj :
> Precisely. As I've stated elsewhere, this is an internal helper
> function, to be called only a few times under very well-specified
> conditions. The assert statements checks that these conditions
> are as intended. I.e. they are checks against the module writer's
> programming
Hi all,
I'm looking for some structure advice. I'm writing something that
currently looks like the following:
try:
except KeyError:
else:
This is working fine. However, I now want to add a call to a function
in the `else' part that may raise an exception, say a ValueError. So I
wa
Sorry, there was an error in the sieve in my last example. Here is a
corrected version:
D = {9: 6} # contains composite numbers
Dlist = [2, 3] # list of already generated primes
def sieve():
'''generator that yields all prime numbers'''
global D
global Dlist
for q in Dlist:
> David House (DH) wrote:
>DH> Hi all,
>DH> I'm looking for some structure advice. I'm writing something that
>DH> currently looks like the following:
>DH> try:
>DH>
>DH> except KeyError:
>DH>
>DH> else:
>DH>
>DH> This is working fine. However, I now want to add a call to a f
Philip Semanchuk wrote:
> Hi all,
> I can't figure out how to map a C variable of size_t via Python's
> ctypes module. Let's say I have a C function like this:
>
> void populate_big_array(double *the_array, size_t element_count) {...}
>
> How would I pass parameter 2? A long (or ulong) will (pro
QOTW: "Simulating a shell with hooks on its I/O should be so complicated that
a 'script kiddie' has trouble writing a Trojan." - Scott David Daniels
http://groups.google.com/group/comp.lang.python/msg/1c0f70d5fc69b5aa
Python 3.1 final was released last week - congratulations!
2009/7/6 Python :
> as far as I know try has no 'else'
It does:
http://docs.python.org/reference/compound_stmts.html#the-try-statement
> it's 'finally'
There is a `finally', too, but they are semantically different. See
the above link.
--
-David
--
http://mail.python.org/mailman/listinfo/pyth
On 6 jul 2009, at 18:14, David House wrote:
2009/7/6 Python :
as far as I know try has no 'else'
It does:
http://docs.python.org/reference/compound_stmts.html#the-try-statement
it's 'finally'
There is a `finally', too, but they are semantically different. See
the above link.
--
-David
On Jul 6, 2009, at 12:10 PM, Diez B. Roggisch wrote:
Philip Semanchuk wrote:
Hi all,
I can't figure out how to map a C variable of size_t via Python's
ctypes module. Let's say I have a C function like this:
void populate_big_array(double *the_array, size_t element_count)
{...}
How would
On 2009-07-06, RAM wrote:
> I am trying to do this on windows. My program(executable) has been
> written in VC++ and when I run this program, I need to click on one
> button on the program GUI i,e just I am entering "Enter key" on the
> key board. But this needs manual process. So i need to write
Risposta al messaggio di Hallvard B Furuseth :
I don't know the syntax of a po file, but this works for the
snippet you posted:
arg_re = r'"[^\\\"]*(?:\\.[^\\\"]*)*"'
arg_re = '%s(?:\s+%s)*' % (arg_re, arg_re)
find_re = re.compile(
r'^msgid\s+(' + arg_re + ')\s*\nmsgstr\s+(' + arg_re + '
Piet van Oostrum wrote:
Dave Angel (DA) wrote:
DA> It would probably save some time to not bother storing the zeroes in the
DA> list at all. And it should help if you were to step through a list of
DA> primes, rather than trying every possible int. Or at least constrain
DA> yourself to odd
MRAB wrote:
Dave
Angel wrote:
[snip]
It would probably save some time to not bother storing the zeroes in
the list at all. And it should help if you were to step through a
list of primes, rather than trying every possible int. Or at least
constrain yourself to odd numbers (after the initial
Rhodri James wrote:
On Mon,
06 Jul 2009 10:58:21 +0100, Steven D'Aprano
wrote:
On Mon, 06 Jul 2009 02:19:51 -0300, Gabriel Genellina wrote:
En Mon, 06 Jul 2009 00:28:43 -0300, Steven D'Aprano
escribió:
On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote:
I wonder how many peo
On 6 jul 2009, at 17:46, David House wrote:
Hi all,
I'm looking for some structure advice. I'm writing something that
currently looks like the following:
try:
except KeyError:
else:
This is working fine. However, I now want to add a call to a function
in the `else' part that may
Scott David Daniels wrote:
Piet van
Oostrum wrote:
Dave Angel (DA) wrote:
DA> It would probably save some time to not bother storing the
zeroes in the
DA> list at all. And it should help if you were to step through a
list of
DA> primes, rather than trying every possible int. Or at least
On Mon, Jul 6, 2009 at 6:12 AM, mayank gupta wrote:
> Thanks for the other possibilites. I would consider option (2) and (3) to
> improve my code.
>
> But out of curiosity, I would still like to know why does an object of a
> Python-class consume "so" much of memory (1.4 kb), and this memory usage
Dave Angel wrote:
MRAB wrote:
Dave
Angel wrote:
[snip]
It would probably save some time to not bother storing the zeroes in
the list at all. And it should help if you were to step through a
list of primes, rather than trying every possible int. Or at least
constrain yourself to odd numbers
Hello,
I am new to python and have been trying to figure out how to remotely
add new pages to my confluence
wiki space. I'm running my python script from a linux rhel4 machine
and using confluence version 2.10. As a test I tried to read from
stdin and write a page but it fails- that is, the script
Rhodri James kirjoitti:
On Mon, 06 Jul 2009 07:10:38 +0100, jack catcher (nick)
wrote:
Tim Roberts kirjoitti:
"jack catcher (nick)" wrote:
I'm thinking of using Python for capturing and showing live webcam
stream simultaneously between two computers via local area network.
Operating syste
Risposta al messaggio di MRAB :
gialloporpora wrote:
Hi all,
I would like to extract string from a PO file. To do this I have created
a little python function to parse po file and extract string:
import re
regex=re.compile("msgid (.*)\\nmsgstr (.*)\\n\\n")
m=r.findall(s)
where s is a po file
MRAB wrote:
Dave
Angel wrote:
MRAB wrote:
Dave
Angel wrote:
[snip]
It would probably save some time to not bother storing the zeroes
in the list at all. And it should help if you were to step through
a list of primes, rather than trying every possible int. Or at
least constrain yourself t
I remember in college taking an intro programming class (C++) where
the professor started us off writing a program to factor polynomials;
he probably also incorporated binary search into an assignment. But
people don't generally use Python to implement binary search or factor
polynomials so maybe y
On Mon, Jul 6, 2009 at 07:12, Hendrik van Rooyen wrote:
> "Terry Reedy" wrote:
>
>> Gabriel Genellina wrote:
>> >
>> > In this case, a note in the documentation warning about the potential
>> > confusion would be fine.
>>
>> How would that help someone who does not read the doc?
>
> It obviously w
I have been having issues trying to wrap libusb-1.0 with ctypes. Actually,
there's not much of an issue if I keep everything synchronous, but I need
this to be asynchronous and that is where my problem arises.
Please refer to the following link on Stackoverflow for a full overview of
the issue.
h
On Mon, 06 Jul 2009 20:41:03 +0300, jack catcher (nick) wrote:
>> Does the webcam just deliver frames, or are you getting frames out of
>> a decoder layer? If it's the latter, you want to distribute the encoded
>> video, which should be much lower bandwidth. Exactly how you do that
>> depends a
David House a écrit :
Hi all,
I'm looking for some structure advice. I'm writing something that
currently looks like the following:
try:
except KeyError:
else:
This is working fine. However, I now want to add a call to a function
in the `else' part that may raise an exception, s
Python a écrit :
(snip whole OP)
as far as I know try has no 'else'
Then you may want to RTFM.
--
http://mail.python.org/mailman/listinfo/python-list
Mark Dickinson a écrit :
On Jul 5, 1:09 pm, Pedram wrote:
Thanks for reply,
Sorry I can't explain too clear! I'm not English ;)
That's shocking. Everyone should be English. :-)
Mark, tu sors !
--
http://mail.python.org/mailman/listinfo/python-list
Mark Dickinson wrote:
On Jul 6, 3:32 am, Lawrence D'Oliveiro wrote:
I wonder how many people have been tripped up by the fact that
++n
and
--n
fail silently for numeric-valued n.
Rather few, it seems.
Recent python-ideas discussion on this subject:
http://mail.python.org/piperm
mayank gupta gmail.com> writes:
>
> After a little analysis, I found out that in general it uses about
> 1.4 kb of memory for each node!!
How did you measure memory use? Python objects are not very compact, but 1.4KB
per object seems a bit too much (I would expect more about 150-200 bytes/object
pescadero10 wrote:
I am new to python and have been trying to figure out how to remotely
add new pages to my confluence
wiki space. I'm running my python script from a linux rhel4 machine
and using confluence version 2.10. As a test I tried to read from
stdin and write a page but it fails- that
Many thanks to all who replied! And, yes, I will *definitely* use raw
strings from now on. :)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Hello!
I have been thinking about how write exception safe constructors in
Python. By exception safe I mean a constructor that does not leak
resources when an exception is raised within it. The following is an
example of one possible way to do it:
class Foo(object):
def __init__(self, name, f
In <4a4e2227$0$7801$426a7...@news.free.fr> Bruno Desthuilliers
writes:
>kj a écrit :
>(snipo
>> To have a special-case
>> re.match() method in addition to a general re.search() method is
>> antithetical to language minimalism,
>FWIW, Python has no pretention to minimalism.
Assuming that you me
Paul Moore wrote:
> The SQLite documentation mentions a flag, SQLITE_OPEN_READONLY, to
> open a database read only. I can't find any equivalent documented in
> the Python standard library documentation for the sqlite3 module (or,
> for that matter, on the pysqlite library's website).
>
> Is it pos
I worked out a small code which initializes about 1,000,000 nodes with some
attributes, and saw the memory usage on my linux machine (using 'top'
command). Then just later I averaged out the memory usage per node. I know
this is not the most accurate way but just for estimated value.
The kind of N
> On Tue, Jul 7, 2009 at 1:28 AM, Antoine Pitrou wrote:
>>
>> mayank gupta gmail.com> writes:
>> >
>> > After a little analysis, I found out that in general it uses about
>> > 1.4 kb of memory for each node!!
>>
>> How did you measure memory use? Python objects are not very compact, but
>> 1.4KB
brasse wrote:
I have been thinking about how write exception safe constructors in
Python. By exception safe I mean a constructor that does not leak
resources when an exception is raised within it.
...
> As you can see this is less than straight forward. Is there some kind
> of best practice tha
kj schrieb:
In <4a4e2227$0$7801$426a7...@news.free.fr> Bruno Desthuilliers
writes:
kj a �crit :
(snipo
To have a special-case
re.match() method in addition to a general re.search() method is
antithetical to language minimalism,
FWIW, Python has no pretention to minimalism.
Assuming that
What is required in a python program to make sure it catches a control-
c on the command-line? Do some i/o? The OS here is Linux.
Thanks,
Mike
--
http://mail.python.org/mailman/listinfo/python-list
HI,
Im trying to parse a bands myspace page and get the total number of
plays for their songs. e.g. http://www.myspace.com/mybloodyvalentine
The problem is that I cannot use urllib2 as the "Total plays" string
does not appear in the page source.
Any idea of ways around this?
Thanks,
O
--
http:
On Mon, Jul 6, 2009 at 2:37 PM, Michael Mossey wrote:
> What is required in a python program to make sure it catches a control-
> c on the command-line? Do some i/o? The OS here is Linux.
try:
#code that reads input
except KeyboardInterrupt:
#Ctrl-C was pressed
Cheers,
Chris
--
http://bl
On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote:
What is required in a python program to make sure it catches a
control-
c on the command-line? Do some i/o? The OS here is Linux.
You can use a try/except to catch a KeyboardInterrupt exception, or
you can trap it using the signal module:
On Jul 6, 2:47 pm, Philip Semanchuk wrote:
> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote:
>
> > What is required in a python program to make sure it catches a
> > control-
> > c on the command-line? Do some i/o? The OS here is Linux.
>
> You can use a try/except to catch a KeyboardInterrupt
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a date which serves as a key to a
dictionary. Each time a date is returned I want to increment the value
associated with that date. The
On Jul 6, 2009, at 6:02 PM, Michael Mossey wrote:
On Jul 6, 2:47 pm, Philip Semanchuk wrote:
On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote:
What is required in a python program to make sure it catches a
control-
c on the command-line? Do some i/o? The OS here is Linux.
You can use a tr
On Mon, Jul 6, 2009 at 3:02 PM, Nile wrote:
> I am trying to write a simple little program to do some elementary
> stock market analysis. I read lines, send each line to a function and
> then the function returns a date which serves as a key to a
> dictionary. Each time a date is returned I want t
On Mon, Jul 6, 2009 at 17:02, Nile wrote:
> Code
>
> for x in range(len(file_list)):
> d = open(file_list[x] , "r")
> data = d.readlines()
> k = above_or_below(data) # This
> function seems to work correctly
> print "here is the value that was returned
Michael Mossey wrote:
> On Jul 6, 2:47 pm, Philip Semanchuk wrote:
>> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote:
>>
>>> What is required in a python program to make sure it catches a control-
>>> c on the command-line? Do some i/o? The OS here is Linux.
>> You can use a try/except to catc
Chris Rebert wrote:
On Mon, Jul 6, 2009 at 3:02 PM, Nile wrote:
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a date which serves as a key to a
dictionary. Each time a date is re
2009/7/6 Joshua Kugler :
> Paul Moore wrote:
>> The SQLite documentation mentions a flag, SQLITE_OPEN_READONLY, to
>> open a database read only. I can't find any equivalent documented in
>> the Python standard library documentation for the sqlite3 module (or,
>> for that matter, on the pysqlite lib
On Jul 6, 5:30 pm, "Pablo Torres N." wrote:
> On Mon, Jul 6, 2009 at 17:02, Nile wrote:
> > Code
>
> > for x in range(len(file_list)):
> > d = open(file_list[x] , "r")
> > data = d.readlines()
> > k = above_or_below(data) # This
> > function seems to work
1 - 100 of 157 matches
Mail list logo