Re: os.system question

2008-08-07 Thread SamG
On Aug 7, 6:07 am, Kevin Walzer <[EMAIL PROTECTED]> wrote: >  >>> import os >  >>> foo = os.system('whoami') > kevin >  >>> print foo > 0 >  >>> > > The standard output of the system command 'whoami' is my login name. Yet > the value of the 'foo' object is '0,' not 'kevin.' How can I get the > valu

Re: benchmark

2008-08-07 Thread jlist
I think what makes more sense is to compare the code one most typically writes. In my case, I always use range() and never use psyco. But I guess for most of my work with Python performance hasn't been a issue. I haven't got to write any large systems with Python yet, where performance starts to ma

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread Nikolaus Rath
LaundroMat <[EMAIL PROTECTED]> writes: > Hi - > > I'm trying to calculate unique hash values for binary files, > independent of their location and filename, and I was wondering > whether I'm going in the right direction. > > Basically, the hash values are calculated thusly: > > f = open('binaryfile

.cpp to .pyd

2008-08-07 Thread vedrandekovic
Hello, I want to build my C++ (.cpp) script to (.pyd) like this: http://en.wikibooks.org/wiki/Python_Programming/Extending_with_C%2B%2B I have installed "Microsoft Visual studio .NET 2003" and "Boost Python" and then after I run my setup script: python setup.py build I get this error: runni

Re: benchmark

2008-08-07 Thread alex23
Steven D'Aprano wrote: > In other words, about 20% of the time he measures is the time taken to > print junk to the screen. Which makes his claim that "all the console outputs have been removed so that the benchmarking activity is not interfered with by the IO overheads" somewhat confusing...he di

Re: .cpp to .pyd

2008-08-07 Thread Matthieu Brucher
> I think that my MS visual studio cannot find "boost python", if > that's the problem then can you tell me how can I solve it. > This is very begginer question,but I can't find answer nowhere, and I > don't have any expirience with Microsoft products. Hi, Put Boost in your include path (options

Re: Using an DTD not specified in XML file for validation

2008-08-07 Thread Enrico
"Brian Quinlan" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Hey, > > I'm trying to figure out how I can validate an XML file using a DTD that > isn't specified in the XML file. I did it once using lxml. You can read from: http://codespeak.net/lxml/validation.html With th

Re: Best practise implementation for equal by value objects

2008-08-07 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I believe the recommendation for eval(repr(obj)) to give obj again is > meant as a convenience for the interactive interpreter, and even there > only for simple types like int or list. and even with types as simple as list and int the round tripping

Re: Parsing of a file

2008-08-07 Thread Bruno Desthuilliers
Tommy Grav a écrit : I have a file with the format Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames 5 Set 1 Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames 5 Set 2 Field f31226: Ra=20:24:45.50 Dec=+78:26:45.2 MJD=53370.06823860 Frames 5 Set 3 Field

Horses

2008-08-07 Thread weiguo6
Where have all the horses gone? -- http://mail.python.org/mailman/listinfo/python-list

Re: .cpp to .pyd

2008-08-07 Thread vedrandekovic
On 7 kol, 09:48, "Matthieu Brucher" <[EMAIL PROTECTED]> wrote: > > I think that my MS visual studio  cannot find "boost python", if > > that's the problem then can you tell me how can I solve it. > > This is very begginer question,but I can't find answer nowhere, and I > > don't have any expirience

Re: benchmark

2008-08-07 Thread Steven D'Aprano
On Thu, 07 Aug 2008 00:44:14 -0700, alex23 wrote: > Steven D'Aprano wrote: >> In other words, about 20% of the time he measures is the time taken to >> print junk to the screen. > > Which makes his claim that "all the console outputs have been removed so > that the benchmarking activity is not in

Re: random numbers according to user defined distribution ??

2008-08-07 Thread Raymond Hettinger
On Aug 6, 3:02 pm, Alex <[EMAIL PROTECTED]> wrote: > I wonder if it is possible in python to produce random numbers > according to a user defined distribution? > Unfortunately the random module does not contain the distribution I > need :-( Sure there's a way but it won't be very efficient. Start

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
Thanks all! -- http://mail.python.org/mailman/listinfo/python-list

Re: Locking around

2008-08-07 Thread [EMAIL PROTECTED]
On Aug 6, 8:33 pm, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Tobiah <[EMAIL PROTECTED]> writes: > > On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > > Do you think you could use an SQL database on the network to > > handle the locking? > > Yeah, I could. It wouldn't even have to be over

Re: benchmark

2008-08-07 Thread Angel Gutierrez
Steven D'Aprano wrote: > On Thu, 07 Aug 2008 00:44:14 -0700, alex23 wrote: > >> Steven D'Aprano wrote: >>> In other words, about 20% of the time he measures is the time taken to >>> print junk to the screen. >> >> Which makes his claim that "all the console outputs have been removed so >> that t

WinCvs Macros

2008-08-07 Thread Ren ChunYi
Hi, Does anyone here have some doc like WinCVS API? I'm reading WinCvs integrated Macros, but someplace make me puzzle. And, is there Macro for listing all items with Tag name? Thanks and best regards. Ren Chunyi Control Room and Resource Systems Department BT FRONTLINE (Dalian) Co., Ltd.

Re: .cpp to .pyd

2008-08-07 Thread Ulrich Eckhardt
[EMAIL PROTECTED] wrote: > hellomodule.cpp(9) : fatal error C1083: Cannot open include file: > 'boost/python/module.hpp': No such file or directory You need to tell it where to find the Boost includes. I suggest you first try to get some header-only Boost library going as example, if you have that

Re: benchmark

2008-08-07 Thread M8R-n7vorv
On Aug 7, 6:38 am, [EMAIL PROTECTED] wrote: > On Aug 7, 2:05 am, "Jack" <[EMAIL PROTECTED]> wrote: > > > I know one benchmark doesn't mean much but it's still disappointing to see > > Python as one of the slowest languages in the test: > > >http://blog.dhananjaynene.com/2008/07/performance-comparis

Re: Function from C/PHP to Python

2008-08-07 Thread Grom
On 7 Sie, 06:01, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 06 Aug 2008 20:15:11 -0700, Grom wrote: > > Hello everyone :) > > I have one problem with that function in C > ... > > Can someone help me to rewrite it to python? > > > There is the same function, in PHP: > ..

Re: benchmark

2008-08-07 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Thu, 07 Aug 2008 07:49:45 +0200, Stefan Behnel wrote: Jack wrote: I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java- p

Re: benchmark

2008-08-07 Thread M8R-n7vorv
On Aug 7, 12:44 pm, alex23 <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > In other words, about 20% of the time he measures is the time taken to > > print junk to the screen. > > Which makes his claim that "all the console outputs have been removed > so that the benchmarking activity is no

Howto: single line webserver

2008-08-07 Thread Martin Bless
If I have the option I choose Python to get things done or gain real understanding. The high quality and stability over time of both the language and the libraries is just amazing. OTH I sometimes really miss little example snippets integrated into the docs right away. I didn't really know what

Re: benchmark

2008-08-07 Thread bearophileHUGS
jlist: > I think what makes more sense is to compare the code one most > typically writes. In my case, I always use range() and never use psyco. If you don't use Python 3 and your cycles can be long, then I suggest you to start using xrange a lot :-) (If you use Psyco you don't need xrange). M8R

