Re: Coding style

2006-07-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bob Greschke wrote: > I'd go even one step further. Turn it into English (or your favorite > non-computer language): > > 1. While list, pop. > > 2. While the length of the list is greater than 0, pop. > > Which one makes more sense? Guess which one I like. CPU

Re: unicode html

2006-07-17 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Hi, I've found lots of material on the net about unicode html > conversions, but still i'm having many problems converting unicode > characters to html entities. Is there any available function to solve > this issue? > As an example I would like to do this kind of convers

Re: Capturing instant messages

2006-07-17 Thread Paul Rubin
Ed Leafe <[EMAIL PROTECTED]> writes: > But assuming that there is no such product, would it be > possible to create something in Python, using the socket or a similar > module? They have a number of servers that provide NAT for each group > of machines; I was thinking that something on tho

Re: Coding style

2006-07-17 Thread Steve Holden
tac-tics wrote: > dwelch91 wrote: > >>tac-tics wrote: >> >>>I'd say the second one. Empty lists are not false. They are empty. Long >>>live dedicated boolean data types. >>> >> >>Uh, no, empty lists are False in a boolean context: >> >>http://docs.python.org/lib/truth.html >> >>-Don > > > Perhap

Re: Coding style

2006-07-17 Thread Carl Banks
Peter Otten wrote: > Carl Banks wrote: > > > def process_values(lst): > > if not lst: > > return > > do_expensive_initialization_step() > > for item in lst: > > do_something_with(item) > > do_expensive_finalization_step() > > > What if yo

Re: XMLRPC Solution Code

2006-07-17 Thread Steve Holden
dylpkls91 wrote: > [EMAIL PROTECTED] wrote: > >>Mind posting it for us lesser beings? ;) > > > Not at all. I have yet to test it on networked computers, but it works > fine when I run both scripts on my machine. > > The hard part now is getting the server code to run as a Windows > service- arg

Re: Coding style

2006-07-17 Thread Peter Otten
Carl Banks wrote: > def process_values(lst): > if not lst: > return > do_expensive_initialization_step() > for item in lst: > do_something_with(item) > do_expensive_finalization_step() > What if you called the function like this: > >   

Re: Track keyboard and mouse usage

2006-07-17 Thread dfaber
That IS brain-crushingly complicated. However, thanks for the insight. I really appreciate it. Dennis Lee Bieber wrote: > On 17 Jul 2006 21:00:09 -0700, "dfaber" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > Is there no clean method of accessing the keyboard device or t

Re: Coding style

2006-07-17 Thread Carl Banks
Paul Rubin wrote: > "Carl Banks" <[EMAIL PROTECTED]> writes: > > What if you called the function like this: > > > > process_values(x.strip() for x in values_lst) > > > > Oops, now we've just gone through an expensive initialization and > > finalization for nothing (since values_lst was empty).

Re: function v. method

2006-07-17 Thread bayerj
I guess the python devs are not interested in implementing something that would require new syntax and does not give something entirely new to the language. The good thing about python is, that the devs are only implementing ideas that are very cool. There are a lot of cool (!= very cool) ideas in

Capturing instant messages

2006-07-17 Thread Ed Leafe
I've been approached by a local business that has been advised that they need to start capturing and archiving their instant messaging in order to comply with Sarbanes-Oxley. The company is largely PC, but has a significant number of Macs running OS X, too. Googling around qu

Google Earth contact? (OT, sort of...)

2006-07-17 Thread Bell, Kevin
Sorry if this is an off topic shot in the dark, but... Does anyone know a contact for anyone that works for Google Earth? I wanted to shoot 'em an email about a possible enhancement, but they're smart enough to not leave contact info ANYWHERE on their websites. -- http://mail.python.org/mailma

Help me

2006-07-17 Thread slidermansliderman
Simple though but how do you check your internet connection by Python ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-17 Thread Paul Rubin
"Carl Banks" <[EMAIL PROTECTED]> writes: > What if you called the function like this: > > process_values(x.strip() for x in values_lst) > > Oops, now we've just gone through an expensive initialization and > finalization for nothing (since values_lst was empty). Maybe some > subtle bugs intr

