Re: how to find out if an object is a class?

2008-08-07 Thread Stefan Behnel
Ben Finney wrote: > szczepiq writes: > >> Pardon me for most likely a dummy question but how do I find out if >> an object is a class? > > Presumably you want to know whether it's a class in order to use it > for instantiating it. It is usually more Pythonic to use the object as > intended, and a

RE: very newbie question

2008-08-07 Thread Peter Anderson
Try this: # The player tries to guess it and the computer lets # the player know if the guess is too high, too low # or right on the money import random print "\tWelcome to 'Guess My Number'!" print "\nI'm thinking of a number between 1 and 100." print "Try to guess it in as few attempts as pos

Re: benchmark

2008-08-07 Thread sturlamolden
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-comparison-c-java-p... And how does this reflect the perfor

Re: benchmark

2008-08-07 Thread Dhananjay
On Aug 7, 11:58 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >  > Are there any implications of using psyco ? > > It compiles statements to machine code for each set of types used in the > statement or code block over the history of the run.  So code used > polymorphically

Re: random numbers according to user defined distribution ??

2008-08-07 Thread sturlamolden
Alex 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 :-( There exist some very general algorithms to generate random numbers from arbitrary distribution

Re: how to find out if an object is a class?

2008-08-07 Thread Terry Reedy
Carl Banks wrote: On Aug 7, 8:56 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: That is only true and only works for 2.x old-style classes and not for 2.x new-style classes and all 3.0 classes, for which isinstance(Q,type) is True. isinstance(Q,type) is also true for built in types and C exten

Re: kill thread

2008-08-07 Thread Miki
Hello, > 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

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

2008-08-07 Thread Sean DiZazzo
On Aug 7, 11:56 am, frankrentef <[EMAIL PROTECTED]> wrote: > 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

Re: how to find out if an object is a class?

2008-08-07 Thread Carl Banks
On Aug 7, 8:56 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Wojtek Walczak wrote: > > Dnia Thu, 7 Aug 2008 14:36:37 -0700 (PDT), szczepiq napisa (a): > >> Pardon me for most likely a dummy question but how do I find out if an > >> object is a class? > > > Use types.ClassType: > > class Q: > >

Re: Parsing of a file

2008-08-07 Thread Tommy Grav
On Aug 7, 2008, at 12:52 PM, Mike Driscoll wrote: I'm well aware of the split() method and built-ins, however since this appeared to be a homework-type question and I was at work, I didn't spend any time on the issue. The only reason I mentioned McGuire's PyParsing module was because I had just

Psyco , not Psycho (was Re: Psycho question)

2008-08-07 Thread Terry Reedy
For the benefit of those trying to find, download, and import the module, its name is psyco (no 'h'), not psycho . http://psyco.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find out if an object is a class?

2008-08-07 Thread Terry Reedy
Wojtek Walczak wrote: Dnia Thu, 7 Aug 2008 14:36:37 -0700 (PDT), szczepiq napisa�(a): Pardon me for most likely a dummy question but how do I find out if an object is a class? Use types.ClassType: class Q: ...pass ... import types isinstance(Q, types.ClassType) True That is only t

Re: how to find out if an object is a class?

2008-08-07 Thread Ben Finney
szczepiq <[EMAIL PROTECTED]> writes: > Pardon me for most likely a dummy question but how do I find out if > an object is a class? You can test using 'isinstance'. However, using that is a bad code smell, which requires investigation as to the reason. Presumably you want to know whether it's a c

Re: A question about string and float number

2008-08-07 Thread Wei Guo
Hi Grant, I am using the try/exception and just curious why function type doesn't work. Best regards, Wei On 8/7/08, Timothy Grant <[EMAIL PROTECTED]> wrote: > > That's because s IS a string. It's not been converted to a float. > > In [1]: s = '3.1415' > In [2]: n = float(s) > In [3]: type(s)

RE: Psycho question

2008-08-07 Thread Delaney, Timothy (Tim)
David C. Ullrich wrote: > f: 0.0158488750458 > g: 0.000610113143921 > h: 0.00200295448303 > f: 0.0184948444366 > g: 0.000257015228271 > h: 0.00116610527039 I suspect you're hitting the point of diminishing returns with g, and any further investigations into optimisation are purely for fun and lea

Creating a single python executable file

2008-08-07 Thread A. Joseph
I have used py2exe and it create .exe file with so many other files, but what i really want is, creating just a single file, imagine writing a small email sending program and after using py2exe you have many file with the your source code zipped side, if there is a way of making it a single executa

Re: Fastest way to store ints and floats on disk

2008-08-07 Thread Emile van Sebille
Laszlo Nagy wrote: Hi, I'm working on a pivot table. Hmm... I wrote an browser based analysis tool and used the working name pyvot... I found Numeric to provide the best balance of memory footprint and speed. I also segregated data prep into a separate process to avoid excessive memor

Re: A question about string and float number

2008-08-07 Thread Timothy Grant
That's because s IS a string. It's not been converted to a float. In [1]: s = '3.1415' In [2]: n = float(s) In [3]: type(s) Out[3]: In [4]: type(n) Out[4]: Why are you avoiding the very simple try:/except: solution to this problem? On Thu, Aug 7, 2008 at 1:28 PM, Wei Guo <[EMAIL PROTECTED]> wr

tkinter, askopenfilename, initial directory

2008-08-07 Thread Lisa Frauens
I see there is an initial directory option in askopenfilename. However, I want the initial directory to be the last directory used in a prior execution of my script. Is there a way to force the askopenfilename to the previous initial directory easily using information somewhere (I know Window

Re: how to find out if an object is a class?

2008-08-07 Thread Wojtek Walczak
Dnia Thu, 7 Aug 2008 14:36:37 -0700 (PDT), szczepiq napisa�(a): > Pardon me for most likely a dummy question but how do I find out if an > object is a class? Use types.ClassType: >>> class Q: ...pass ... >>> import types >>> isinstance(Q, types.ClassType) >>> True -- Regards, Wojtek Walcza

how to find out if an object is a class?

2008-08-07 Thread szczepiq
Pardon me for most likely a dummy question but how do I find out if an object is a class? I need something like that: def foo(self, obj): if (obj is a class): some stuff -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for the first few letters of a string

2008-08-07 Thread Jean-Paul Calderone
On Thu, 07 Aug 2008 23:08:10 +0200, magloca <[EMAIL PROTECTED]> wrote: John Machin wrote: import re template = '^My name is alex' The ^ is redundant. Didn't the OP want to match only at the beginning of the string? That's why it's "redundant" instead of "incorrect". ;) re.match = match(

Re: random numbers according to user defined distribution ??

2008-08-07 Thread Robert Kern
Alex wrote: 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, t

Re: Limits of Metaprogramming

2008-08-07 Thread castironpi
On Aug 7, 2:01 pm, Wilson <[EMAIL PROTECTED]> wrote: > 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]> wro

Re: Tkinter fullscreen with Mac OS X

2008-08-07 Thread Kevin Walzer
C Martin wrote: On Jul 28, 6:43 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: You could try this, supposing tl is a toplevel: tl.tk.call("::tk::unsupported::MacWindowStyle", "style", tl._w, "plain", "none") I tried this (although, my tl is actually a tk instance): self.tk.call("::tk::unsu

Re: Fastest way to store ints and floats on disk

2008-08-07 Thread castironpi
On Aug 7, 1:41 pm, Laszlo Nagy <[EMAIL PROTECTED]> 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

Re: Testing for the first few letters of a string

2008-08-07 Thread magloca
John Machin wrote: >> import re >> template = '^My name is alex' > > The ^ is redundant. Didn't the OP want to match only at the beginning of the string? m. -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for the first few letters of a string

2008-08-07 Thread John Machin
On Aug 8, 1:53 am, [EMAIL PROTECTED] wrote: > use re module Using re.match instead of str.startswith is overkill. > > import re > template = '^My name is alex' The ^ is redundant. > astring = 'My name is alex, and I like pie' > if re.match(template, astring): > print 'Found it' > else:

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

2008-08-07 Thread Bruno Desthuilliers
frankrentef a écrit : 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 ke

Re: A question about string and float number

2008-08-07 Thread Wei Guo
Hi I tried the first type method but it seens that it doesn't work. Could anyone help me about it? >>> s = '3.145' >>> type(s) == type(float()) False >>> type(s) >>> type(float()) >>> Best regards, Wei On 8/7/08, Wei Guo <[EMAIL PROTECTED]> wrote: > > Hi Thanks for Tyler and Edwin's help. >

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

2008-08-07 Thread Mike Driscoll
On Aug 7, 1:36 pm, 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 given index is i

Re: Books to begin learning Python

2008-08-07 Thread Mike Driscoll
On Aug 7, 1:12 pm, Beliavsky <[EMAIL PROTECTED]> wrote: > 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

Re: os.system question

2008-08-07 Thread Mike Driscoll
On Aug 6, 8:07 pm, 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: Books to begin learning Python

2008-08-07 Thread Wojtek Walczak
Dnia Thu, 7 Aug 2008 11:12:03 -0700 (PDT), Beliavsky napisa�(a): > I have the 2nd edition. Has the 3rd edition been rewritten so that all > of its code will be valid in Python 3? I'd prefer not to buy Python > books that will become obsolete. I guess it's for Python 2.x, but I wouldn't worry about

Re: Books to begin learning Python

2008-08-07 Thread Wojtek Walczak
Dnia Thu, 7 Aug 2008 12:37:55 -0700 (PDT), Samir napisa�(a): > Some good online tutorials that I found really helpful include: You might find it useful: http://linkmingle.com/list/List-of-Free-Online-Python-Books-freebooksandarticles -- Regards, Wojtek Walczak, http://www.stud.umk.pl/~wojtekwa

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

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

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: .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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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]>

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: 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

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

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

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

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

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: 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

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: 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: 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

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: 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 > >

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: 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

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: 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: 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: .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: 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: 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

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

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

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

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: 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: 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: 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: 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 Shawn Milochik
Check out the built-in string.startswith() method. -- http://mail.python.org/mailman/listinfo/python-list

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: 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

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 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: 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: 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

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: 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

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: 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: 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: 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 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: 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

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: 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

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: 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 --

  1   2   >