Re: Dynamic text color

2010-01-03 Thread Dave McCormick
John, Interesting and confusing... I tested my code on Ubuntu 8.04, Win XP and 7, and WinMob before I called it "good". And of course your modifications work on all too. """ * rename get_position() to get_complete_text() * replace new_Rword(), new_Bword(), and new_Gword() with a single functi

What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread vsoler
Hi, Not sure this is the best group to post, but I cannot think of any other. My application would contain a limited set of "cells" represented by the instances of a Cell class: class Cell: ... A1=Cell(7) A2=Cell(2*A1) A3=Cell(3*A1+A2) A4=Cell(A3*4) Of course, A1 = 7, A2 = 14, A3 = 35 and A4 =

Re: Windows 7 : any problems installing or running Python ?

2010-01-03 Thread python
David, Try disabling your firewall software momentarily to see if that makes a difference. IDLE uses a local port for inter-process communication - you may need to configure your firewall to allow IDLE's port usage. To test whether Python itself has been properly installed, open up a cmd prompt,

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread Steven D'Aprano
On Sun, 03 Jan 2010 03:27:46 -0800, vsoler wrote: > My application would contain a limited set of "cells" represented by the > instances of a Cell class: > > class Cell: > ... > > A1=Cell(7) > A2=Cell(2*A1) > A3=Cell(3*A1+A2) > A4=Cell(A3*4) > > Of course, A1 = 7, A2 = 14, A3 = 35 and A4 = 140

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread vsoler
On Jan 3, 1:28 pm, Steven D'Aprano wrote: > On Sun, 03 Jan 2010 03:27:46 -0800, vsoler wrote: > > My application would contain a limited set of "cells" represented by the > > instances of a Cell class: > > > class Cell: > > ... > > > A1=Cell(7) > > A2=Cell(2*A1) > > A3=Cell(3*A1+A2) > > A4=Cell(A3

Re: Trying to run a sudo command from script

2010-01-03 Thread Kent Tenney
On Fri, Jan 1, 2010 at 5:08 PM, Diez B. Roggisch wrote: > Kent Tenney schrieb: >> >> Howdy, >> >> A script running as a regular user sometimes wants >> to run sudo commands. >> >> It gets the password with getpass. >> pw = getpass.getpass() >> >> I've fiddled a bunch with stuff like >> proc = subp

HAppy New Year

2010-01-03 Thread baboucarr sanneh
Hi guys, Jus want to wish you a happy new year to u all.. 1.Copy the content below and Paste it on a Notepad.2 . Use replace all (Ctrl + H)3. Type in ‘6’ in the ‘find what’ column 4. Type in _ (underscore) in the ‘replace with’ column 5. Click on replace all. 66

Re: Dynamic text color

2010-01-03 Thread Cousin Stanley
> John Posner wrote > > I've posted a complete solution > > http://cl1p.net/jjp_dynamic_text_color/. John Thanks for posting your solution to Dave McCormick's query about colorizing text I was not familiar with the re.finditer method for search

Re: Dangerous behavior of list(generator)

2010-01-03 Thread Steven D'Aprano
On Wed, 30 Dec 2009 23:20:06 -0500, Benjamin Kaplan wrote: >>> I used to have that a lot in cases where not finding at least one >>> valid foo is an actual fatal error. >> >> What's wrong with the obvious solution? >> >> if not any(foo for foo in foos if foo.bar): >>    raise ValueError('need at l

Re: Bare Excepts

2010-01-03 Thread myle
Why we should prefer ``if: ...'' over a ``try: ... except something: pass'' block? In http://wiki.python.org/moin/PythonSpeed/PerformanceTips#InitializingDictionaryElements it is stated that a try catch block is faster if more often no exception occurs. Happy new year, Dimitris Leventeas -- htt

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2010-01-03 Thread garyrob
One thing I'm not clear on regarding Klauss' patch. He says it's applicable where the data is primarily non-numeric. In trying to understand why that would be the case, I'm thinking that the increased per-object memory overhead for reference-counting would outweigh the space gains from the shared m

Re: Significant whitespace

2010-01-03 Thread John Machin
On Jan 2, 10:29 am, Roy Smith wrote: > > To address your question more directly, here's a couple of ways Fortran > treated whitespace which would surprise the current crop of > Java/PHP/Python/Ruby programmers: > > 1) Line numbers (i.e. the things you could GOTO to) were in column 2-7 > (column 1

Re: Significant whitespace

2010-01-03 Thread Mensanator
On Jan 1, 4:02�pm, Dan Stromberg wrote: > I put together a page about significant whitespace (and the lack thereof). The real problem is your use of proportional spaced fonts. > > You're invited to check it out: > > http://stromberg.dnsalias.org/~dstromberg/significant-whitespace.html -- http:

International Journal of Electronics, Information and Systems (IJEIS) Call for Paper

2010-01-03 Thread ijeiseditor
The International Journal of Electronics, Information and Systems (IJEIS) publish original papers on all subjects relevant to electronics, computer science, communication network, and information systems. The highest priority will be given to those contributions concerned with a discussion of the b

Re: detect interactivity

2010-01-03 Thread Lie Ryan
On 12/30/2009 11:25 PM, Roald de Vries wrote: Actually, performance is not much if an issue for what I want to do; it's mainly interest in 'how should I do this in general'. I'll just leave in all the code, and if it becomes a real issue, I'll separate the code over an interactive and a non-inter

Re: Safe file I/O to shared file (or SQLite) from multi-threaded web server

2010-01-03 Thread Steve Holden
John Nagle wrote: > pyt...@bdurham.com wrote: >> I'm looking for the best practice way for a multi-threaded python web >> server application to read/write to a shared file or a SQLite database. >> >> What do I need to do (if anything) to make sure my writes to a regular >> file on disk or to a SQLi

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread Lie Ryan
On 1/3/2010 10:27 PM, vsoler wrote: 1) what are, in your opinion, the basic elements of the Cell class? The "user-entered formula" and "effective value". A Cell containing a formula "abc" has a value of "abc"; a cell containing the formula "=1+5" has a value of "6". You could use the 'proper

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread Jon Clements
On Jan 3, 2:58 pm, Lie Ryan wrote: > On 1/3/2010 10:27 PM, vsoler wrote: > > > 1) what are, in your opinion, the basic elements of the Cell class? > > The "user-entered formula" and "effective value". A Cell containing a > formula "abc" has a value of "abc"; a cell containing the formula "=1+5" >

Re: Any Swisses here?

2010-01-03 Thread Jack Diederich
On Sat, Jan 2, 2010 at 10:38 PM, n00m wrote: > On Jan 3, 5:30 am, Steve Holden wrote: >> Zhu Sha Zang wrote: >> >> [stuff and nonsense from a third party] >> > WTF? >> >> We do get the occasional bigot dropping in from time to time. Best to >> ignore them 'til they go away. >> > And who are YOU?

Re: twenty years ago Guido created Python

2010-01-03 Thread Chris Jones
On Thu, Dec 31, 2009 at 05:06:24PM EST, Steve Howell wrote: > FYI: > > http://twitter.com/gvanrossum > > Python is a truly awesome programming language. Not only is Guido a > genius language designer, but he is also a great project leader. What > an accomplishment. Congratulations to everybod

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread MRAB
vsoler wrote: Hi, Not sure this is the best group to post, but I cannot think of any other. My application would contain a limited set of "cells" represented by the instances of a Cell class: class Cell: ... A1=Cell(7) A2=Cell(2*A1) A3=Cell(3*A1+A2) A4=Cell(A3*4) Of course, A1 = 7, A2 = 14,

Re: HAppy New Year

2010-01-03 Thread Dotan Cohen
2010/1/2 baboucarr sanneh : > Hi guys, > > Jus want to wish you a happy new year to u all.. > > 1.Copy the content below and Paste it on a Notepad. > 2 . Use replace all (Ctrl + H) > 3. Type in ‘6’ in the ‘find what’ column > > 4.   Type in _ (underscore) in the ‘replace with’ column > > 5.   Click

Re: HAppy New Year

2010-01-03 Thread Steve Holden
Dotan Cohen wrote: > 2010/1/2 baboucarr sanneh : >> Hi guys, >> >> Jus want to wish you a happy new year to u all.. >> >> 1.Copy the content below and Paste it on a Notepad. >> 2 . Use replace all (Ctrl + H) >> 3. Type in ‘6’ in the ‘find what’ column >> >> 4. Type in _ (underscore) in the ‘repla

Re: HAppy New Year

2010-01-03 Thread Dotan Cohen
> What I want to know is why didn't he just write > > """\ > ... original long string ... > """.replace("6", "_") > Uf! Why didn't I think of that?! > But watch that snarkiness ... I'm a Windows user too! > That's fine, I know that fresh air has to get into the basement somehow ! -- Dotan Coh

[gtk+thread] Why worker thread never wakes from time.sleep()?

2010-01-03 Thread Dmitry Teslenko
Hello! I have simple gui gtk app. It has worker thread that populates list with strings and gtk window with main loop which pops strings from this list and shows them in TreeView. Thread runs get_data_from_pcap to populate list with strings. Gtk app calls update_store() with gobject.timeout_add ev

Re: twenty years ago Guido created Python

2010-01-03 Thread Ben Finney
Chris Jones writes: > Interesting to note that Guido's achievements prompt much less > response, and get much less coverage […] The entirety of ‘comp.lang.python’ is an ongoing response to Guido van Rossum's achievements (and all the others that make Python great). Mere week- or month-long threa

Re: HAppy New Year

2010-01-03 Thread D'Arcy J.M. Cain
On Sun, 3 Jan 2010 21:18:38 +0200 Dotan Cohen wrote: > Wow, I just love Windows users. Sending this to the Python list? Paste I was going to ask him if his mommy and daddy knew that he was playing with the grown-ups' computer. -- D'Arcy J.M. Cain | Democracy is three wolves http://www

Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread mdipierro
Perhaps this can be useful: http://www.web2py.com/examples/spreadsheet The code is in a single file with not dependencies and it does not require web2py to run: http://code.google.com/p/web2py/source/browse/gluon/contrib/spreadsheet.py Here is a sample controller that shows you how to embed the s

Re: Exception as the primary error handling mechanism?

2010-01-03 Thread Michi
On Jan 1, 2:47 pm, Peng Yu wrote: > > In the article API Design Matters by Michi Henning > > Communications of the ACM > Vol. 52 No. 5, Pages 46-56 > 10.1145/1506409.1506424http://cacm.acm.org/magazines/2009/5/24646-api-design-matters/fulltext > > It says "Another popular design flaw—namely, throw

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread cassiope
On Jan 2, 3:46 pm, Steve Holden wrote: > cassiope wrote: > > I have a daemon on a Linux system that supports a number of Windows > > clients.  Among the functions is to send e-mails, which is > > sufficiently complicated that I fork() a separate process which gets > > setuid to a lesser user, and

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread cassiope
On Jan 2, 6:40 pm, Christian Heimes wrote: > cassiope wrote: > > The strange thing is that even with the right user-id, I cannot seem > > to write to the directory, getting an IOError exception.  Changing the > > directory to world-writable fixes this.  I can confirm the uid and gid > > for the sc

Re: Set variables based on dictionary

2010-01-03 Thread Peter Otten
Joan Miller wrote: > How to set local variables based on dictionary contents? >>> def f(**d): ... for k, v in d.iteritems(): exec "%s = v" % k ... return locals() ... >>> f(a=42, b="yadda") {'a': 42, 'k': 'b', 'b': 'yadda', 'd': {'a': 42, 'b': 'yadda'}, 'v': 'yadda'} >>> f(**{"print 'war

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread Steve Holden
cassiope wrote: > On Jan 2, 6:40 pm, Christian Heimes wrote: >> cassiope wrote: >>> The strange thing is that even with the right user-id, I cannot seem >>> to write to the directory, getting an IOError exception. Changing the >>> directory to world-writable fixes this. I can confirm the uid and

Re: twenty years ago Guido created Python

2010-01-03 Thread Chris Jones
On Sun, Jan 03, 2010 at 04:19:02PM EST, Ben Finney wrote: > Chris Jones writes: > > Interesting to note that Guido's achievements prompt much less > > response, and get much less coverage […] > > The entirety of ‘comp.lang.python’ is an ongoing response to Guido van > Rossum's achievements (and

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread cassiope
On Jan 2, 8:02 pm, Cameron Simpson wrote: > On 02Jan2010 15:21, cassiope wrote: > | [...]  I want > | to save a copy of the email in a particular directory which is > | accessible to the Windows clients via samba. > | > | The strange thing is that even with the right user-id, I cannot seem > | to

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread Cameron Simpson
On 03Jan2010 14:20, cassiope wrote: | On Jan 2, 8:02 pm, Cameron Simpson wrote: | > Can you show us: | >   - the directory user and group ownership and permissions | >   - the daemon's user and group values? | | Directory permissions: 774 That's unusual - why the "4"? Directories with read but

Re: Exception as the primary error handling mechanism?

2010-01-03 Thread MRAB
Michi wrote: On Jan 1, 2:47 pm, Peng Yu wrote: In the article API Design Matters by Michi Henning Communications of the ACM Vol. 52 No. 5, Pages 46-56 10.1145/1506409.1506424http://cacm.acm.org/magazines/2009/5/24646-api-design-matters/fulltext It says "Another popular design flaw—namely, thr

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread cassiope
On Jan 3, 3:00 pm, Cameron Simpson wrote: > On 03Jan2010 14:20, cassiope wrote: > | On Jan 2, 8:02 pm, Cameron Simpson wrote: > | > Can you show us: > | >   - the directory user and group ownership and permissions > | >   - the daemon's user and group values? > | > | Directory permissions: 774 >

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread Cameron Simpson
On 03Jan2010 15:56, cassiope wrote: | Strace confirms the uid and gid == "lesser user". Changing the | directory | permissions to 775 changes nothing. Clearly get EACCES error on the | attempted | file creation. | | The only other thing is that as part of the python interpreter call, I | provid

Re: Significant whitespace

2010-01-03 Thread Tim Roberts
Roy Smith wrote: > >2) Whitespace was not required in many places. For example, the following >two statements (this will only make sense in a fixed-width font) are >identical: > > DO 10 I = 1, 10 > DO10I=1,10 More than "not required", it was "not relevant". This led to one of the

Re: DST and datetime

2010-01-03 Thread Lawrence D'Oliveiro
In message <874on82oan@benfinney.id.au>, Ben Finney wrote: > Or you could use the ready-made wheel maintained by others: > > tzinfo Objects > http://docs.python.org/library/datetime.html#tzinfo-objects> But that’s only an abstract base class, which means it doesn’t actually implemen

Re: Safe file I/O to shared file (or SQLite) from multi-threaded web server

2010-01-03 Thread Lawrence D'Oliveiro
In message , Steve Holden wrote: > Yes, but not to MySQL, please. Particularly since there is a sword of > Damocles hanging over its head while the Oracle takeover of Sun is > pending. Ah, I see the FUDsters are crawling out of the woodwork here, as well. I’ve got news for you: MySQL is an open

Re: Safe file I/O to shared file (or SQLite) from multi-threaded web server

2010-01-03 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message , Steve > Holden wrote: > >> Yes, but not to MySQL, please. Particularly since there is a sword of >> Damocles hanging over its head while the Oracle takeover of Sun is >> pending. > > Ah, I see the FUDsters are crawling out of the woodwork here, as well.

python xmlrpc client with ssl client certificates and standard modules

2010-01-03 Thread News123
Hi, I was googling fot quite some time and was not really succesfull. I found one solution, which I will try soon. It is http://www.cs.technion.ac.il/~danken/xmlrpc-ssl.html (found in http://hamakor.org.il/pipermail/python-il/2008-February/29.html ) This will probably work, but it requires t

Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2010-01-03 Thread prakash jp
*#How to use setup.py file with py2exe:* ** python daniesetup.py py2exe --bundle 1 *#Also the data files have to taken care off in the options* list *#Here is a sample setup.py:* *#* from distutils.core import setup import py2exe import sys # n

Re: Significant whitespace

2010-01-03 Thread Roy Smith
In article , Tim Roberts wrote: > Roy Smith wrote: > > > >2) Whitespace was not required in many places. For example, the following > >two statements (this will only make sense in a fixed-width font) are > >identical: > > > > DO 10 I = 1, 10 > > DO10I=1,10 > > More than "not req

Re: twenty years ago Guido created Python

2010-01-03 Thread n00m
i'm sobered up Yes of course Guido and his lang is both superb things -- http://mail.python.org/mailman/listinfo/python-list

Re: twenty years ago Guido created Python

2010-01-03 Thread Ben Finney
Chris Jones writes: > On Sun, Jan 03, 2010 at 04:19:02PM EST, Ben Finney wrote: > > The entirety of ‘comp.lang.python’ is an ongoing response to Guido > > van Rossum's achievements (and all the others that make Python > > great). Mere week- or month-long threads are paltry by comparison. > > That

Re: Any Swisses here?

2010-01-03 Thread n00m
What Imeant by what waht try to solve e.g. http://acm.sgu.ru/problem.php?contest=0&problem=482 99% people here are 0 in this. They know this they know that, but they can't nothing, they simply are sitting on this group and apraised themselves But you can nothing -- http://mail.python.org/mailman/l

Re: Significant whitespace

2010-01-03 Thread David Robinow
On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: > More than "not required", it was "not relevant".  This led to one of the > most infamous programming blunders in the early days of the space program, > when one programmer accidentially typed a period instead of a comma > resulting in the loss o

Re: Exception as the primary error handling mechanism?

2010-01-03 Thread Steven D'Aprano
On Sun, 03 Jan 2010 13:44:29 -0800, Michi wrote: > The quoted sentence appears in a section of the article that deals with > efficiency. I point out in that section that bad APIs often have a price > not just in terms of usability and defect rate, but that they are often > inefficient as well. T

Re: Exception as the primary error handling mechanism?

2010-01-03 Thread Roy Smith
In article , Steven D'Aprano wrote: > This last one can be *very* problematic. In the early 1990s, I was > programming using a callback API that could only return an integer. The > standard way of indicating an error was to return -1. But what happens if > -1 is a legitimate return value, e.g

Re: Significant whitespace

2010-01-03 Thread Roy Smith
In article , David Robinow wrote: > On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: > > More than "not required", it was "not relevant".  This led to one of the > > most infamous programming blunders in the early days of the space program, > > when one programmer accidentially typed a period

Re: Significant whitespace

2010-01-03 Thread David Robinow
On Sun, Jan 3, 2010 at 10:42 PM, Roy Smith wrote: > In article , >  David Robinow wrote: > >> On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: >> > More than "not required", it was "not relevant".  This led to one of the >> > most infamous programming blunders in the early days of the space pr

Re: twenty years ago Guido created Python

2010-01-03 Thread n00m
Now tell me: what ahat this mobs of yellow, africans, asiats, are doing in Stockholm? Do you think your govs let me in just to vist England, Norway? Never. Its all conditionally. But the fact is. IS. You roll our world into abyss of stupidity -- http://mail.python.org/mailman/listinfo/python-list

Question about an application

2010-01-03 Thread rieh25
I am thinking of installing a python webserver I coded in every computer at my work. This would allow me to run specific tasks in them, like creating backups, installing things, etc. Is there another way to run programs in remote computers? Thanks for your opinions. -- View this message in contex

Re: Question about an application

2010-01-03 Thread rodrick brown
Take a look at ssh Sent from my iPhone 3GS. On Jan 4, 2010, at 12:50 AM, rieh25 wrote: I am thinking of installing a python webserver I coded in every computer at my work. This would allow me to run specific tasks in them, like creating backups, installing things, etc. Is there another w

Re: twenty years ago Guido created Python

2010-01-03 Thread r0g
n00m wrote: > Ok, let me evolve a bit my thought. > Guido is Eropean Culture. > Now say what was invented by Japanese, by Chinese? > Nothing. > Barbaric cultures, they are animals inborn animals. > Russian Sikorsky built choppers for Eisenhower. > Look at letter "S" on them -- its his name > What y

Re: Question about an application

2010-01-03 Thread rieh25
Thanks, I had forgotten about it. I'll investigate if there are ways to automate using it to run programs in several computers at the same time. Rodrick Brown wrote: > > Take a look at ssh > > Sent from my iPhone 3GS. > > On Jan 4, 2010, at 12:50 AM, rieh25 wrote: > >> >> I am thinking of i

Re: twenty years ago Guido created Python

2010-01-03 Thread Chris Jones
On Sun, Jan 03, 2010 at 10:18:18PM EST, Ben Finney wrote: > Chris Jones writes: [..] > > Sorry you missed my point. > > I didn't, since I attempted to bring it back on topic by expunging the > off-topic part of your message. Er.. what's 'off-topic' about mentioning that a couple of trolls on

Re: Significant whitespace

2010-01-03 Thread r0g
David Robinow wrote: > On Sun, Jan 3, 2010 at 10:42 PM, Roy Smith wrote: >> In article , >> David Robinow wrote: >> >>> On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: More than "not required", it was "not relevant". This led to one of the most infamous programming blunders in the

Re: Exception as the primary error handling mechanism?

2010-01-03 Thread Steven D'Aprano
On Sun, 03 Jan 2010 22:36:44 -0500, Roy Smith wrote: > In article , > Steven D'Aprano wrote: > >> This last one can be *very* problematic. In the early 1990s, I was >> programming using a callback API that could only return an integer. The >> standard way of indicating an error was to return -1

Re: Significant whitespace

2010-01-03 Thread Steven D'Aprano
On Sun, 03 Jan 2010 23:42:44 -0500, David Robinow wrote: > On Sun, Jan 3, 2010 at 10:42 PM, Roy Smith wrote: >> In article , >>  David Robinow wrote: >> >>> On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: >>> > More than "not required", it was "not relevant".  This led to one of >>> > the mo

Re: Question about an application

2010-01-03 Thread r0g
rieh25 wrote: > Thanks, I had forgotten about it. I'll investigate if there are ways to > automate using it to run programs in several computers at the same time. > > > Rodrick Brown wrote: >> Take a look at ssh >> There are. Take a look at paramiko if you want to interface with SSH within pyth

python mechanize proxy support question

2010-01-03 Thread elca
Hello All Happy New Year! i have some question about python mechanize 's proxy support. im making some web client script, and i would like to insert proxy support function into my script. for example ,if i have such like following some script. how can i add proxy support into my mechanize sc

TypeError: can only concatenate list (not "tuple") to list

2010-01-03 Thread Gabriel Genellina
This py> [1,2,3] + (4,5) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list