Re: about Python types and objects

2006-07-17 Thread alex23
> I have read the booth python types and objects. I think its book for > clearificating types and objects in python. It says there will be a > book named python attributes and methods. Do you know any information > about this book. I am interested in it. Hey pipehappy, __Python Attributes and

function v. method

2006-07-17 Thread danielx
At first I was going to post the following: I just discovered the inspect module, which contains the isfunction and ismethod functions. For some reason, I used to be under the impression that Python methods are no different from Python functions. Naturally, I wondered why both of these needed to

Re: Coding style

2006-07-17 Thread Carl Banks
PTY wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop() Here's another reason not to use "if lst". Say you have a function that looks like this: def process_values(lst): if not lst: return do_e

Re: range() is not the best way to check range?

2006-07-17 Thread tac-tics
Grant Edwards wrote: > for pete's sake use the comparison operator like god intended. > > if 0 <= i <= 1: I'm assuming you used Python's compound comparison as opposed to the C-style of and'ing two comparisons together to emphasize the fact it is god's chosen way of doing this ;-) -- htt

Re: Coding style

2006-07-17 Thread Carl Banks
Patrick Maupin wrote: > PTY wrote: > > > It looks like there are two crowds, terse and verbose. I thought terse > > is perl style and verbose is python style. BTW, lst = [] was not what > > I was interested in :-) I was asking whether it was better style to > > use len() or not. > > It's not ca

Re: Coding style

2006-07-17 Thread Carl Banks
PTY wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop() I'm going to go against general opinion and suggest using "len(lst)>0", though this is not a good example of why I think that. In practice, I'd say the former is less gen

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-17 Thread John Machin
On 18/07/2006 1:45 PM, [EMAIL PROTECTED] wrote: >> Let's try reductio ad adsurdum on that one. Suppose that instead of >> filling in a malloced chunk of memory, you had stored those gizmoids in >> local variables foo0, foo1, foo2, etc. Using your reasoning: we can't >> ever return from our function

win32com.client.Dispatch - understanding error messages

2006-07-17 Thread mirandacascade
O/S : Win2K vsn of Python: 2.4 Hoping to find information that provide information about error messages being encountered. Pythonwin session: >>> import win32com.client >>> blah = win32com.client.Dispatch('MSXML2.XMLHTTP') >>> blah.open("POST", "12.5.81.49/crg_cbsil_vtest_52/crg.aspx", 0) Traceb

Matplotlib and mouse events

2006-07-17 Thread Tommy Grav
I am trying to use matplotlib to display two images and then by mouse clickidentify a source in each image. The setup is as follows    figim = figure(figsize=(8,4))    axsrc24 = figim.add_subplot(121, xlim=(0,200), ylim=(0,200), autoscale_on=False)    axsrc24.set_title('Click to zoom')    axsrc70 =

Re: range() is not the best way to check range?