Re: benchmark

2008-08-07 Thread Bruno Desthuilliers
Stefan Behnel a écrit : Jack wrote: I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ Just ignore that. If the co

cache-like structure

2008-08-07 Thread konstantin
Hi, I've write a class that actually is data structure with items that automatically removed from collection when timeout expires. Interface is pretty simple. First public method is to make a record. And second (__contains__) is to define if record is actually in table. I prefer async way to clean

Re: benchmark

2008-08-07 Thread M8R-n7vorv
On Aug 7, 5:05 am, "Jack" <[EMAIL PROTECTED]> wrote: > I know one benchmark doesn't mean much but it's still disappointing to see > Python as one of the slowest languages in the test: > > http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-p... I was actually disappointed myself wi

Re: benchmark

2008-08-07 Thread M8R-n7vorv
On Aug 7, 2:52 pm, [EMAIL PROTECTED] wrote: > On Aug 7, 6:38 am, [EMAIL PROTECTED] wrote: > > > On Aug 7, 2:05 am, "Jack" <[EMAIL PROTECTED]> wrote: > > > > I know one benchmark doesn't mean much but it's still disappointing to see > > > Python as one of the slowest languages in the test: > > > >ht

Re: .cpp to .pyd

2008-08-07 Thread Kay Schluehr
It doesn't look like a VS issue since you've started the setup.py script that calls the command line compiler. So I'd expect it behaves not different from other command line tools and you might have to add the boost path directly to the command-line options. -- http://mail.python.org/mailman/listin

