Re: Conditional based on whether or not a module is being used

2010-03-09 Thread Vinay Sajip
On Mar 7, 12:34 pm, Steve Holden wrote: > My own impression of theloggingmodule, formed from trying to use its > documentation in the past, is that it's somewhat unapproachable, and > difficult to use for simple purposes. > > I am happy to say that now I see the current (3.1) documentation it has

pyserial script doesnt execute properly

2010-03-09 Thread kishore
hello there Iam using python 2.5.4 pyserial 2.4 pywin32-214 on windows 7 i hav a small test script written to query a serial device (arduino) and get back reply appropriately file: test.py import serial print 'hi' ser=serial.Serial(port='\\.\COM2', baudrate=9600) ser.close() ser.open()

Re: Conditional based on whether or not a module is being used

2010-03-09 Thread Vinay Sajip
On Mar 6, 11:13 pm, Pete Emerson wrote: > > 1) In debug mode, send what would have gone to syslog to STDOUT or > STDERR > 2) In non-debug mode, use /dev/log or localhost:514 depending on what > is set > 3) Allow for multiple levels ofloggingbeyond INFO, WARNING, CRIT ... > essentially allow multip

Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread KLEIN Stéphane
Hi, Today, I've show this static web site generating tools write in ruby : * http://webgen.rubyforge.org/index.html * http://nanoc.stoneship.org/about/ * http://webby.rubyforge.org/tutorial/ I like this tools, I'm wonder if there are similar tools in Python ? I know Sphinx, but this tools is

Re: pyserial script doesnt execute properly

2010-03-09 Thread News123
Hi, kishore wrote: > hello there > > Iam using python 2.5.4 > pyserial 2.4 > pywin32-214 > > on windows 7 > > > i hav a small test script written to query a serial device (arduino) > and get back reply appropriately > > > > file: test.py > > import serial > print 'hi' > ser=serial.Ser

Re: remove element with ElementTree

2010-03-09 Thread Justin Ezequiel
On Mar 9, 11:35 am, tdan wrote: > I have been using ElementTree to write an app, and would like to > simply remove an element. > But in ElementTree, you must know both the parent and the child > element to do this. > There is no getparent() function, so I am stuck if I only have an > element. > s

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread dorzey
On Mar 9, 8:57 am, KLEIN Stéphane wrote: > Hi, > > Today, I've show this static web site generating tools write in ruby : > >  *http://webgen.rubyforge.org/index.html >  *http://nanoc.stoneship.org/about/ >  *http://webby.rubyforge.org/tutorial/ > > I like this tools, I'm wonder if there are simil

Re: Duplicate keys in dict?

2010-03-09 Thread Yinon Ehrlich
On Mar 7, 6:23 pm, vsoler wrote: > Hello, > > My code snippet reads data from excel ranges. First row and first > column are column headers and row headers respectively. After reding > the range I build a dict. > > What is the best approach for this problem? Can anybody help? Have you tried xlrea

odd error