2006-07-17 Thread Grant Edwards
On 2006-07-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > it seems that range() can be really slow: > > the following program will run, and the last line shows how long it ran > for: > > import time > > startTime = time.time() > > a = 1.0 > for i in range(0, 3): > if i in range (0, 100

Re: Track keyboard and mouse usage

2006-07-17 Thread dfaber
Is there no clean method of accessing the keyboard device or the mouse on linux? It seems that looking at /proc/interrupts might prove to be useful for keyboard monitoring. What about checking if the left mouse button is clicked or finding the position of the cursor on the screen? -- http://mail.

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-17 Thread [EMAIL PROTECTED]
> if you use malloc to allocate a memory block and store PyObject pointers > in it, you must > > 1) make sure that the reference count is *incremented* (Py_INCREF) when > you add the objects (unless the object is new; when you create an > object, the reference count is set to 1). this tells Pytho

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-17 Thread [EMAIL PROTECTED]
> Let's try reductio ad adsurdum on that one. Suppose that instead of > filling in a malloced chunk of memory, you had stored those gizmoids in > local variables foo0, foo1, foo2, etc. Using your reasoning: we can't > ever return from our function (which frees up the stack memory > containing foo0

Re: Track keyboard and mouse usage

2006-07-17 Thread skip
MCI> Look PyHook ( http://cheeseshop.python.org/pypi/pyHook/1.4 ) MCI> Ooooh!!! Sorry! It's for Windows... That's okay (well, for me anyway). Watch runs on Windows. Perhaps someone with Windows would like to plug pyHook into watch? Skip -- http://mail.python.org/mailman/listinfo/

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
John Machin wrote: > Perhaps you should, if you profess an interest in hashed lookup -- it > gives some interesting commentary on the second aspect: collision > handling. What matters is the *total* time to return an answer. > Time or algorithm complexity is merely one aspect of a hash function des

RFC: my iterthreader module

2006-07-17 Thread Justin Azoff
I have this iterthreader module that I've been working on for a while now. It is similar to itertools.imap, but it calls each function in its own thread and uses Queues for moving the data around. A better name for it would probably be ithreadmap, but anyway... The short explanation of it is if

Re: range() is not the best way to check range?

2006-07-17 Thread K.S.Sreeram
[EMAIL PROTECTED] wrote: > so if i change the line > if i in range (0, 1): > to > if i >= 0 and i < 1: [snip;] > is there an alternative use of range() or something similar that can > be as fast? you've found that alternative yourself! just use the comparison operators... in fact

Re: range() is not the best way to check range?

2006-07-17 Thread John Machin
On 18/07/2006 12:41 PM, [EMAIL PROTECTED] wrote: > it seems that range() can be really slow: > > the following program will run, and the last line shows how long it ran > for: > > import time > > startTime = time.time() > > a = 1.0 > for i in range(0, 3): > if i in range (0, 1): >

Re: range() is not the best way to check range?

2006-07-17 Thread Dan Bishop
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > > or is there an alternative use of range() or something similar that can > > be as fast? > > You could use xrange: > > [EMAIL PROTECTED]:~$ python -m timeit -n1 "1 in range(1)" > 1 loops, best of 3: 260 usec per loop > [EMAIL PROTECTED]

Re: question about what lamda does

2006-07-17 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > Hey there, > i have been learning python for the past few months, but i can seem to > get what exactly a lamda is for. It defines a function. f = lambda x, y: expression is equivalent to def f(x, y): return expression Note that lambda is an expression while def is

Re: range() is not the best way to check range?

2006-07-17 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > or is there an alternative use of range() or something similar that can > be as fast? You could use xrange: [EMAIL PROTECTED]:~$ python -m timeit -n1 "1 in range(1)" 1 loops, best of 3: 260 usec per loop [EMAIL PROTECTED]:~$ python -m timeit -n1 "1 in xr

Re: using capicom with python

2006-07-17 Thread Roger Upole
"stéphane bard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > Has anyone ever used Python to work with Certificate Services in > Windows? I'm trying to capicom dll with pywin32. > > > I've found some reference about python and capicom in > this mail archive > http://mail.p

Re: range() is not the best way to check range?

2006-07-17 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > it seems that range() can be really slow: ... > if i in range (0, 1): This creates a 10,000-element list and sequentially searches it. Of course that's gonna be slow. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any pyChart experts lend a hand?

2006-07-17 Thread Bryan
[EMAIL PROTECTED] wrote: > Code > > from pychart import * > import sys > theme.get_options() > > theme.use_color = True > theme.output_format="png" > theme.output_file="C:\Comp\graphic\pic1.png" > theme.reinitialize() > > data = [("foo", 10),("

python script reading special keys like , etc.

2006-07-17 Thread malahal
I am planning to write a very simple python script that displays files based on user input. E.g. I need to display f1.msg file if the user presses key, f2.msg file if the user presses key. What is the easiest way to do this on Linux (xterm/vt100/asni etc). I tried using curses and it works, but

Re: Coding style

2006-07-17 Thread Patrick Maupin
PTY wrote: > It looks like there are two crowds, terse and verbose. I thought terse > is perl style and verbose is python style. BTW, lst = [] was not what > I was interested in :-) I was asking whether it was better style to > use len() or not. It's not canonical Python to use len() in this c

range() is not the best way to check range?

2006-07-17 Thread Summercoolness
it seems that range() can be really slow: the following program will run, and the last line shows how long it ran for: import time startTime = time.time() a = 1.0 for i in range(0, 3): if i in range (0, 1): a += 1 if not i % 1000: print i print a, " ", round(time.time

Re: What is a type error? [correction]

2006-07-17 Thread David Hopwood
Darren New wrote: > David Hopwood wrote: > >> public class LoopInitTest { >> public static String getString() { return "foo"; } >> >> public static void main(String[] args) { >> String line = getString(); >> boolean is_last = false; >> >> while (!is_last) { >>

Re: execute a shell script from a python script

2006-07-17 Thread Simon Forman
spec wrote: > Thanks, actually there are no args, is there something even simpler? > > Thanks > Frank you could try os.system() >From the docs: system(command) Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limi

Re: solving equation system

2006-07-17 Thread Carl Banks
TG wrote: > Sorry for the poor explanation. I'm trying to put it clear now. > > i've got A and B. I'm looking for X. I made a mistake in my equation > :-/ > > It's more like : > > A.X - B >= O > > Well, maybe it will be much more simple if I explain the underlying > problem : > > I have an array of

embedding python in a plugin

2006-07-17 Thread Roger Edberg
Hi, I'm developing a linux plugin to a CG package that embeds a Python interpreter. The plugin.so requires a companion plugin.sog file in its directory to allow module imports; imports fail without the .sog file. Can somebody please explain what the .sog file does and why it is needed? I can't fi

Re: Coding style

2006-07-17 Thread Erik Max Francis
tac-tics wrote: > I'm well aware that both of these snippets does the same thing. I'm > just spouting my opinion that lists and integers are not tests, ... No, but testing their Boolean nature _is_ a test. Aggregate objects in Python are true if they are non-empty, and false if they are empty.

Piping external commands

2006-07-17 Thread saibotorama
What is the Python translation for this Bash statement: tar cf - "[EMAIL PROTECTED]" | bzip2 > "$file".tar.bz2 (Ignoring the fact that "tar cjf" also exists...) In other words, how does one pipe together arbitrary commands? -- http://mail.python.org/mailman/listinfo/python-list

Re: run a string as code?

2006-07-17 Thread Gary Herron
py_genetic wrote: > py_genetic wrote: > >> [EMAIL PROTECTED] wrote: >> >>> py_genetic wrote: >>> How can you make python interpret a string (of py code) as code. For example if you want a py program to modify itself as it runs. I know this is an advantage of interpre

Re: execute a shell script from a python script

2006-07-17 Thread John McMonagle
On Mon, 2006-07-17 at 16:59 -0700, spec wrote: > Thanks, actually there are no args, is there something even simpler? > > Thanks > Frank > > > Thomas Nelson wrote: > > If your script is foo.sh and takes args: > > import subprocess > > subprocess.call(["foo.sh","args"],shell=True) > > Should work

Re: Coding style

2006-07-17 Thread tac-tics
dwelch91 wrote: > tac-tics wrote: > > > > I'd say the second one. Empty lists are not false. They are empty. Long > > live dedicated boolean data types. > > > Uh, no, empty lists are False in a boolean context: > > http://docs.python.org/lib/truth.html > > -Don Perhaps I should have specified it

Python 2.5b2 Windows binaries

2006-07-17 Thread Giovanni Bajo
Hello, since I tested Python 2.5b2 on my applications, I have rebuilt some extension modules I needed. It wasn't a very simple or fast task, so I thought I'd share the result of the efforts: http://www.develer.com/oss/Py25Bins this page contains the Windows binaries (installers) for the followin

Re: New SourceForge project: Diet Python!!!

2006-07-17 Thread Paul Rubin
"The Eternal Squire" <[EMAIL PROTECTED]> writes: > Diet Python is a flavor of Python with allegro, multiarray, umath, > calldll, npstruct and curses builtin, all else nonessential to language > ripped out. Total size < 3MB, 1% of PSF Python. Diet Python helps keep > clients thin :) PSF Python is 3

question about what lamda does

2006-07-17 Thread nephish
Hey there, i have been learning python for the past few months, but i can seem to get what exactly a lamda is for. What would i use a lamda for that i could not or would not use a def for ? Is there a notable difference ? I only ask because i see it in code samples on the internet and in books. th

New SourceForge project: Diet Python!!!

2006-07-17 Thread The Eternal Squire
Diet Python is a flavor of Python with allegro, multiarray, umath, calldll, npstruct and curses builtin, all else nonessential to language ripped out. Total size < 3MB, 1% of PSF Python. Diet Python helps keep clients thin :) You'll find it in http://sourceforge.net/projects/dietpython -- http:/

Re: execute a shell script from a python script

2006-07-17 Thread spec
Thanks, actually there are no args, is there something even simpler? Thanks Frank Thomas Nelson wrote: > If your script is foo.sh and takes args: > import subprocess > subprocess.call(["foo.sh","args"],shell=True) > Should work fine. check out > http://www.python.org/dev/doc/maint24/lib/module-

Re: How to lock files (the easiest/best way)?

2006-07-17 Thread Carl Banks
Carl J. Van Arsdall wrote: > [EMAIL PROTECTED] wrote: > > > > f = open("/path/to/data/directory/lockfile","r") > > try: > > fcntl.flock(f.fileno(),fcntl.LOCK_EX) > > ...access data freely here... > > finally: > > f.close() > > > > Closing the file should release the lock (unless you ha

Re: run a string as code?

2006-07-17 Thread py_genetic
py_genetic wrote: > [EMAIL PROTECTED] wrote: > > py_genetic wrote: > > > How can you make python interpret a string (of py code) as code. For > > > example if you want a py program to modify itself as it runs. I know > > > this is an advantage of interpreted languages, how is this done in > > >

Re: run a string as code?

2006-07-17 Thread py_genetic
[EMAIL PROTECTED] wrote: > py_genetic wrote: > > How can you make python interpret a string (of py code) as code. For > > example if you want a py program to modify itself as it runs. I know > > this is an advantage of interpreted languages, how is this done in > > python. Thanks. > > This migh

Re: urllib (in thread) never returns

2006-07-17 Thread Rene Pijlman
Kingsley: >it just sits in either the urlopen() or read() forever. [...] >I would have thought that some urllib-internal timeout >would fix this?! Yes, but you'll need to enable it. See socket.setdefaulttimeout() : http://docs.python.org/lib/module-socket.html -- René Pijlman -- http://mail.py

Re: use var to form name of object

2006-07-17 Thread gel
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, gel wrote: > > > Yeah I am still getting my head around things... not exactly sure what > > you where saying about the globals, but this works > > > > > > global k > > k = 5 > > class foo: > > > > def wow(self, n): > >

Re: run a string as code?

2006-07-17 Thread [EMAIL PROTECTED]
py_genetic wrote: > How can you make python interpret a string (of py code) as code. For > example if you want a py program to modify itself as it runs. I know > this is an advantage of interpreted languages, how is this done in > python. Thanks. This might do it... >>> print eval.__doc__ eval

run a string as code?

2006-07-17 Thread py_genetic
How can you make python interpret a string (of py code) as code. For example if you want a py program to modify itself as it runs. I know this is an advantage of interpreted languages, how is this done in python. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: General Hash Functions In Python

2006-07-17 Thread John Machin
On 17/07/2006 10:13 PM, Arash Partow wrote: > John Machin wrote: >> Who is likely to bother? In timbot we trust. Have you read the comments >> at the start of Objects/dictobject.c? >> > No I haven't probably wont be anytime soon, Perhaps you should, if you profess an interest in hashed lookup -- i

Re: Tkinter StringVar mystery

2006-07-17 Thread John McMonagle
On Mon, 2006-07-17 at 15:00 -0600, Bob Greschke wrote: > First off I have this class (thanks to whoever came up with this way back > when): > > ## > # BEGIN: class Command > # LIB:Command():2006.110 > #Pass arguments to functions from button presses and menu selections, >

Re: Coding style

2006-07-17 Thread PTY
Bob Greschke wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > PTY wrote: > >> Which is better? > >> > >> lst = [1,2,3,4,5] > >> > >> while lst: > >> lst.pop() > >> > >> OR > >> > >> while len(lst) > 0: > >> lst.pop() > > > > A dozen posts, but nobody has posted the ri

Re: solving equation system

2006-07-17 Thread Carl Banks
TG wrote: > Hi there. > > Anyone knows how to use numpy / scipy in order to solve this ? > > * A is an array of shape (n,) > * X is a positive float number > * B is an array of shape (n,) > * O is an array of shape (n,) containing only zeros. > > A.X - B = O > min(X) > > thanks. Looks like an inco

Re: How to lock files (the easiest/best way)?

2006-07-17 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > >> ith a quick look. >> > > > f = open("/path/to/data/directory/lockfile","r") > try: > fcntl.flock(f.fileno(),fcntl.LOCK_EX) > ...access data freely here... > finally: > f.close() > > Closing the file should release the lock (unless you have a truly > ho

Re: Cool Python Ebooks Site

2006-07-17 Thread John Bokma
[EMAIL PROTECTED] wrote: > If you think a simple script is going to fool adsense then you trully > need to read some books. If it happens a lot, Google will consider it an attempt of click fraud IMO. Doesn't matter if it's really high tech. I have heard too many stories from people who got kick

Re: unicode html

2006-07-17 Thread Damjan
> Hi, I've found lots of material on the net about unicode html > conversions, but still i'm having many problems converting unicode > characters to html entities. Is there any available function to solve > this issue? > As an example I would like to do this kind of conversion: > \uc3B4 => ô '&#%d

Re: unicode html

2006-07-17 Thread Jim
Sybren Stuvel wrote: > Jim enlightened us with: > > Ah, but I cannot change it. It is not my machine and the folks who > > own the machine perceive that the charset line that they use is the > > right one for them. > > Well, _you_ are the one providing the content, aren't you? ? This site has man

Re: solving equation system

2006-07-17 Thread Ben C
On 2006-07-17, TG <[EMAIL PROTECTED]> wrote: > > Ben C wrote: >> On 2006-07-17, TG <[EMAIL PROTECTED]> wrote: >> > Hi there. >> > >> > Anyone knows how to use numpy / scipy in order to solve this ? >> > >> > * A is an array of shape (n,) >> > * X is a positive float number >> > * B is an array of s

Re: How to lock files (the easiest/best way)?

2006-07-17 Thread [EMAIL PROTECTED]
Elmo Mäntynen wrote: > Is there something better than using fnctl? It seems a bit intimidating > with a quick look. Although fcntl is pretty opaque, it's quite easy to use if all you want is a simple exclusive lock for all your data. The thing to keep in mind is, you don't have to lock every file

Re: What is a type error?

2006-07-17 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > Yes, these *performance* issues make assignment prohibitive for > real-world use, at least if we are talking about data management > in the large. This is not the same thing as saying the resulting > language is a toy language, though; its semantics are quite >

Re: Coding style

2006-07-17 Thread Bob Greschke
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PTY wrote: >> Which is better? >> >> lst = [1,2,3,4,5] >> >> while lst: >> lst.pop() >> >> OR >> >> while len(lst) > 0: >> lst.pop() > > A dozen posts, but nobody has posted the right > answer yet, so I will :-) > > It doesn't matt

Re: Coding style

2006-07-17 Thread Erik Max Francis
Donn Cave wrote: > Tac-tics is right, an empty list is not False. But that's not what he said. He said it was "not false." That's wrong. It's false. It's just not False. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM

Re: Help!

2006-07-17 Thread Daniel Nogradi
> I have a problem with python. When I try to connect to > postgresql. It appears a message. > > ]$ python > > >>> from pg import DB > Traceback (most recent call last): > >File "", line 1, sn? > > ImportError:

Re: Coding style

2006-07-17 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > tac-tics wrote: ... >> I'd say the second one. Empty lists are not false. They are empty. >> Long live dedicated boolean data types. > Take them off to where they belong! Tac-tics is right, an empty list is not False. Any

Free Advertisement!

2006-07-17 Thread Dan2837
www.get-free-advertisement.com www.have-bad-credit.com -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-17 Thread Marshall
Chris Smith wrote: > Marshall <[EMAIL PROTECTED]> wrote: > > > If the relations are to > > > be considered opaque, then there's clearly no aliasing going on. > > > > Not certain I understand, but I think I agree. > > My condition, though, was that relations be opaque. Since you will be > violating

Tkinter StringVar mystery

2006-07-17 Thread Bob Greschke
First off I have this class (thanks to whoever came up with this way back when): ## # BEGIN: class Command # LIB:Command():2006.110 #Pass arguments to functions from button presses and menu selections, #bind's. Nice! #In your declaration: #...command = Com

Re: Track keyboard and mouse usage

2006-07-17 Thread Diez B. Roggisch
dfaber schrieb: > So, how would I access /dev/input/ devices? > Can I just 'cat' them or read in those files? Yes, just read them. Which is what cat does, btw. If you cat your keyboard, you should see garbage appearing in the terminal when you type any key. Same is true for the mouse. Diez --

Re: Track keyboard and mouse usage

2006-07-17 Thread dfaber
So, how would I access /dev/input/ devices? Can I just 'cat' them or read in those files? Diez B. Roggisch wrote: > [EMAIL PROTECTED] schrieb: > > Diez> You could use the /dev/input/event* devices. > > > > On the only Linux system I have available (Mojam's CentOS-based web server), > > /dev/i

Help!

2006-07-17 Thread Felipe de Jesús Pozos Téxon
Hi, my name’s felipe       I have a problem with python. When I try to connect to postgresql. It appears a message.    ]$ python     >>> from pg import DB       Traceback (most recent call last):        File "", line 1, sn?  

Re: execute a shell script from a python script

2006-07-17 Thread Thomas Nelson
If your script is foo.sh and takes args: import subprocess subprocess.call(["foo.sh","args"],shell=True) Should work fine. check out http://www.python.org/dev/doc/maint24/lib/module-subprocess.html Enjoy, THN spec wrote: > Hi all, I know nothing about Python. What I need to do is to get a > Pyth

XMLRPC Solution Code

2006-07-17 Thread dylpkls91
[EMAIL PROTECTED] wrote: > Mind posting it for us lesser beings? ;) Not at all. I have yet to test it on networked computers, but it works fine when I run both scripts on my machine. The hard part now is getting the server code to run as a Windows service- argh!!! I can get it installed and start

Re: Track keyboard and mouse usage

2006-07-17 Thread dfaber
So, how would I access /dev/input/ devices? Can I just 'cat' them or read in those files? Diez B. Roggisch wrote: > [EMAIL PROTECTED] schrieb: > > Diez> You could use the /dev/input/event* devices. > > > > On the only Linux system I have available (Mojam's CentOS-based web server), > > /dev/i

Re: Coding style

2006-07-17 Thread rurpy
PTY wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop() A dozen posts, but nobody has posted the right answer yet, so I will :-) It doesn't matter -- use whichever you prefer (*) This is an angels on the head of a pin issue. (

Python Developer required for a 6 months contract

2006-07-17 Thread Rakesh Thakrar
My client based in the South West is looking for a Python Developer to join an existing project team for a 6-month contract. Suitable candidates will have commercial experience programming with Python and knowledge of Software Design Architecture. Ideally you will have Knowledge of QT, GTK, KDE or

Re: Track keyboard and mouse usage

2006-07-17 Thread M�ta-MCI
Hi! Look PyHook ( http://cheeseshop.python.org/pypi/pyHook/1.4 ) Ooooh!!! Sorry! It's for Windows... -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for Embedded Systems?

2006-07-17 Thread Petr Jakeš
J> Is there a Python packaging that is specifically for J> embedded systems? ie, very small and configurable so the J> user gets to select what modules to install? J> For Linux-based embedded systems in particular? J> I'm thinking of running it on the Linksys's Linux-based open J> source router W

Re: Track keyboard and mouse usage

2006-07-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Diez> You could use the /dev/input/event* devices. > > On the only Linux system I have available (Mojam's CentOS-based web server), > /dev/input/* are readable only by root. That doesn't seem like it would be > very useful to tools like watch unless they were to r

Re: Problem with sub-classing

2006-07-17 Thread Peter Otten
Bernard Lebel wrote: > Okay, that make sense. > > Now the question is: regarding the re-binding behavior, is this > actually problematic? By that I mean that is it good coding practice > to avoid this issue altogether as much as possible, or is it okay to > live with it if you use the __init__ ar

Re: What is a type error? [correction]

2006-07-17 Thread Darren New
Darren New wrote: > Now, if the "insert line into inputs" actually unset "line", then yes, > you're right, Hermes would complain about this. Oh, I see. You translated from Hermes into Java, and Java doesn't have the "insert into" statement. Indeed, the line you commented out is *exactly* what's

Re: Track keyboard and mouse usage

2006-07-17 Thread skip
Diez> You could use the /dev/input/event* devices. On the only Linux system I have available (Mojam's CentOS-based web server), /dev/input/* are readable only by root. That doesn't seem like it would be very useful to tools like watch unless they were to run suid to root (creating other prob

execute a shell script from a python script

2006-07-17 Thread spec
Hi all, I know nothing about Python. What I need to do is to get a Python script to execute a local shell script. I do not need any output. What would be th eeasiest way to accomplish this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on RedHat AS 2.1?

2006-07-17 Thread Jeremy Winters
All the stuff I've found personally are security patches for python 1.5.2... which seems to be baked into the OS.I don't choose to use this OS... it is mandated by our IT dept.  I have no complaints other than this...Is there nobody in pythonland who has installed python 2.2 or higher on th

Re: Coding style

2006-07-17 Thread Roger Miller
Peter Otten wrote: > Steve Holden wrote: > > > I'll bet you still write > > > > if a>3 == True: > > > > don't you ;-) > > I'll second that. > > if (a>3) == True: > > is the correct way :-) > > Peter No, to be consistent you'll have to write if ((a>3) == True) == True: Oops, I mean, if (((

Re: how to know if socket is still connected

2006-07-17 Thread nephish
ok, yeah, thats in my book. thanks, and no, it isn't enabled. thanks again for everything -sk Grant Edwards wrote: > On 2006-07-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> If the server _application_ crashes or exits, then the OS will > >> close the socket and recv() will return "". If

Re: What is a type error? [correction]

2006-07-17 Thread Darren New
David Hopwood wrote: > > public class LoopInitTest { > public static String getString() { return "foo"; } > > public static void main(String[] args) { > String line = getString(); > boolean is_last = false; > > while (!is_last) { > if (line.charAt(0) =

Re: unicode html

2006-07-17 Thread Jim
Sybren Stuvel wrote: > Jim enlightened us with: > > For example, I am programming a script that makes html pages, but I > > do not have the ability to change the "Content-Type .. charset=.." > > line that is sent preceeding those pages. > > "line"? Are you talking about the HTTP header? If it is wr

  1   2   3   >