Re: how to strip the domain name in python?

2007-04-15 Thread Michael Bentley
On Apr 15, 2007, at 4:24 PM, [EMAIL PROTECTED] wrote: > On Apr 15, 11:57 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> In <[EMAIL PROTECTED]>, >> Marko.Cain.23 >> wrote: >> >> >> >>> On Apr 14, 10:36 am, [EMA

Re: how to check the 'content/type' using urlopen

2007-04-15 Thread Michael Bentley
= urlopen(req) > except IOError, e: > print e > print 'Failed to open %s' % url > return 0; > > else: > data = handle.read() Not absolutely sure about this, but try handle.headers.get('Content- Type') before the rea

Re: how to strip the domain name in python?

2007-04-15 Thread Michael Bentley
On Apr 15, 2007, at 7:57 PM, Michael Bentley wrote: > if net_location[0].lower() == 'www': > net_location = net_location[1:] It is not guaranteed that the host name will be 'www' though, is it? If you *really* want to strip the host portion of a domain n

Re: Portably generating infinity and NaN

2007-04-16 Thread Michael Hoffman
ing any numerical code written in Python. Same for VMS. Do these systems provide infinities or NaN? If so, then fpconst could be extended to include them. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate a continuous string

2007-04-16 Thread Michael Bentley
On Apr 16, 2007, at 5:03 AM, 人言落日是天涯,望极天涯不 见家 wrote: > How to generate a continuous string, like this > "aaa" > the number of characters is dynamic. Is there a module or function > implement this string ? > such as: duplicate_string(char, num) It's even easier than that -- j

Re: subprocess confusion

2007-04-16 Thread Michael Hoffman
sh %s %s" % (machine, command) subprocess.check_call(command, shell=True, env=env, stderr=subprocess.STDOUT, stdout=log) The semantics are slightly different, since log will always close this way, while in the other example, you have left it open if there is an exception. -- Michael

Re: getting from command line options to file

2007-04-16 Thread Michael Hoffman
; filename) the most efficient command?? I think the best thing to do would be something like this (Python 2.5): from __future__ import with_statement import subprocess with file("test.out", "w") as outfile: subprocess.check_call(["ls", "/etc"], stdout=ou

Re: C++ extension problem

2007-04-16 Thread Michael Hoffman
ich enables seamless interoperability between C++ and the Python programming language." http://www.boost.org/libs/python/doc/ -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: strange behaviour sys.argv

2007-04-16 Thread Michael Hoffman
our example to only the arguments that change. In doing this you may solve the problem on your own. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: list insertion question

2007-04-16 Thread Michael Hoffman
;a" is a component of it. I imagine you mean (item == "a"). Try this: output = [] for item in data: if item == "d": output.append("dword") output.append(item) if item == "a": output.append("aword") >>> output ['a', 'aword', 'b', 'c', 'dword', 'd', 'a', 'aword', 'b', 'e', 'dword', 'd'] -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Help on Shelve....

2007-04-17 Thread Michael Bentley
On Apr 17, 2007, at 6:52 AM, Clement wrote: > Can i use Shelve for storing large amount of data around 6GB.. Is it > stable...? if any problems come, can i retrive the document.. Do you know for sure your filesystem handles files that big? -- http://mail.python.org/mailman/listinfo/python-list

Re: The smallest and largest values of numeric types

2007-04-17 Thread Michael Hoffman
830053169311564321191305931199741711560688200050463950578047164169337729650765802242049L Of course performance decreases for longer longs. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary file output using python

2007-04-17 Thread Michael Hoffman
extremely space inefficient. I recommend using PyTables for this sort of thing. It also allows you to choose from several compression algorithms. I'm using it to store files with 22000 x (2000, 12) datasets, or 528 million Float64s. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary file output using python

2007-04-17 Thread Michael Hoffman
Michael Hoffman wrote: > Chi Yin Cheung wrote: >> Hi, >> Is there a way in python to output binary files? I need to python to >> write out a stream of 5 million floating point numbers, separated by >> some separator, but it seems that all python supports natively is &

Re: Strange terminal behavior after quitting Tkinter application

2007-04-18 Thread Michael Bentley
On Apr 18, 2007, at 2:33 AM, Chris wrote: > > I'm puzzled by some strange behavior when my Python/Tkinter > application quits (on linux): the terminal from which I started Python > is messed up. > > If start up python, then import the code below, then start the program > with Application(), then

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
the formula (-b +/- sqrt(b**2 - 4*a*c))/2*a will give you inaccurate results sometimes. See <http://www.cse.uiuc.edu/eot/modules/floating_point/quadratic_formula/>. For a better formula, see how r_1 and r_2 are defined in <http://en.wikipedia.org/wiki/Quadratic_equation#Alter

Re: Help on Shelve....

2007-04-18 Thread Michael Bentley
On Apr 18, 2007, at 8:19 AM, Clement wrote: > On Apr 17, 5:52 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: >> On Apr 17, 2007, at 6:52 AM, Clement wrote: >> >>> Can i useShelvefor storing large amount of data around 6GB.. Is it >>> stable...? if any pr

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> In floating point arithmetic, the naive way of calculating both roots >> always using the formula (-b +/- sqrt(b**2 - 4*a*c))/2*a will give you >> inaccurate results sometimes. See >> <http://www.cse.uiuc.edu/eot/modules/floating_point/quadrati

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> For x root use y**(1/x) [Steve Holden] > >>> 3.14159 ** (1/3) > 1.0 > >>> > > So the cube root of pi is 1? I don't think so. > > For generic roots use y ** (1.0 / x) Yes, good point. :) -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: converting currency using locals

2007-04-18 Thread Michael Hoffman
ith national specification, but this could be done > only in python 2.5. Any solution for 2.4? I think you mean locale, for anyone else who was puzzled by this. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

httplib hangs in read / strace says recvfrom()

2007-09-13 Thread Michael Bacarella
tplib.py from Python 2.3 and also dropped in the one from Python 2.5 with no difference. Running on Linux kernel 2.6 (CentOS's, specifically). Any responses CC me as I'm not subscribed [since Python has worked so flawlessly for me otherwise ] -- Michael Bacarella <[EMAIL PROTECTE

Re: subclass of integers

2007-09-14 Thread Michael Spencer
nt() Traceback (most recent call last): File "", line 1, in File "", line 6, in _all_binops TypeError >>> Getting back to your question, you can indeed override int.__new__ to return something other than a raw int. This explains how and why: http://www.python.o

calling locale.setlocale repeatedly

2007-09-15 Thread Michael Goerz
s the "sensitivity of the underlying C locale module"? Thanks, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait For Application Start

2007-09-18 Thread Michael Bentley
On Sep 18, 2007, at 5:40 AM, Francesco Guerrieri wrote: > On 9/18/07, Robert Rawlins - Think Blue > <[EMAIL PROTECTED]> wrote: >> This seems like a very logical method, but I'm not sure how to >> implement it >> into my python code? Is there a simple way to make it wait for >> that file? >> W

Re: I could use some help making this Python code run faster using only Python code.

2007-09-20 Thread Michael Spencer
raise ValueError("action must be 0 or 1") > if (path.exists(fname)): ... ... for line in f: ff.write(line.translate(translation_action)) ... HTH Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing A Process By PID

2007-09-21 Thread Michael Bentley
se() and forget it ever happened... -Michael --- "Those who don't understand UNIX are condemned to reinvent it, poorly." --Henry Spencer -- http://mail.python.org/mailman/listinfo/python-list

Re: notify when process finishes (on unix)

2007-09-30 Thread Michael Bentley
On Sep 30, 2007, at 7:11 AM, bahoo wrote: > I'd like to write a script that sends me an email when a unix (Linux) > process ends running (or CPU drops below some threshold). Could > anyone point me to the relevant functions, or show me an example? man at. -- http://mail.python.org/mailman/lis

Re: which language allows you to change an argument's value?

2007-09-30 Thread Michael Fesser
.oO(Summercool) >I think in Pascal and C, we can never have an >argument modified unless we explicitly allow it, by passing in the >pointer (address) of the argument. Pascal also allows passing by reference, which is done with the keyword 'var' when declaring the function parameters. Object Pasca

Re: List Question

2007-10-02 Thread Michael Bentley
On Oct 2, 2007, at 2:06 PM, brad wrote: > How is this expressed in Python? > > If x is in y more than three times: > print x > > y is a Python list. # Try using help -- help(list) or help(list.count) for instance... if y.count(x) > 3: print x -- http://mail.python.org/mailman/listinf

Re: Using ImageGrab (PIL) to capture screen of remote computer

2007-10-02 Thread Michael Bentley
mehow get ImageGrab to grab the display of the remote computer by specifying the IP address ? No. Unless you're using something like VNC to duplicate the remote computer's screen locally... In which case you're still capturing the screen of the local machine. hth, Michae

Re: generating range of numbers

2007-10-03 Thread Michael Bentley
ort math [pow(2, x) for x in range(math.log(1024, 2) +1)] hth, Michael --- Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. --Brian W. Kernighan -- http://

Re: module confusion

2007-10-03 Thread Michael Spencer
path is set when the os module is imported [C] wrote: > You're right. I was misremembering the behaviour of PyCrypto [J] wrote: > In Matlab you can use function dec2bin, hex2dec, dec2hex bin2dec functions to > convert decimal to binary and heximal etc. [B] wrote: > I believe that is

Re: List of objects X Database

2007-10-03 Thread Michael Bentley
On Oct 3, 2007, at 1:01 PM, MindMaster32 wrote: > I am writing a script that has to read data from an ASCII file of > about 50 Mb and do a lot of searches and calculations with that data. > That would be a classic problem solved by the use of a database > (SQLite would suit just fine), but that w

Re: Dynamically creating class properties

2007-10-04 Thread Michael Spencer
uot;) >>> a.item1 >>> a.item1 = 42 >>> a.item1 42 >>> make_data_property(A,"item2") >>> a.item2 >>> a.item2 = 43 >>> >>> a.item2 43 >>> If you can get this piece working, then multiple attributes should be easy. Then, if you like, you can call your property factory from the metaclass __init__ method. HTH Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: open(.xls file, 'w') so that hyperlinks appear

2007-10-05 Thread Michael Bentley
-- http://mail.python.org/mailman/listinfo/python-list

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-07 Thread Michael Torrie
timw.google wrote: > Hi > > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or > os.system(cmd), I get prompted for my login password. I expected t

Re: Convert obejct string repr to actual object

2007-10-08 Thread Michael Spencer
: The string repr is created by a server outside of my control... This recipe should get you most of what you need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 HTH Michael -- http://mail.python.org/mailman/listinfo/python-list

Python on embedded system

2007-10-10 Thread Michael Trimarchi
and how to avoid the installation of a lot of not useful py file. It is possible to reduce the size of python enviroment? Regards Michael ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyouc

Is there a better way to implement this:

2007-01-22 Thread Michael Yanowitz
max_run_time of 30 seconds. Unhandled exception in thread started by Traceback (most recent call last): File "./testthread.py", line 10, in abort raise thread_finished MAX RUN TIME EXCEEDED! HELLO 30 HELLO 31 HELLO 32 Thanks in advance: Michael Yanowitz -- http://mail.python.org/mailman/listinfo/python-list

RE: Is there a better way to implement this:

2007-01-22 Thread Michael Yanowitz
. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Benjamin Niemann Sent: Monday, January 22, 2007 11:19 AM To: [email protected] Subject: Re: Is there a better way to implement this: Michael Yanowitz wrote: > Hello: > >I wrote the code be

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-23 Thread Michael Bentley
On Jan 23, 2007, at 4:01 PM, Daniel Jonsson wrote: > So, I've reached the point where my building pipeline tools actually > needs to be used by other people in my company. By this reason I > actually need to think about the usability, and I've come to the > conclusion that I need a GUI. So, which

Re: Mounting shares with python

2007-01-26 Thread Michael Bentley
-t smbfs -o username=nobody ..."). Otherwise (if you must use a password for sudo -- or if you don't have sudo), you can use popen2 module to spawn a process you can interact with. -michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Overloading assignment operator

2007-01-29 Thread Michael Spencer
on&q=knights+ni http://groups.google.com/group/comp.lang.python/search?group=comp.lang.python&q=larch Idly yours, Michael -- http://mail.python.org/mailman/listinfo/python-list

RE: division by 7 efficiently ???

2007-02-01 Thread Michael Yanowitz
1 >>> div7 (14) 1 >>> div7 (21) 2 >>> div7 (700) 98 >>> div7 (7000) 984 Michael Yanowitz -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Krypto Sent: Thursday, February 01, 2007 3:25 PM To: [email protected] Subjec

Re: LDAP/LDIF Parsing

2007-02-02 Thread Michael Ströder
us how this works, i cannot see much documentation, and > it seems to be deprecated...). Module ldif is not deprecated. It's actively maintained by me like the rest of python-ldap. It parses LDIF and returns the same data structure as above. You don't need it for LDAP access anyway. Only for reading LDIF files. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

using numpy to do linear algebra

2007-02-02 Thread Michael O'Brien
Hola~ I have a large array of points (over a million). I would like to multiply each point in the array by a 4x4 matrix. I keep thinking there should be an easy way to do this using numpy, but I can't figure out the mojo to do it. Is that possible? MO -- http://mail.python.org/mailman/listinfo/

Re: strange test for None

2007-02-03 Thread Michael Bentley
d you might also wrap your call to int(ims) in a try block. HTH, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: LDAP/LDIF Parsing

2007-02-05 Thread Michael Ströder
Bruno Desthuilliers wrote: > > If you know which attributes are supposed to be multivalued in your > specific application, then it's time to write a more serious, > application-specific wrapper. ldap.schema can be used to find that out. Ciao, Michael. -- http://mail.python.org

Watch folder for new file and execute extern program

2007-02-05 Thread Michael Bo
Hi. Can anyone guide me on how to minitor a folder for new files? And when they appear I need to run and externe program with the file just created (buy a 3rd program). - Michael Bo -- http://mail.python.org/mailman/listinfo/python-list

Re: Watch folder for new file and execute extern program

2007-02-07 Thread Michael Bo
> BTW-It helps us out here if you let us know what platform you > are running on (e.g. Windows, Linux, Mac, etc.). > > -Larry Sorry... I'm running on windows XP. - Michael -- http://mail.python.org/mailman/listinfo/python-list

Putting wxFrame on the second monitor

2007-02-12 Thread Michael Butscher
monitor even if the main frame is on the second. Any hints what I can do here? TIA Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: python not returning true

2007-02-14 Thread Michael Bentley
On Feb 14, 2007, at 3:08 AM, John Machin wrote: > So "enlightenment" has been verbed, has it? I didn't realise that the > language had been transitioned so far :-) *ALL* nouns may be verbed ;-) -michael --- # Something just doesn't seem right in those # "Every ki

Re: conver string to dictionary

2007-02-18 Thread Michael Bentley
On Feb 18, 2007, at 12:44 AM, mahdieh saeed wrote: I want to convert string to dictionary .what is the best solution for this ? for example string is like this: '{"SalutationID":["primarykey",8388607,0,None],"CompanyID": [0,8388607,0,"index"], "SalutationName":["",255,0,None],"isDefault":[

Re: Curses sorely lacking an event loop?

2007-02-27 Thread Michael Zawrotny
andler that updates the screen when that signal arrives. Mike -- Michael Zawrotny Institute of Molecular Biophysics Florida State University| email: [EMAIL PROTECTED] Tallahassee, FL 32306-4380 | phone: (850) 644-0069 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Source Code Beautifier

2007-02-27 Thread Michael Spencer
not" to "!=" (ok a find replace could do that > easily also), but in a program that would be more comfortable. careful! >>> (1,2,3) == (1,2,3) True >>> (1,2,3) is (1,2,3) False >>> Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use list as key of dictionary?

2007-11-06 Thread Michael Wronna
On Tue, 6 Nov 2007, Boris Borcic wrote: >> We know that list cannot be used as key of dictionary. > Yeah, but do we know why ? I think, because lists are mutable and a key of a dictionary MUST be unmutable, not to crash the dictionary by accidently changing one of its keys! Mike -- http://mai

Populating huge data structures from disk

2007-11-06 Thread Michael Bacarella
For various reasons I need to cache about 8GB of data from disk into core on application startup. Building this cache takes nearly 2 hours on modern hardware. I am surprised to discover that the bottleneck here is CPU. The reason this is surprising is because I expect something like this to

RE: Populating huge data structures from disk

2007-11-06 Thread Michael Bacarella
> > For various reasons I need to cache about 8GB of data from disk into core on > > application startup. > > Are you sure? On PC hardware, at least, doing this doesn't make any > guarantee that accessing it actually going to be any faster. Is just > mmap()ing the file a problem for some reason? >

RE: How do I get the PC's Processor speed?

2007-11-06 Thread Michael Bacarella
> On the problem PCs, both of these methods give me the same information > (i.e. only the processor name). However, if I go to "System > Properties" and look at the "General" tab, it lists the CPU name and > processor speed. Does anyone else know of another way to get at this > information? This i

RE: Populating huge data structures from disk

2007-11-06 Thread Michael Bacarella
> Note that you're not doing the same thing at all. You're > pre-allocating the array in the C code, but not in Python (and I don't > think you can). Is there some reason you're growing a 8 gig array 8 > bytes at a time? > > They spend about the same amount of time in system, but Python spends 4.7

RE: How do I get the PC's Processor speed?

2007-11-06 Thread Michael Bacarella
> > This information is hardware dependent and probably unreliable. > > > > Why not run a benchmark and report the results instead? > > Like bogomips? http://en.wikipedia.org/wiki/Bogomips> > > That's an interesting idea, but this is in a login script, so I can't > exactly run benchmarks while lo

RE: Populating huge data structures from disk

2007-11-06 Thread Michael Bacarella
> > Very sure. If we hit the disk at all performance drops > > unacceptably. The application has low locality of reference so > > on-demand caching isn't an option. We get the behavior we want when > > we pre-cache; the issue is simply that it takes so long to build > > this cache. > > The way I

RE: Using python as primary language

2007-11-08 Thread Michael Bacarella
> > How do you feel about multithreading support? > > > > A multithreaded application in Python will only use a single CPU on > > multi-CPU machines due to big interpreter lock, whereas the "right > thing" > > happens in Java. > > Note that this is untrue for many common uses of threading (e.g. u

RE: Using python as primary language

2007-11-08 Thread Michael Bacarella
> In our company we are looking for one language to be used as default > language. So far Python looks like a good choice (slacking behind > Java). A few requirements that the language should be able cope with > are: How do you feel about multithreading support? A multithreaded application in Pyt

RE: Using python as primary language

2007-11-08 Thread Michael Bacarella
> > > > A multithreaded application in Python will only use a single CPU > on > > > > multi-CPU machines due to big interpreter lock, whereas the > "right > > > thing" > > > > happens in Java. > > > > > > Note that this is untrue for many common uses of threading (e.g. > using > > > threads to wait

Populating a dictionary, fast

2007-11-10 Thread Michael Bacarella
The id2name.txt file is an index of primary keys to strings. They look like this: 11293102971459182412:Descriptive unique name for this record\n 950918240981208142:Another name for another record\n The file's properties are: # wc -l id2name.txt 8191180 id2name.txt # du -h id2name.txt 517M

Re: Populating a dictionary, fast

2007-11-10 Thread Michael Bacarella
> That's an awfully complicated way to iterate over a file. Try this > instead: > > id2name = {} > for line in open('id2name.txt'): >id,name = line.strip().split(':') >id = long(id) >id2name[id] = name > > > This takes about 45 *minutes* > > > On my system, it takes about a minute an

Re: Populating a dictionary, fast

2007-11-11 Thread Michael Bacarella
> - Original Message > From: Paul Rubin <http://[EMAIL PROTECTED]> > To: [email protected] > Sent: Sunday, November 11, 2007 12:45:44 AM > Subject: Re: Populating a dictionary, fast > > Michael Bacarella <[EMAIL PROTECTED]> writes: > > If on

Re: Populating a dictionary, fast

2007-11-11 Thread Michael Bacarella
> Steven D'Aprano wrote: > > (2) More memory will help avoid paging. If you can't get more memory, try > > more virtual memory. It will still be slow, but at least the operating > > system doesn't have to try moving blocks around as much. > > Based on his previous post, it would seem he has 7GB

Re: Populating a dictionary, fast

2007-11-11 Thread Michael Bacarella
Firstly, thank you for all of your help so far, I really appreciate it. > > So, you think the Python's dict implementation degrades towards O(N) > > performance when it's fed millions of 64-bit pseudo-random longs? > > No. Yes. I tried your code (with one change, time on feedback lines) and go

Re: Populating a dictionary, fast

2007-11-11 Thread Michael Bacarella
> > This would seem to implicate the line id2name[id] = name as being excruciatingly slow. > > As others have pointed out there is no way that this takes 45 > minutes.Must be something with your system or setup. > > A functionally equivalent code for me runs in about 49 seconds! > (it ends up usi

Re: Populating a dictionary, fast

2007-11-11 Thread Michael Bacarella
> > I tried your code (with one change, time on feedback lines) and got the > > same terrible > > performance against my data set. > > > > To prove that my machine is sane, I ran the same against your generated >> sample file and got _excellent_ performance. Start to finish in under a minute.

RE: Populating a dictionary, fast [SOLVED]

2007-11-12 Thread Michael Bacarella
> id2name[key >> 40][key & 0x100] = name Oops, typo. It's actually: Id2name[key >> 40][key & 0xff] = name -- http://mail.python.org/mailman/listinfo/python-list

RE: Populating a dictionary, fast

2007-11-12 Thread Michael Bacarella
> > and see it take about 45 minutes with this: > > > > $ cat cache-keys.py > > #!/usr/bin/python > > v = {} > > for line in open('keys.txt'): > > v[long(line.strip())] = True > > On my system (windows vista) your code (using your data) runs in: > > 36 seconds with python 2.4 > 25 seconds

RE: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-12 Thread Michael Bacarella
> > You can download the list of keys from here, it's 43M gzipped: > > http://www.sendspace.com/file/9530i7 > > > > and see it take about 45 minutes with this: > > > > $ cat cache-keys.py > > #!/usr/bin/python > > v = {} > > for line in open('keys.txt'): > > v[long(line.strip())] = True

RE: Populating a dictionary, fast [SOLVED]

2007-11-13 Thread Michael Bacarella
See end for solution. > >> (3) Are you sure you need all eight-million-plus items in the cache > >> all at once? > > > > Yes. > > I remain skeptical, but what do I know, I don't even know what you're > doing with the data once you have it :-) It's OK, I'd be skeptical too. ;) > $ cat /proc/cpui

RE: Populating a dictionary, fast [SOLVED]

2007-11-13 Thread Michael Bacarella
> Shouldn't this be: > > id2name[key >> 40][key & 0xff] = name Yes, exactly, I had done hex(pow(2,40)) when I meant hex(pow(2,40)-1) I sent my correction a few minutes afterwards but Mailman queued it for moderator approval (condition with replying to myself?) -- http://mail.pytho

RE: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-15 Thread Michael Bacarella
> On Nov 15, 2:11 pm, Istvan Albert <[EMAIL PROTECTED]> wrote: > > There is nothing wrong with neither creating nor deleting > > dictionaries. > > I suspect what happened is this: on 64 bit > machines the data structures for creating dictionaries > are larger (because pointers take twice as much s

RE: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-15 Thread Michael Bacarella
> On Thu, 15 Nov 2007 15:51:25 -0500, Michael Bacarella wrote: > > > Since some people missed the EUREKA!, here's the executive summary: > > > > Python2.3: about 45 minutes > > Python2.4: about 45 minutes > > Python2.5: about _30 seconds_ &g

RE: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-16 Thread Michael Bacarella
> Do you really believe that you cannot create or delete a large > dictionary with python versions less than 2.5 (on a 64 bit or multi- > cpu system)? That a bug of this magnitude has not been noticed until > someone posted on clp? You're right, it is completely inappropriate for us to be showing

Re: What is python?????

2007-11-17 Thread michael poeltl
On Saturday 17 November 2007 01:32:52 pm Cope wrote: > On Nov 17, 5:00 pm, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > > On 11/17/07, Cope <[EMAIL PROTECTED]> wrote: > > > In our place we eat pythons for curry. Its delicious. > > > And how about your python? > > > > > > Cope > > > > Not much of the

weave and compiler install help

2007-11-19 Thread Michael ODonnell
any direction someone can give me because I have not been able to figure out a work around. PS. I have also posted this on scipy list and have not received any feedback. Thank you, Michael + I have the following related

Re: Research-oriented Python mailing list?

2007-11-22 Thread Michael Tobis
Perhaps what you are looking for is here: http://www.scipy.org/Mailing_Lists mt -- http://mail.python.org/mailman/listinfo/python-list

Re: may be a bug in string.rstrip

2007-11-22 Thread michael poeltl
m kyo guan wrote: > Hi : > > Please look at this code: > >>> 'exe.torrent'.rstrip('.torrent') > > 'ex' <- it should be 'exe', why? > > but this is a right answer: > >>> '120.exe

Greylisting with Kamaelia (was Re: Python North-West meeting - 6 november 18.30)

2007-11-25 Thread Michael Sparks
Giacomo Lacava wrote: > New meeting of the Python North-West UK community! > > This month's talk is: > - Michael Sparks on "Greylisting with Kamaelia" - Just a small note that the slides from this are now up here: http://www.slideshare.net/kamaelian/kamaelia-grey

A context manager for temporary memoization.

2007-11-29 Thread Michael Speer
I posted this to my blog at http://michaelspeer.blogspot.com/2007/11/context-manager-for-temporary.html. I decided to forward it onto the list for comments. I thought someone might find it interesting. *** This is very much a fragile hack at the moment. It's an interesting idea I think. I was d

Re: Interfaces to high-volume discussion forums

2007-11-30 Thread Michael Spencer
it to achieve this benefit. Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Interfaces to high-volume discussion forums

2007-12-01 Thread Michael Spencer
Dennis Lee Bieber wrote: > On Fri, 30 Nov 2007 11:36:44 -0800, Michael Spencer >> >> Can anyone recommend a solution that also synchronizes post read status? If >> Google Reader or something like it handled NNTP, I imagine I'd use it to >> achieve >>

Multiple Windows in Pygame, using true concurrency in python via Kamaelia

2007-12-01 Thread Michael Sparks
server is aiming for WSGI compliance, and the project also had a small number of students working over the summer, assisting with some useful things like AIM/IRC integration, the ability to use Kamaelia systems in non-Kamaelia based scripts/systems, and looking at a sub-component model. (ie non-concurr

Re: [OT] minimalist web server

2007-12-02 Thread Michael Ströder
e file of that > name, which isn't what the OP wanted. But it's very easy to override the handler method and return the 404 for each and every request. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

converting to and from octal escaped UTF--8

2007-12-02 Thread Michael Goerz
e_escape') but there doesn't seem to be any similar method for getting the octal escaped version. Thanks, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread Michael Goerz
Michael Goerz wrote: > Hi, > > I am writing unicode stings into a special text file that requires to > have non-ascii characters as as octal-escaped UTF-8 codes. > > For example, the letter "Í" (latin capital I with acute, code point 205) > would come out as "

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread Michael Goerz
MonkeeSage wrote: > Looks like escape() can be a bit simpler... > > def escape(s): > result = [] > for char in s: > result.append("\%o" % ord(char)) > return ''.join(result) > > Regards, > Jordan Very neat! Thanks a lot... Michael

Re: converting to and from octal escaped UTF--8

2007-12-02 Thread Michael Spencer
Michael Goerz wrote: > Hi, > > I am writing unicode stings into a special text file that requires to > have non-ascii characters as as octal-escaped UTF-8 codes. > > For example, the letter "Í" (latin capital I with acute, code point 205) > would come out as "

Re: converting to and from octal escaped UTF--8

2007-12-03 Thread Michael Goerz
MonkeeSage wrote: > On Dec 3, 1:31 am, MonkeeSage <[EMAIL PROTECTED]> wrote: >> On Dec 2, 11:46 pm, Michael Spencer <[EMAIL PROTECTED]> wrote: >> >> >> >>> Michael Goerz wrote: >>>> Hi, >>>> I am writing unicode stings into a

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread Michael Terry
lly wasn't a scientist, great. But to suggest that Newton is a myth of the hard sciences kind of misses the point of his fame. Michael On Dec 3, 2007 1:31 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 02 Dec 2007 13:29:58 -0800, Russ P. wrote: > > >> He mi

Re: newbie:this program stops responding after pressing quit button

2007-12-04 Thread Michael Speer
ers to it. Load up your interpreter and play with it interactively. Remember the dir( object ) command will give a full listing of the attributes of any given object. Looking at object.__doc__ will give you the documentation. There's probably something in there to hide the window if that

Re: Why Python 3?

2007-12-05 Thread Michael Spencer
Kay Schluehr wrote: > > This unexpected attack in his rear frightened him so much, that he > leaped forward with all his might: the horse's carcase dropped on the > ground, but in his place the wolf was in the harness, and I on my part > whipping him continually: we both arrived in full career saf

python 2.4 and compiler combatability

2007-12-05 Thread Michael ODonnell
. Before I go through all this can someone give me some insight on if this is possible. I have not compiled python itself and I am new at this so I don't really know all the in and outs. Thank you for you help, Mi

Re: Problem with generator expression and class definition

2007-12-07 Thread Michael Spencer
gt; > | Any comment ? I'm ready to report it as a bug if there is no objection. > > If this is in 2.5.2, (and not one else objects), go ahead. > > tjr > > > This behavior is by design (after much much discussion, as Terry says). See http://www.python.org/dev/peps/pep-0289/#early-binding-versus-late-binding and the threads it references. Michael -- http://mail.python.org/mailman/listinfo/python-list

<    32   33   34   35   36   37   38   39   40   41   >