2010-03-09 Thread Alex Hall
Hi all, In the same program I wrote about yesterday, I have a dictionary of keystrokes which are captured. I just tried adding a new one, bringing the total to 11. Here are entries 10 and 11; 10 has been working fine for months. 10 : (57, win32con.MOD_CONTROL), 11 : (99, win32con.MOD_CONTROL |

Re: related lists mean value (golfed)

2010-03-09 Thread Michael Rudolf
Am 09.03.2010 13:02, schrieb Peter Otten: [sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y] [1.5, 1.5, 8.0, 4.0, 4.0, 4.0] Peter ... pwned. Should be the fastest and shortest way to do it. I tried to do something like this, but my brain hurt while trying to visualize list comprehensi

Opportunity to author Python books- Packt Publishing.

2010-03-09 Thread Kshipra Singh
Hi All, I am writing to you for Packt Publishing, the publishers computer related books. We are planning to extend our catalogue of cookbooks and are currently inviting "Python" fanatics interested in writing a cookbook. So, if you love "Python" and are interested in writing a cookbook, please

a newbie's question

2010-03-09 Thread Lan Qing
Hi all, I'm a newbie of python programming language. I have used c/c++ for 5 years, and one year experience in Lua programming language. Can any one give me some advice on learning python. Think you for any help!! best regards!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: (updated) Choosing a collection of common modules/packages for a general purpose reusable PY2EXE runtime

2010-03-09 Thread python
We've decided to build a re-usable *general purpose* PY2EXE "runtime" that can be shared by a number of scripts vs. distributing a monolithic EXE for each of our scripts. A list of the Python 2.6.4 compatible modules/packages we decided to include (and exclude) in our "runtime" follows my signatur

Re: Opportunity to author Python books- Packt Publishing.

2010-03-09 Thread sstein...@gmail.com
On Mar 8, 2010, at 6:25 AM, Kshipra Singh wrote: I would be delighted to write a cookbook on the stuff I use every day: python for administering cloud servers. Thanks, S aka/Steve Steiner aka/ssteinerX > Hi All, > > I am writing to you for Packt Publishing, the publishers computer related

Re: Calculating very large exponents in python

2010-03-09 Thread casevh
On Mar 8, 10:39 pm, casevh wrote: > [also replying to Geremy since the OP's message doesn't appear...] > > On Mar 8, 11:05 am, geremy condra wrote: > > > > > > > On Mon, Mar 8, 2010 at 2:15 AM, Fahad Ahmad wrote: > > > Thanks Geremy, > > > > That has been an absolute bump... GOD i cant s

Re: imported var not being updated

2010-03-09 Thread Bruno Desthuilliers
John Posner a écrit : On 3/8/2010 11:55 PM, Gary Herron wrote: The form of import you are using from helpers import mostRecent makes a *new* binding to the value in the module that's doing the import. What you can do, is not make a separate binding, but reach into the helpers module to ge

Re: imported var not being updated

2010-03-09 Thread John Posner
On 3/8/2010 11:55 PM, Gary Herron wrote: The form of import you are using from helpers import mostRecent makes a *new* binding to the value in the module that's doing the import. What you can do, is not make a separate binding, but reach into the helpers module to get the value there. Like

Re: NoSQL Movement?

2010-03-09 Thread Bruno Desthuilliers
mk a écrit : Bruno Desthuilliers wrote: Well, Zope is backed by an object database rather than a relational one. And it ended up being a *major* PITA on all Zope projects I've worked on... Care to write a few sentences on nature of problems with zodb? I was flirting with the thought of usi

Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 2:19 pm, News123 wrote: > Hi, > > > > kishore wrote: > > hello there > > > Iam using python 2.5.4 > > pyserial  2.4 > > pywin32-214 > > > on windows 7 > > > i hav a small test script written to query a serial device (arduino) > > and get back reply appropriately > > > file: test.py >

Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 8:01 pm, kishore wrote: > On Mar 9, 2:19 pm, News123 wrote: > > > > > Hi, > > > kishore wrote: > > > hello there > > > > Iam using python 2.5.4 > > > pyserial  2.4 > > > pywin32-214 > > > > on windows 7 > > > > i hav a small test script written to query a serial device (arduino) > > > a

Re: imported var not being updated

2010-03-09 Thread Benjamin Kaplan
On Tue, Mar 9, 2010 at 9:18 AM, John Posner wrote: > On 3/8/2010 11:55 PM, Gary Herron wrote: > > > >> The form of import you are using >> from helpers import mostRecent >> makes a *new* binding to the value in the module that's doing the >> import. >> > > > > > What you can do, is not make a

Re: Are there in Python some static web site generating tools like?webgen, nanoc or webby in Ruby ?

2010-03-09 Thread garabik-news-2005-05
KLEIN Stéphane wrote: > Hi, > > Today, I've show this static web site generating tools write in ruby : > > * http://webgen.rubyforge.org/index.html > * http://nanoc.stoneship.org/about/ > * http://webby.rubyforge.org/tutorial/ > > I like this tools, I'm wonder if there are similar tools in Pyth

Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 8:01 pm, kishore wrote: > On Mar 9, 2:19 pm, News123 wrote: > > > > > Hi, > > > kishore wrote: > > > hello there > > > > Iam using python 2.5.4 > > > pyserial  2.4 > > > pywin32-214 > > > > on windows 7 > > > > i hav a small test script written to query a serial device (arduino) > > > a

Re: NoSQL Movement?

2010-03-09 Thread Xah Lee
On Mar 8, 11:14 am, Duncan Booth wrote: > Xah Lee wrote: > > For example, consider, if you are within world's top 100th user of > > database in terms of database size, such as Google, then it may be > > that the off-the-shelf tools may be limiting. But how many users > > really have such massive

Re: related lists mean value

2010-03-09 Thread Michael Rudolf
Am 08.03.2010 23:34, schrieb dimitri pater - serpia: Hi, I have two related lists: x = [1 ,2, 8, 5, 0, 7] y = ['a', 'a', 'b', 'c', 'c', 'c' ] what I need is a list representing the mean value of 'a', 'b' and 'c' while maintaining the number of items (len): w = [1.5, 1.5, 8, 4, 4, 4] This kind

Choosing a collection of common modules/packages for a general purpose reusable PY2EXE runtime

2010-03-09 Thread python
We've decided to build a re-usable *general purpose* PY2EXE "runtime" that can be shared by a number of scripts vs. distributing a monolithic EXE for each of our scripts. A list of the Python 2.6.4 compatible modules/packages we decided to include (and exclude) in our "runtime" follows my signatur

Re: odd error

2010-03-09 Thread Ulrich Eckhardt
Alex Hall wrote: > Now, though, when I press ctrl-shift-c (keystroke 11), nothing > happens. Control-C sends a special signal to the console, like Control-Break. > Pressing any other keystroke after that will crash the program > with some sort of Python internal com server exception that I > have

RE: How to detect C Function block using python

2010-03-09 Thread CHEN Guang
In the source code of PythoidC ( http://pythoidc.googlecode.com ), I wrote a Parser for C header files with Python regular expression, not only functions but also structs macros. May be of some help. Hey All, I'm new in this community. I am writing a static analyzer for validating C Code

Re: a newbie's question

2010-03-09 Thread Simon Brunning
On 9 March 2010 13:51, Lan Qing wrote: > Hi all, >       I'm a newbie of python programming language. Welcome! > I have used c/c++ for 5 > years, and one year experience in Lua programming language. Can any one give > me some advice on learning python. Think you for any help!! You'll find some

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread Javier Collado
> I'm only aware of Hyde (http://ringce.com/hyde) There are also jekyll and cyrax: http://github.com/mojombo/jekyll/ http://pypi.python.org/pypi/cyrax/0.1.5 I haven't tried any of them, but it looks like cyrax is in active development and its design was inspired in both jekyll and hyde. Best reg

Re: Newbie question: python versions differ per user?

2010-03-09 Thread BobAalsma
On Mar 8, 8:15 pm, BobAalsma wrote: > I'm on Mac OS X 10.5.8 and downloaded 2.6.4 Mac Installer Disk Image > as/in(?) the sys admin user. For this user Pyhton 2.6.4 is now the > current version. > I want to use Python outside the sys asdmin user. However, all other > users still use Python 2.5.1 (

Re: related lists mean value

2010-03-09 Thread Steve Howell
On Mar 8, 6:39 pm, John Posner wrote: > On 3/8/2010 5:34 PM, dimitri pater - serpia wrote: > > > Hi, > > > I have two related lists: > > x = [1 ,2, 8, 5, 0, 7] > > y = ['a', 'a', 'b', 'c', 'c', 'c' ] > > > what I need is a list representing the mean value of 'a', 'b' and 'c' > > while maintaining

Re: related lists mean value (golfed)

2010-03-09 Thread Michael Rudolf
OK, I golfed it :D Go ahead and kill me ;) x = [1 ,2, 8, 5, 0, 7] y = ['a', 'a', 'b', 'c', 'c', 'c' ] def f(a,b,v={}): try: v[a].append(b) except: v[a]=[b] def g(a): return sum(v[a])/len(v[a]) return g w = [g(i) for g,i in [(f(i,v),i) for i,v in zip(y,x)]] print("w is now the li

Re: related lists mean value (golfed)

2010-03-09 Thread Peter Otten
Michael Rudolf wrote: > OK, I golfed it :D > Go ahead and kill me ;) > > x = [1 ,2, 8, 5, 0, 7] > y = ['a', 'a', 'b', 'c', 'c', 'c' ] > > def f(a,b,v={}): > try: v[a].append(b) > except: v[a]=[b] > def g(a): return sum(v[a])/len(v[a]) > return g > w = [g(i) for g,i in [(f(i,v

Re: related lists mean value (golfed)

2010-03-09 Thread Peter Otten
Michael Rudolf wrote: > Am 09.03.2010 13:02, schrieb Peter Otten: > [sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y] >> [1.5, 1.5, 8.0, 4.0, 4.0, 4.0] >> Peter > > ... pwned. > Should be the fastest and shortest way to do it. It may be short, but it is not particularly efficient. A

Re: odd error

2010-03-09 Thread Alex Hall
I know ctrl-c kills a process in the shell, but these are global hotkeys and all others work fine. You made me discover something, though: the error only happens if ctrl-shift-c is pressed when in the shell from where the program was run; when pressed anywhere else, the keystroke does nothing at al

Re: related lists mean value

2010-03-09 Thread Steve Howell
On Mar 8, 2:34 pm, dimitri pater - serpia wrote: > Hi, > > I have two related lists: > x = [1 ,2, 8, 5, 0, 7] > y = ['a', 'a', 'b', 'c', 'c', 'c' ] > > what I need is a list representing the mean value of 'a', 'b' and 'c' > while maintaining the number of items (len): > w = [1.5, 1.5, 8, 4, 4, 4]

Re: odd error

2010-03-09 Thread Tim Golden
On 09/03/2010 13:55, Alex Hall wrote: Hi all, In the same program I wrote about yesterday, I have a dictionary of keystrokes which are captured. I just tried adding a new one, bringing the total to 11. Here are entries 10 and 11; 10 has been working fine for months. 10 : (57, win32con.MOD_CON

Re: imported var not being updated

2010-03-09 Thread Gary Herron
John Posner wrote: On 3/8/2010 11:55 PM, Gary Herron wrote: The form of import you are using from helpers import mostRecent makes a *new* binding to the value in the module that's doing the import. What you can do, is not make a separate binding, but reach into the helpers module to get t

Re: odd error

2010-03-09 Thread Tim Golden
On 09/03/2010 16:34, Tim Golden wrote: On 09/03/2010 13:55, Alex Hall wrote: Hi all, In the same program I wrote about yesterday, I have a dictionary of keystrokes which are captured. I just tried adding a new one, bringing the total to 11. Here are entries 10 and 11; 10 has been working fine fo

1794 - Best, Cheapest Web-Hosting, Domain at $1.99!

2010-03-09 Thread Rikal
World's Cheapest Rate Hosting, 99.9% Uptime US Based Dedicated Server, Fast Customer Service Register Domain only at $1.99 per Year 3 Month Hosting Free with 1 year Package -- http://mail.python.org/mailman/listinfo/python-list

Re: related lists mean value

2010-03-09 Thread Steve Howell
On Mar 9, 7:21 am, Steve Howell wrote: > > def num_dups_at_head(lst): >     assert len(lst) > 0 >     val = lst[0] >     i = 1 >     while i < len(lst) and lst[i] == val: >         i += 1 >     return i > > def smooth(x, y): >     result = [] >     while x: >         cnt = num_dups_at_head(y) >  

Re: odd error

2010-03-09 Thread Alex Hall
Okay, I changed the keycode from 99 (c) to 107 (k), and the errors have disappeared. However, now the function that should be called is not. As I said in a previous message, I have always had trouble with this sort of keystroke dictionary. It seems like, if a keycode is out of order or not one more

Re: imported var not being updated

2010-03-09 Thread John Posner
On 3/9/2010 9:48 AM, Bruno Desthuilliers wrote: John Posner a écrit : On 3/8/2010 11:55 PM, Gary Herron wrote: The form of import you are using from helpers import mostRecent makes a *new* binding to the value in the module that's doing the import. What you can do, is not make a separate

String is ASCII or UTF-8?

2010-03-09 Thread C. Benson Manica
Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? This is python 2.4.3, so I don't have getsizeof available to me. -- http://mail.python.org/mailman/l

Re: String is ASCII or UTF-8?

2010-03-09 Thread Alf P. Steinbach
* C. Benson Manica: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? This is python 2.4.3, so I don't have getsizeof available to me. Generally, i

Re: String is ASCII or UTF-8?

2010-03-09 Thread Tim Golden
On 09/03/2010 16:54, C. Benson Manica wrote: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? This is python 2.4.3, so I don't have getsizeof availa

Re: String is ASCII or UTF-8?

2010-03-09 Thread Stef Mientki
On 09-03-2010 18:02, Alf P. Steinbach wrote: * C. Benson Manica: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? This is python 2.4.3, so I don't

Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread KLEIN Stéphane
Hi, Today, I've show this static web site generating tools writed in ruby : * http://webgen.rubyforge.org/index.html * http://nanoc.stoneship.org/about/ * http://webby.rubyforge.org/tutorial/ I like this tools, I'm wonder if there are similar tools in Python ? I know Sphinx, but this tools i

Re: What to do if anything bites.

2010-03-09 Thread Steve Holden
News123 wrote: > Google Adsense wrote: >> What to do if anything bites. >> >> Check our bites treatment at >> >> http://... > > Pythons don't bite First, if you have to respond to spam please omit the URL that the spammer is trying to bring to Google's attention as well as direct readers. Second

Re: scipy sparse matrix question

2010-03-09 Thread Robert Kern
On 2010-03-09 00:14 AM, Victor Eijkhout wrote: I can't find any detailed information about scipy.sparse. The place to ask would be on scipy-user: http://www.scipy.org/Mailing_Lists My specific question: what does "for x in A" give me when A is a sparse matrix? It seems to yield all nonzero

Re: libc Sleep api performs a busy waiting

2010-03-09 Thread Thomas Heller
Joe Fox schrieb: > Hi, > > actually i have simplified my scenario a lot here , > > In my actual case , i have to call a C-api which blocks on c select , in a > separate thread. > > my thread is getting struck in that api , and thus blocking all the other > threads. > Can you point to something

Re: sys.stdout vs. sys.stderr

2010-03-09 Thread Mitchell L Model
On Jan 11, 2010, at 1:47 PM Nobody wrote: On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote: In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? No. Were they different at some earlier point in Python's evolution?

Re: remove element with ElementTree

2010-03-09 Thread Stefan Behnel
Justin Ezequiel, 09.03.2010 10:34: On Mar 9, 11:35 am, tdan wrote: I have been using ElementTree to write an app, and would like to simply remove an element. But in ElementTree, you must know both the parent and the child element to do this. There is no getparent() function, so I am stuck if I

Re: How to determine if threads are active in an application?

2010-03-09 Thread Gabriel Genellina
En Fri, 26 Feb 2010 19:10:30 -0300, escribió: Is there technique to determine if threads are active in a Python application? The only technique I can think of is to check sys.modules for thread and threading. But this will only show whether these modules were imported - not whether there are a

Re: remove element with ElementTree

2010-03-09 Thread Stefan Behnel
tdan, 09.03.2010 04:35: I have been using ElementTree to write an app, and would like to simply remove an element. But in ElementTree, you must know both the parent and the child element to do this. There is no getparent() function, so I am stuck if I only have an element. I am iterating over a

Re: String is ASCII or UTF-8?

2010-03-09 Thread C. Benson Manica
On Mar 9, 12:07 pm, Tim Golden wrote: > You can't. You can apply one or more heuristics, depending on exactly > what your requirement is. But any valid ASCII text is also valid > UTF8-encoded text since UTF-8 isn't "two bytes per char" but a variable > number of bytes per char. Hm, well that's v

Re: scipy sparse matrix question

2010-03-09 Thread Terry Reedy
On 3/9/2010 1:14 AM, Victor Eijkhout wrote: I can't find any detailed information about scipy.sparse. Scipy questions are best asked on the scipy list, which I suspect you can also access via news.gmane.org. My specific question: what does "for x in A" give me when A is a sparse matrix?

Re: String is ASCII or UTF-8?

2010-03-09 Thread Richard Brodie
"C. Benson Manica" wrote in message news:98375575-1071-46af-8ebc-f3c817b47...@q23g2000yqd.googlegroups.com... >The strings come from the same place, i.e. they're exclusively > normal ASCII characters. In this case then converting them to/from UTF-8 is a no-op, so it makes no difference at all.

Re: String is ASCII or UTF-8?

2010-03-09 Thread C. Benson Manica
On Mar 9, 12:24 pm, "Richard Brodie" wrote: > "C. Benson Manica" wrote in > messagenews:98375575-1071-46af-8ebc-f3c817b47...@q23g2000yqd.googlegroups.com... > > >The strings come from the same place, i.e. they're exclusively > > normal ASCII characters. > > In this case then converting them to/f

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread Matthew Behrens
> I like this tools, I'm wonder if there are similar tools in Python ? Blogofile is a static file blog engine/compiler, inspired by Jekyll. http://blogofile.com/ http://github.com/EnigmaCurry/blogofile -- http://mail.python.org/mailman/listinfo/python-list

Re: String is ASCII or UTF-8?

2010-03-09 Thread Robert Kern
On 2010-03-09 11:12 AM, Stef Mientki wrote: On 09-03-2010 18:02, Alf P. Steinbach wrote: * C. Benson Manica: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per

Re: String is ASCII or UTF-8?

2010-03-09 Thread Terry Reedy
On 3/9/2010 11:54 AM, C. Benson Manica wrote: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? Utf-8 is an encoding that uses 1 to 4 bytes per cha

Re: String is ASCII or UTF-8?

2010-03-09 Thread Roel Schroeven
Op 2010-03-09 18:31, C. Benson Manica schreef: > On Mar 9, 12:24 pm, "Richard Brodie" wrote: >> "C. Benson Manica" wrote in >> messagenews:98375575-1071-46af-8ebc-f3c817b47...@q23g2000yqd.googlegroups.com... >> >>> The strings come from the same place, i.e. they're exclusively >>> normal ASCII c

Re: related lists mean value (golfed)

2010-03-09 Thread nn
Peter Otten wrote: > Michael Rudolf wrote: > > > Am 09.03.2010 13:02, schrieb Peter Otten: > > [sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y] > >> [1.5, 1.5, 8.0, 4.0, 4.0, 4.0] > >> Peter > > > > ... pwned. > > Should be the fastest and shortest way to do it. > > It may be short,

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread Stefan Behnel
KLEIN Stéphane, 09.03.2010 09:30: Today, I've show this static web site generating tools writed in ruby : * http://webgen.rubyforge.org/index.html * http://nanoc.stoneship.org/about/ * http://webby.rubyforge.org/tutorial/ I like this tools, I'm wonder if there are similar tools in Python

ICNAAM 2010 Mini-Symposium on Computational Bioimaging and Visualization

2010-03-09 Thread tava...@fe.up.pt
Dear Colleague, Within the ICNAAM 2010 - 8th International Conference of Numerical Analysis and Applied Mathematics (http://www.icnaam.org), to be held in Rhodes, Greece, on 19-25 September 2010, we are organizing the Mini- Symposium on “Computational Bioimaging and Visualization”. Due to your res

Re: Pyrhon2.5 to 2.4 conversion

2010-03-09 Thread tarek...@gmail.com
Thanks a lot everybody for your help, it worked now :) On Feb 28, 4:12 am, MRAB wrote: > tarek...@gmail.com wrote: > > Hi, > > > I am currently using oauth2.py library, and it works fine on one of my > > PC's (python2.5), but later on when I tried to use it with python2.4 > > the following line (

Re: String is ASCII or UTF-8?

2010-03-09 Thread Martin v. Loewis
> I can create ASCII strings containing byte values between 127 and 255. No, you can't - or what you create wouldn't be an ASCII string, by definition of ASCII. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: scipy sparse matrix question

2010-03-09 Thread Victor Eijkhout
Terry Reedy wrote: > > My specific question: what does "for x in A" give me when A is a sparse > > matrix? > > Try it and see what you get. Ah, how do I see what I get? If I print it it looks plausible, but I don't know how to pull it apart. It doesn't seem to be an array. Victor. -- Victor

Re: How to detect C Function block using python

2010-03-09 Thread Gabriel Genellina
En Tue, 09 Mar 2010 04:51:57 -0300, Faheem escribió: I'm new in this community. I am writing a static analyzer for validating C Code using python and for that I'm looking for a python module/API that will detect Function block of a given C-File. I know simple function can be detected using

Re: scipy sparse matrix question

2010-03-09 Thread Robert Kern
On 2010-03-09 14:52 PM, Victor Eijkhout wrote: Terry Reedy wrote: My specific question: what does "for x in A" give me when A is a sparse matrix? Try it and see what you get. Ah, how do I see what I get? If I print it it looks plausible, but I don't know how to pull it apart. It doesn't se

Down casting Python objects

2010-03-09 Thread Andrey Fedorov
So I have `x', a instance of class `Foo'. I also have class `Bar', a class extending `Foo' with a couple of methods. I'd like to "down cast" x as efficiently as possible. Is it OK to just set `x.__class__ = Bar' and expect things to work OK in all major versions of CPython? -- http://mail.python.o

Re: String is ASCII or UTF-8?

2010-03-09 Thread Stef Mientki
On 09-03-2010 18:36, Robert Kern wrote: On 2010-03-09 11:12 AM, Stef Mientki wrote: On 09-03-2010 18:02, Alf P. Steinbach wrote: * C. Benson Manica: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte pe

CSV DictReader loops when used with MySQLdb

2010-03-09 Thread Art Zemon
I'm going crazy. Using python 2.5.2 on 64 bit Linux. I have a class which reads CSV files using the CSV DictReader. If I print the rows, everything works perfectly. If I insert the rows into a MySQL table using MySQLdb, the DictReader loops back and begins re-reading from the beginning of the fil

Named loops for breaking

2010-03-09 Thread Daniel Klein
Hey, I did a little searching and couldn't really find much recent on this. The only thing I found was this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/a696624c92b91181/5b7479fdc3362b83?lnk=gst&q=break+named+loop#5b7479fdc3362b83 Basically I'm wondering if there are any

How to dynamic insert more conditional statements into a function

2010-03-09 Thread Shane
Hi I am a newbie for Python Here is a question, say I have a list L, function foo is: def foo(L): if L[0] > 0: return True if later I want another function goo which returns "True" when L[0] and L[1] are both > 0, i.e., def goo(L): if L[0] > 0 and L[1] > 0: return True Can anybody tel

find text location (in pixels) using python (pyPdf)

2010-03-09 Thread Chris Curvey
Has anyone ever tried to find the pixel (or point) location of text in a PDF using Python? I've been using the pyPdf libraries for other things, and it seems to me that if I can find the bounding box for text, I should be able to calculate the location. What I want to do is take a PDF of one of o

Re: Updates about Tk

2010-03-09 Thread Donal K. Fellows
On Feb 27, 5:29 pm, rantingrick wrote: > Great post Kevin! The only thing i would like to add are my two > favorite references for learning Tkinter. They are not geared around > the new ttk stuff, but still 95% relevant to any Tkinter-ing > > http://effbot.org/tkinterbook/ > http://infohost.nmt.ed

Re: Named loops for breaking

2010-03-09 Thread Paul Rubin
Daniel Klein writes: > Basically I'm wondering if there are any plans to implemented named > loops in Python, so I can tell a break command to break out of a > specific loop in the case of nested loops. Currently I'm using boolean > flag variables, but I find that very clumsy. The usual way to do

Re: String is ASCII or UTF-8?

2010-03-09 Thread Emile van Sebille
On 3/9/2010 1:36 PM Stef Mientki said... On 09-03-2010 18:36, Robert Kern wrote: No, you can't. ASCII strings only have characters in the range 0..127. You could create Latin-1 (or any number of the 8-bit encodings out there) strings with characters 0..255, yes, but not ASCII. Probably, an

Re: How to dynamic insert more conditional statements into a function

2010-03-09 Thread Emile van Sebille
On 3/9/2010 1:48 PM Shane said... Hi I am a newbie for Python Here is a question, say I have a list L, function foo is: def foo(L): if L[0]> 0: return True if later I want another function goo which returns "True" when L[0] and L[1] are both> 0, i.e., def goo(L): if L[0]> 0 and

Can't build hashlib

2010-03-09 Thread brown wrap
The md5 module is used in build xulrunner and Firefox from source. When I do run the install its says md5 no such module. I compiled Python 2.6.4 after installing openssl and BerkleyDB, yet I get this error when compilying Python: Failed to find the necessary bits to build these modules: _tki

Re: equivalent of Ruby's Pathname?

2010-03-09 Thread Mike Orr
I just saw this thread on the Python-URL. On Feb 14, 12:39 pm, a...@pythoncraft.com (Aahz) wrote: > >> Sean DiZazzo =A0 wrote: > > >>>Why did Path() get rejected? Is it the idea itself, or just the > >>>approach that was used? What are the complaints? > > >> You should search for the discussiona a

file seek is slow

2010-03-09 Thread Metalone
I ran a comparison that timed 1e6 file seeks. The tests were run with Python 2.6.4 and Microsoft Visual C 6.0 on Windows XP with an Intel 3GHz single processor with hyperthreading. Results: C: 0.812 seconds Python: 1.458 seconds. difference = 0.646 seconds. If the file.seek is removed the

Re: equivalent of Ruby's Pathname?

2010-03-09 Thread Martin P. Hellwig
On 02/09/10 14:00, Phlip wrote: Ah, now we get down to the root of the problem. Because Python is so stuck on the "one best way to do it" mentality, language bigotry prevented the Committee from picking from among several equally valid but non-best options. And after 20 years of growth, Python s

Re: Reverse engineering CRC?

2010-03-09 Thread Gregory Ewing
Dave Angel wrote: If you assume it's done in a single pass, and you know which byte is the end of the buffer, I'd think you could learn a lot by just tweaking that last byte. I'm sure I would, but unfortunately I can't control the last byte. The bytes that I can influence are some distance ba

Re: file seek is slow

2010-03-09 Thread Paul McGuire
This is a pretty tight loop: for i in xrange(100): f1.seek(0) But there is still a lot going on, some of which you can lift out of the loop. The easiest I can think of is the lookup of the 'seek' attribute on the f1 object. Try this: f1_seek = f1.seek for i in xrange(100):

Knight's tour Warndorff's algorithm problem

2010-03-09 Thread Robin Rytich
Hi all I'm having some troubles with writing Knight's tour (http://en.wikipedia.org/wiki/Knight%27s_tour) solution in Python 3. I'm using Warnsdorff's algorithm (http://en.wikipedia.org/wiki/Knight% 27s_tour#Algorithm) and I'm wondering why it doesn't work with boards of certain sizes. I've writte

Re: Named loops for breaking

2010-03-09 Thread alex23
Daniel Klein wrote: > Basically I'm wondering if there are any plans to implemented named > loops in Python, so I can tell a break command to break out of a > specific loop in the case of nested loops. You should be able to do this with the goto module: http://entrian.com/goto/ But please note t

Re: odd error

2010-03-09 Thread alex23
Alex Hall wrote: > Why would the sequence > matter, or does it not and I am doing something else wrong? Here is a > sample of my dictionary: Showing us the code that handles the dictionary lookup + function calling would probably help us a lot more here. -- http://mail.python.org/mailman/listinf

Re: Six Minutes and fourty two seconds

2010-03-09 Thread CHEN Guang
>Tobiah wrote: >> Now that I use python, this is the amount of time >> per day that I spend adding forgotten semicolons while >> debugging other languages. >> >What compels you to write Python code without semicolons? >Frederic Try the C language without semicolons and braces http://pythoidc.

Re: pyserial script doesnt execute properly

2010-03-09 Thread Andy
Hi Kishore, Have you tried "ser=serial.Serial(port='COM2', baudrate=9600)" instead of "port='\\.\COM2'"? Also, I'd suggest you temporarily define some other parameters that now you're leaving to default values. From the documentation of pyserial: readline(size=None, eol='\n') You're sure that y

Re: Down casting Python objects

2010-03-09 Thread Rami Chowdhury
On Mar 9, 2010, at 13:26 , Andrey Fedorov wrote: > So I have `x', a instance of class `Foo'. I also have class `Bar', a class > extending `Foo' with a couple of methods. I'd like to "down cast" x as > efficiently as possible. Is it OK to just set `x.__class__ = Bar' and expect > things to work

Re: Reverse engineering CRC?

2010-03-09 Thread Steve Howell
On Mar 7, 7:09 pm, Gregory Ewing wrote: > Given some known data/crc pairs, how feasible is it to > figure out the polynomial being used to generate the crc? > > In the case I'm looking at, it appears that the crc > size may be at least 24 bits, so just trying all possible > polynomials probably is

Knight's tour Warndorff's algorithm problem

2010-03-09 Thread Gabriel Genellina
El 9 mar, 22:57, Robin Rytich escribió: I'm having some troubles with writing Knight's tour (http://en.wikipedia.org/wiki/Knight%27s_tour) solution in Python 3. I'm using Warnsdorff's algorithm (http://en.wikipedia.org/wiki/Knight% 27s_tour#Algorithm) and I'm wondering why it doesn't work with b

pexpect and logging integration

2010-03-09 Thread Lars Stavholm
Hi all, has anyone managed to integrate pexpect and logging? I.e., I'd like to be able to pick up the dialog, commands sent and responses received, in my logging. I know about the pexpect logfile, and I can log things to stdout or stderr, but I really need to log using the python logging library.

Re: Named loops for breaking

2010-03-09 Thread Gabriel Genellina
En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein escribió: Basically I'm wondering if there are any plans to implemented named loops in Python, so I can tell a break command to break out of a specific loop in the case of nested loops. See PEP3136 [1] and its rejection note [2] I think you m

Re: How to dynamic insert more conditional statements into a function

2010-03-09 Thread Gabriel Genellina
En Tue, 09 Mar 2010 18:48:42 -0300, Shane escribió: Hi I am a newbie for Python Here is a question, say I have a list L, function foo is: def foo(L): if L[0] > 0: return True if later I want another function goo which returns "True" when L[0] and L[1] are both > 0, i.e., def goo(L):

Re: datelib pythonification

2010-03-09 Thread alex goretoy
> > DATE_TYPE = type(date.today()) def dates_diff(self, *targs): nargs = len(targs) if nargs == 0: return self.enddate - self.startdate if nargs == 1: arg = targs[0] if not isinstance(arg, (list, tuple)) or len(arg) != 2: raise Exception(

  1   2   >