Re: random numbers according to user defined distribution ??

2008-08-07 Thread Alex
Thanks for the many answers. So basically I have to get the inverse of the CDF and use this to transform my uniformly distributed random numbers. If my desired distribution is simple I can get an analytical solution for the inverse, otherwise I have to use numerical methods. Okay, things are now

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
I did some testing, and calculating the hash value of a 1Gb file does take some time using this method. Would it be wise to calculate the hash value based on say for instance the first Mb? Is there a much larger chance of collusion this way (I suppose not). If it's helpful, the files would primaril

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread Paul Rubin
LaundroMat <[EMAIL PROTECTED]> writes: > Would it be wise to calculate the hash value based on say for instance > the first Mb? Is there a much larger chance of collusion this way (I > suppose not). If it's helpful, the files would primarily be media > (video) files. The usual purpose of using thi

Re: More Datastore Examples Please

2008-08-07 Thread v4vijayakumar
On Aug 7, 11:38 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > v4vijayakumar <[EMAIL PROTECTED]> wrote: > > >Google appengine datastore is not very clear, and I couldn't get much > >from API documents. It would be very helpful if there are some more > >detailed documents with examples. > > I would ge

Starting seperate programs

2008-08-07 Thread David Dean
[cid:image9e02f1.JPG@63ab2305.a06442dd] Is there a way for a python program start another python program, and then continue, without waiting for the second program to finish? os.startfile() seems to be what I want on windows, but I need it to work on linux and mac as well. Is there a function th

Re: benchmark

2008-08-07 Thread alex23
On Aug 7, 8:08 pm, [EMAIL PROTECTED] wrote: > Really how silly can it be when you suggest someone is taking a > position and tweaking the benchmarks to prove a point [...] I certainly didn't intend to suggest that you had tweaked -anything- to prove your point. I do, however, think there is littl

Re: pyprocessing/multiprocessing for x64?

2008-08-07 Thread Kris Kennaway
Benjamin Kaplan wrote: The only problem I can see is that 32-bit programs can't access 64-bit dlls, so the OP might have to install the 32-bit version of Python for it to work. Anyway, all of this is beside the point, because the multiprocessing module works fine on amd64 systems. Kris --

Re: benchmark

2008-08-07 Thread cokofreedom
> > Honestly, performance benchmarks seem to be the dick size comparison > of programming languages. > But in the honour of dick size: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=all -- http://mail.pyth

Re: os.system question

2008-08-07 Thread Kevin Walzer
SamG wrote: Why dont you try commands module instead Thank you! That was just what I needed. -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list

python-mode is missing the class browser

2008-08-07 Thread Michele Simionato
I have noticed that the python-mode for Emacs that comes with the latest Ubuntu is missing the class browser. Moreover if works differently from the python-mode I was used to (for instance CTRL-c-c works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back to the old python-mode or at l

Re: benchmark

2008-08-07 Thread Chris Mellon
On Thu, Aug 7, 2008 at 8:12 AM, alex23 <[EMAIL PROTECTED]> wrote: > On Aug 7, 8:08 pm, [EMAIL PROTECTED] wrote: >> Really how silly can it be when you suggest someone is taking a >> position and tweaking the benchmarks to prove a point [...] > > I certainly didn't intend to suggest that you had twe

Re: benchmark

2008-08-07 Thread Steven D'Aprano
On Thu, 07 Aug 2008 06:12:04 -0700, alex23 wrote: > On Aug 7, 8:08 pm, [EMAIL PROTECTED] wrote: >> Really how silly can it be when you suggest someone is taking a >> position and tweaking the benchmarks to prove a point [...] > > I certainly didn't intend to suggest that you had tweaked -anything

Re: Adding Microsoft objects in Boa Constuctor Palette

2008-08-07 Thread TheSeeker
On Aug 6, 5:59 pm, Sid K <[EMAIL PROTECTED]> wrote: > This is what I wanted to do: > > Add Microsoft Active objects like Excel sheets and Word files to the > Palette in Boa Constructor. There is a User tab in the GUI builder > menu, but I'm not sure how to use/enable it. > > 1. Does anyone know how

Re: benchmark

2008-08-07 Thread Chris Mellon
On Thu, Aug 7, 2008 at 9:09 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 07 Aug 2008 06:12:04 -0700, alex23 wrote: > >> On Aug 7, 8:08 pm, [EMAIL PROTECTED] wrote: >>> Really how silly can it be when you suggest someone is taking a >>> position and tweaking the benchmarks to prove a poi

Re: benchmark

2008-08-07 Thread Dhananjay
On Aug 7, 6:12 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Aug 7, 8:08 pm, [EMAIL PROTECTED] wrote: > > > Really how silly can it be when you suggest someone is taking a > > position and tweaking the benchmarks to prove a point [...] > > I certainly didn't intend to suggest that you had tweaked -any

Re: cross-compilation

2008-08-07 Thread Martin v. Löwis
> What about to start to resolve issues step by step ? The first step surely should be to get the autoconf issue resolved. I don't think distutils cross-compilation is going to work, instead, people wishing to cross-compile should edit Modules/Setup. Regards, Martin -- http://mail.python.org/mai

Re: iterating "by twos"

2008-08-07 Thread shahms . king
On Jul 29, 10:36 am, kj <[EMAIL PROTECTED]> wrote: > Is there a special pythonic idiom for iterating over a list (or > tuple) two elements at a time? > > I mean, other than > > for i in range(0, len(a), 2): >     frobnicate(a[i], a[i+1]) > > ? > > I think I once saw something like > > for (x, y) in

problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
I am trying to call a parent's __init__ method from the child's: class ArbitraryBlock(InnerBlock): def __init__(self, codelist, noout=False, **kwargs): InnerBlock.__init__(self, codelist, noout=noout, **kwargs) I get this error: : unbound method __init__() must be called with InnerB

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-07 Thread Tim Rowe
2008/8/3 CNiall <[EMAIL PROTECTED]>: > However, with some, but not all, decimals, they do not seem to 'equal > themselves'. The golden rule is that working with decimals (in pretty much any language) is like working with a pile of sand. Almost anything you do leaves you with less sand and more di

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
On Aug 7, 2:22 pm, Paul Rubin wrote: > LaundroMat <[EMAIL PROTECTED]> writes: > > Would it be wise to calculate the hash value based on say for instance > > the first Mb? Is there a much larger chance of collusion this way (I > > suppose not). If it's helpful, the files w

Re: problem calling parent's __init__ method

2008-08-07 Thread Jerry Hill
On Thu, Aug 7, 2008 at 11:11 AM, Ryan Krauss <[EMAIL PROTECTED]> wrote: > I am trying to call a parent's __init__ method from the child's: This works for me just fine: class InnerBlock(object): def __init__(self, codelist, noout=False, **kwargs): self.codelist = codelist self.

Re: python-mode is missing the class browser

2008-08-07 Thread Bruno Desthuilliers
Michele Simionato a écrit : I have noticed that the python-mode for Emacs that comes with the latest Ubuntu is missing the class browser. Moreover if works differently from the python-mode I was used to (for instance CTRL-c-c works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back

Re: problem calling parent's __init__ method

2008-08-07 Thread Peter Otten
Ryan Krauss wrote: > I am trying to call a parent's __init__ method from the child's: > > class ArbitraryBlock(InnerBlock): > def __init__(self, codelist, noout=False, **kwargs): > InnerBlock.__init__(self, codelist, noout=noout, **kwargs) > > > I get this error: > > : unbound meth

Testing for the first few letters of a string

2008-08-07 Thread Alexnb
Okay, I have a fix for this problem, but it is messy and I think there might be a better way. Heres an example: Lets say I have a string: "My name is alex" and I have another string "My name is alex, and I like pie". I want to test to see if just the "My name is alex" part is there. I don't ca

Re: Testing for the first few letters of a string

2008-08-07 Thread Shawn Milochik
Check out the built-in string.startswith() method. -- http://mail.python.org/mailman/listinfo/python-list

RE: Testing for the first few letters of a string

2008-08-07 Thread Edwin . Madari
use re module import re template = '^My name is alex' astring = 'My name is alex, and I like pie' if re.match(template, astring): print 'Found it' else: print '%s does not begin with %s' % (astring, template) good luck. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EM

Re: Testing for the first few letters of a string

2008-08-07 Thread Sean DiZazzo
try string1 = "My name is alex" string2 = "My name is alex, and I like pie" if string2.startswith(string1): process() or if you want to match a set number of characters you can use a slice: if string2[:15] == string1[:15]: process() or if you dont care where the characters appear in

Re: problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
It is in fact an import problem. My module works fine by itself with a test case in if __name__ == '__main__', but I have a problem when using it within another module when both are underdevelopment. Changing the reload order solves the problem. This is bad: import texpy, os, pytex reload(texpy)

Re: python-mode is missing the class browser

2008-08-07 Thread Alexander Schmolck
Michele Simionato <[EMAIL PROTECTED]> writes: > I have noticed that the python-mode for Emacs that comes with the > latest Ubuntu is missing the class browser. Moreover if works > differently from the python-mode I was used to (for instance CTRL-c-c > works as CTRL-c-! whereas CTRL-c-! is missing,

Re: python-mode is missing the class browser

2008-08-07 Thread Diez B. Roggisch
Bruno Desthuilliers wrote: > Michele Simionato a écrit : >> I have noticed that the python-mode for Emacs that comes with the >> latest Ubuntu is missing the class browser. Moreover if works >> differently from the python-mode I was used to (for instance CTRL-c-c >> works as CTRL-c-! whereas CTRL-

Re: Psycho question

2008-08-07 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > > Thanks. I would have guessed that I'd want low-level style code; > > that's the sort of thing I have in mind. In fact the only thing > > that seems likely to come up right now is looping t

Access individual fields in csv using python

2008-08-07 Thread Krishna
How do I access individual fields in csv using python? Please let me know ASAP as its real urgent for me. Thanks for your help Krishna -- http://mail.python.org/mailman/listinfo/python-list

Large production environments using ZODB/ZOE?

2008-08-07 Thread Phillip B Oldham
I've been reading a lot recently on ZODB/ZOE, but I've not seen any reference to its use in large-scale production envrironments. Are there any real-world examples of ZODB/ZOE in use for a large system? By large, I'm thinking in terms of both horizontally-scaled systems and in terms of data storag

Re: Psycho question

2008-08-07 Thread MRAB
On Aug 6, 8:52 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] wrote: > > David C. Ullrich: > > > Thanks. If I can get it installed and it works as advertised > > > this means I can finally (eventually) finish the process of > > > dumping

Re: Access individual fields in csv using python

2008-08-07 Thread Timothy Grant
On Thu, Aug 7, 2008 at 9:23 AM, Krishna <[EMAIL PROTECTED]> wrote: > How do I access individual fields in csv using python? Please let me > know ASAP as its real urgent for me. > > Thanks for your help > > Krishna > -- > http://mail.python.org/mailman/listinfo/python-list > I'd likely use the csv m

Re: .cpp to .pyd

2008-08-07 Thread vedrandekovic
On 7 kol, 11:37, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > hellomodule.cpp(9) : fatal error C1083: Cannot open include file: > > 'boost/python/module.hpp': No such file or directory > > You need to tell it where to find the Boost includes. I suggest you first > try t

Re: Parsing of a file

2008-08-07 Thread Mike Driscoll
On Aug 6, 4:06 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 7, 6:02 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Aug 6, 1:55 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > > > > I have a file with the format > > > > Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Fr

Re: cache-like structure

2008-08-07 Thread maxime
konstantin wrote: > Hi, Hi >... > - are there better ways to do this (or any ready recipes) Did you consider using the shed module (not threaded)? Cheers, Maxime -- http://mail.python.org/mailman/listinfo/python-list

Re: cache-like structure

2008-08-07 Thread maxime
On Aug 7, 7:00 pm, maxime <[EMAIL PROTECTED]> wrote: > konstantin wrote: > > Hi, > Hi > >... > > - are there better ways to do this (or any ready recipes) > > Did you consider using the shed module (not threaded)? > > Cheers, > > Maxime If you need threading, what i would do is implementing a _rem

Re: os.system question

2008-08-07 Thread Eric Wertman
In your case you could also use the os.environ dictionary: import os print os.environ['USER'] -- http://mail.python.org/mailman/listinfo/python-list

Create 2D character matrix

2008-08-07 Thread Simon Parker
Hello.   I want to be able to create a 2D character matrix, ThisMatrix, like :     a A b B c C d D   and to be able to pick out elements, or rows or columns.   I have become used to programming in R where I can easily refer to a row as :   ThisMatrix [1,]   and a column as   ThisMa

Re: Adding Microsoft objects in Boa Constuctor Palette

2008-08-07 Thread Sid K
On Aug 7, 10:13 am, TheSeeker <[EMAIL PROTECTED]> wrote: > On Aug 6, 5:59 pm, Sid K <[EMAIL PROTECTED]> wrote: > > > > > This is what I wanted to do: > > > Add Microsoft Active objects like Excel sheets and Word files to the > > Palette in Boa Constructor. There is a User tab in the GUI builder > >

very newbie question

2008-08-07 Thread garywood
stuck on python for absolute beginners chapter 6 i actually done what i was supposed to do use the function ask_number for guess a number but for some reason it does not count correctly the number of tries # Guess My Number # # The computer picks a random number between 1 and 100 # The player

Re: iterating "by twos"

2008-08-07 Thread castironpi
On Jul 29, 3:38 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > kj wrote: > > Is there a special pythonic idiom for iterating over a list (or > > tuple) two elements at a time? > > > I mean, other than > > > for i in range(0, len(a), 2): > >     frobnicate(a[i], a[i+1]) > > There have been requests to

Re: very newbie question

2008-08-07 Thread Ethan Furman
garywood wrote: stuck on python for absolute beginners chapter 6 i actually done what i was supposed to do use the function ask_number for guess a number but for some reason it does not count correctly the number of tries # Guess My Number # # The computer picks a random number between 1 and

RE: very newbie question

2008-08-07 Thread Edwin . Madari
delete the extra 'tries += 1' after else: print "Higher..." tries += 1 #delete this while at it, and add this line as the first line in function ask_number() global the_number, tries good luck. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMA

Re: Books to begin learning Python

2008-08-07 Thread Beliavsky
On Aug 6, 4:08 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Aug 6, 2:56 pm, Edward Cormier <[EMAIL PROTECTED]> wrote: > > > Which computer books are the best to begin learning Python 2.5 with? > > I've heard that Learning Python 3rd Edition is a good choice - can > > anyone give any more advic

HTTP basic authentication with form-based authentication

2008-08-07 Thread Max
Following the tutorial at http://personalpages.tds.net/~kent37/kk/00010.html, I understand how to access HTTP basic authenticated pages or form- based authenticated pages. How would I access a page protected by both form-based authentication (using cookies) *and* HTTP basic authentication? -- http:

Re: Psycho question

2008-08-07 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, MRAB <[EMAIL PROTECTED]> wrote: > On Aug 6, 8:52 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > > In article > > <[EMAIL PROTECTED]>, > > > > [EMAIL PROTECTED] wrote: > > > David C. Ullrich: > > > > Thanks. If I can get it installed and it works as advertised

wxPython pop--up ("could not retrieve information...")

2008-08-07 Thread mistersulu
Hi all: I'm using a wx.ListView object with a multi-threaded wxPython app. The list is dynamically generated and accessed across two or more threads. In spite of the fact that I have checks to see if an item at a given index is in the list and the entire set of logic is contained within a try: ex

Fastest way to store ints and floats on disk

2008-08-07 Thread Laszlo Nagy
Hi, I'm working on a pivot table. I would like to write it in Python. I know, I should be doing that in C, but I would like to create a cross platform version which can deal with smaller databases (not more than a million facts). The data is first imported from a csv file: the user selects

mktime overflow in March 2008?

2008-08-07 Thread Robert Latest
Here's what happens on my Windows machine (Win XP / Cygwin) at work. I've googled a bit about this problem but only found references to instances where people referred to dates before the Epoch. Of course at home on my Linux box everything works. I know that everything has its limits somewhere, b

Re: benchmark

2008-08-07 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Is there any reason why the psyco is not a part of the core python feature set ? Psyco was a PhD project. I do not believe the author ever offered it. Last I knew, it was almost but not completely compatible. Is there a particular reason it is better to be kept

Create a short way to save typing script over and over....

2008-08-07 Thread frankrentef
I have a statement "url = 'http://xyzserver/'" so in my code every time I need to use xyzserver I state "url +" What I' m now trying to do is create a call to a login process. The script for the login process is below. I'd like to call "adminlogin" and not have to keep entering the same se

Re: Limits of Metaprogramming

2008-08-07 Thread Wilson
On Aug 6, 6:04 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 6, 7:24 am, Wilson <[EMAIL PROTECTED]> wrote: > > > > > On Aug 4, 9:23 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > On Aug 4, 1:57 pm, Wilson <[EMAIL PROTECTED]> wrote: > > > > > On Aug 4, 6:49 pm, castironpi <[EMAIL PROTECTED]>

Re: wxPython pop--up ("could not retrieve information...")

2008-08-07 Thread Timothy Grant
On Thu, Aug 7, 2008 at 11:36 AM, mistersulu <[EMAIL PROTECTED]> wrote: > Hi all: > > I'm using a wx.ListView object with a multi-threaded wxPython app. > The list is dynamically generated and accessed across two or more > threads. In spite of the fact that I have checks to see if an item at > a gi

Re: A question about string and float number

2008-08-07 Thread Wei Guo
Hi Thanks for Tyler and Edwin's help. For my questions, I need to import some xml file and there are floating number and strings in it. I need to process string and number differently. This is reason that I am asking question here. Is this background information we need for this quesions. Btw, wh

Re: Best practise implementation for equal by value objects

2008-08-07 Thread Terry Reedy
Slaunger wrote: On 6 Aug., 21:36, Terry Reedy <[EMAIL PROTECTED]> wrote: OK, the situation is more complicated than that then. In the case here though, the attributes would always be sinmple bulit-in types, where eval(repr(x))==x or, where the attribute is a user-defined equal-by-value class

Re: mktime overflow in March 2008?

2008-08-07 Thread M.-A. Lemburg
On 2008-08-07 20:40, Robert Latest wrote: Here's what happens on my Windows machine (Win XP / Cygwin) at work. I've googled a bit about this problem but only found references to instances where people referred to dates before the Epoch. Of course at home on my Linux box everything works. I know

Re: mktime overflow in March 2008?

2008-08-07 Thread Wojtek Walczak
Dnia 7 Aug 2008 18:40:10 GMT, Robert Latest napisa�(a): t = time.strptime("Mar 30, 2008 2:43:32 am", "%b %d, %Y %I:%M:%S %p") time.mktime(t) > Traceback (most recent call last): > File "", line 1, in > OverflowError: mktime argument out of range time module is written in C.

Re: Fastest way to store ints and floats on disk

2008-08-07 Thread M.-A. Lemburg
On 2008-08-07 20:41, Laszlo Nagy wrote: Hi, I'm working on a pivot table. I would like to write it in Python. I know, I should be doing that in C, but I would like to create a cross platform version which can deal with smaller databases (not more than a million facts). The data is first i

Re: Best practise implementation for equal by value objects

2008-08-07 Thread Paul Rubin
Terry Reedy <[EMAIL PROTECTED]> writes: > So when the initializers for instances are all 'nice' (as for range), > go for it (as in 'Age(10)'). And test it as you are by eval'ing the > rep. Just accept that the eval will only work in contexts with the > class name bound to the class. For built-in

Re: benchmark

2008-08-07 Thread bearophileHUGS
alex23: > Honestly, performance benchmarks seem to be the dick size comparison > of programming languages. I don't agree: - benchmarks can show you what language use for your purpose (because there are many languages, and a scientist has to choose the right tool for the job); - it can show where a

Re: Problem obtaining an object reference...

2008-08-07 Thread Terry Reedy
SamG wrote: I have two windowing classes A and B. Inside A's constructor i created an instance B to display its Modal window. Only on clicking OK/ Closing this modal window do i proceed to display the A's window. All that is fine. Now the problem is i would like to write a python script to te

Re: cache-like structure

2008-08-07 Thread konstantin
> And if you change the deque for a Queue.Queue, you don't even need a > Lock... > > Cheers, > > Maxime Maxime, thanks, sched module could be a nice solution. I've never used it before but it seems to be the right way. You guessed right. I want to used it in Queue. But this implementation does no

Re: Books to begin learning Python

2008-08-07 Thread Samir
> > There's lots of good books to read, including a few online ones. A lot > > of people like "Dive Into Python" (http://diveintopython.org/). If you > > want LOTS of information and some good code examples, Lutz's > > "Programming Python 3rd Ed" is great. > > I have the 2nd edition. Has the 3rd ed

Re: mktime overflow in March 2008?

2008-08-07 Thread John Machin
On Aug 8, 4:40 am, Robert Latest <[EMAIL PROTECTED]> wrote: > Here's what happens on my Windows machine (Win XP / Cygwin) at work. > I've googled a bit about this problem but only found references to > instances where people referred to dates before the Epoch. > > Of course at home on my Linux box

Re: .cpp to .pyd

2008-08-07 Thread Carl Banks
On Aug 7, 3:25 am, [EMAIL PROTECTED] wrote: > Hello, > > I want to build my C++ (.cpp) script to (.pyd) like this: > > http://en.wikibooks.org/wiki/Python_Programming/Extending_with_C%2B%2B > > I have installed "Microsoft Visual studio .NET 2003" and "Boost > Python" and then after I run my setup s

Re: wxPython pop--up ("could not retrieve information...")

2008-08-07 Thread Frank Niessink
Hi, 2008/8/7 mistersulu <[EMAIL PROTECTED]>: > Is there a setting somewhere in wxPython to either disable these pop- > up messages or a semaphore or event locking method to enable cross- > thread access to a listview object? Maybe this helps: http://wiki.wxpython.org/LongRunningTasks ? Cheers, F

Re: HTTP basic authentication with form-based authentication

2008-08-07 Thread Wojtek Walczak
Dnia Thu, 7 Aug 2008 11:14:05 -0700 (PDT), Max napisa�(a): > Following the tutorial at http://personalpages.tds.net/~kent37/kk/00010.html, > I understand how to access HTTP basic authenticated pages or form- > based authenticated pages. How would I access a page protected by both > form-based authe

kill thread

2008-08-07 Thread Mathieu Prevot
Hi, I have a threading.Thread class with a "for i in range(1,50)" loop within. When it runs and I do ^C, I have the error [1] as many as loops. I would like to catch this exception (and if possible do some cleanup like in C pthreads) so the program finishes cleanly. Where and how can I do this ? i

  1   2   >