ANN: encutils 0.9

2009-04-24 Thread Christof Hoeke
what is it -- Encoding detection collection for Python developed mainly for use in cssutils but may be useful standalone too. about this release -- 0.9 is a bugfix release. license --- encutils has a dual-license, please choose whatever you prefer: * encutils

PyAMF 0.4.2 released

2009-04-24 Thread Thijs Triemstra | Collab
The PyAMF team is proud to announce the release of 0.4.2! PyAMF [1] is a lightweight library that allows Flash and Python applications to communicate via Adobe’s ActionScript Message Format. This is a bugfix release [2], see the changelog [3] for the complete list of changes. A brief overview of

Python-URL! - weekly Python news and links (Apr 24)

2009-04-24 Thread Gabriel Genellina
QOTW: ... [C]alling Python Object-Orientated is a bit of an insult :-). I would say that Python is Ego-Orientated, it allows me to do what I want. - Martin P. Hellwig April 25: Python Bug Day A perfect opportunity to get involved in Python development, bring your own issues to

itools 0.60.1 released

2009-04-24 Thread J. David Ibáñez
itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment: itools.abnf itools.i18n itools.stl itools.core itools.ical itools.tmx itools.csv itools.odf

Re: Strange problem when using imp.load_module

2009-04-24 Thread pythoncurious
Well spotted :) That does seem to be the problem. Adding removal of the .pyc file will make the tests pass. I guess that python doesn't use the higher resolution timestamp you can get from at least Solaris when doing 'stat' on a file. Thanks for the help. /Mattias On Apr 23, 10:28 pm, Arnaud

Re: can't find the right simplification

2009-04-24 Thread Lie Ryan
Stef Mientki wrote: hello, I've a program where you can connect snippets of code (which I call a Brick) together to create a program. To make it easier to create these code snippets, I need some simplifications. For simple parameters ( integer, tupple, list etc) this works ok, and is done

Re: best way to compare contents of 2 lists?

2009-04-24 Thread bearophileHUGS
Esmail: oh, I forgot to mention that each list may contain duplicates. Comparing the sorted lists is a possible O(n ln n) solution: a.sort() b.sort() a == b Another solution is to use frequency dicts, O(n): from itertools import defaultdict d1 = defaultdict(int) for el in a: d1[el] += 1

Re: relation class

2009-04-24 Thread Aaron Brady
On Apr 22, 11:34 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 11:52 am, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 12:09 am, Chris Rebert c...@rebertia.com wrote: On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady castiro...@gmail.com wrote: Hi all, I think Python

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Lie Ryan
Steven D'Aprano wrote: On Mon, 20 Apr 2009 15:13:15 -0500, Grant Edwards wrote: I fail to see the difference between length greater than 0 and list is not empty. They are, by definition, the same thing, aren't they? For built-in lists, but not necessarily for arbitrary list-like sequences.

Re: Presentation software for Python code

2009-04-24 Thread Michael Hoffman
alex23 wrote: How do you feel about reStructuredText? If you're open to it, I highly recommend Bruce: http://pypi.python.org/pypi/bruce That looks like it would be perfect. Unfortunately it doesn't seem to work on my Windows laptop: C:\Documents and

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Lie Ryan
Gerhard Häring wrote: len() make it clear that the argument is a sequence. Not necessarily. Classes that overrides __len__ may fool that assumption (well, in python classes that overrides special functions may do anything it is never intended to do). I often think an if item: as is item

Re: Presentation software for Python code

2009-04-24 Thread alex23
On Apr 24, 4:23 pm, Michael Hoffman 4g4trz...@sneakemail.com wrote: That looks like it would be perfect. Unfortunately it doesn't seem to work on my Windows laptop: I don't understand this. OpenGL Extensions Viewer says I have OpenGL 1.5 and the glGenBuffers function. That's a shame, if you

Re: What is the best framework or module in Python for a small GUI based application development?

2009-04-24 Thread CM
On Apr 22, 9:11 am, srinivasan srinivas sri_anna...@yahoo.co.in wrote: Hi, Could you suggest me some modules in Python which can be used to develop GUI based applications? and tell me which could be the best(in terms of efficiency) one for a small GUI based application development? Thanks,

Re: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi John, John Machin sjmac...@lexicon.net writes: The Morton layout wastes space if the matrix is not square. Your 100K x 4K is very non-square. Looks like you might want to use e.g. 25 Morton arrays, each 4K x 4K. What I found was that Morton layout shall be usable, if the shape is

Re: sorting two corresponding lists?

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 2:32 am, Hans DushanthaKumar hans.dushanthaku...@hcn.com.au wrote: Just being pedantic here :) [items[x] for x in [i for i in map(values.index, new_values)]] Is the same as [items[x] for x in map(values.index, new_values)] It's also the same as [items[x] for x in

Re: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi Nick, Nick Craig-Wood n...@craig-wood.com writes: I'd start by writing a function which took (x, y) in array co-ordinates and transformed that into (z) remapped in the Morton layout. This removes the possibility to use the sum() and similar methods of numpy. Implementing them myself is

Re: Regular expression to capture model numbers

2009-04-24 Thread Piet van Oostrum
John Machin sjmac...@lexicon.net (JM) wrote: JM On Apr 24, 1:29 am, Piet van Oostrum p...@cs.uu.nl wrote: obj = re.compile(r'(?:[a-z]+[-0-9]|[0-9]+[-a-z]|-+[0-9a-z])[-0-9a-z]*', re.I) JM Understandable and maintainable, I don't think. Suppose that instead JM the first character is limited

Re: What IDE support python 3.0.1 ?

2009-04-24 Thread Peter Anderson
Sam (I presume), Like you I am also in the process of learning to program in Python. I have been using Python 2.5.2 for quite some time but recently made the switch to 3.0.1. Why? Because I read an article where Guido van Rossum himself recommended that anyone starting out learning Python now

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Piet van Oostrum
John Yeung gallium.arsen...@gmail.com (JY) wrote: JY It takes care of the duplicates, but so does your initial solution, JY which I like best: sorted(a)==sorted(b) JY This is concise, clear, and in my opinion, the most Pythonic. It may JY well even be the fastest. (If you didn't have to

Re: getter and setter and list appends

2009-04-24 Thread Piet van Oostrum
dasacc22 dasac...@gmail.com (d) wrote: d Ah thank you for clarifying, I did confuse instance and class d attributes from creating the list in the class def. I actually just d spiffed up that class to represent a portion of a much larger class d that needs getter and setter for children. Doing as

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Marco Mariani
Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. It's not very hard at the moment, and I don't see lots of eyes flying by. I don't know about Ruby where monkeypatching seems to be

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Steven D'Aprano
On Fri, 24 Apr 2009 06:50:01 +, Lie Ryan wrote: Gerhard Häring wrote: len() make it clear that the argument is a sequence. Not necessarily. len() works on dicts and sets, and they're not sequences. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Steven D'Aprano
On Thu, 23 Apr 2009 21:51:42 -0400, Esmail wrote: set(a) == set(b)# test if a and b have the same elements # check that each list has the same number of each element # i.e. [1,2,1,2] == [1,1,2,2], but [1,2,2,2] != [1,1,1,2] for elem in set(a): a.count(elem) == b.count(elem) Ah

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Steven D'Aprano
On Thu, 23 Apr 2009 10:48:57 -0700, Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. It's not terribly difficult to do so already: def spam(): ... return spam spam spam ...

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Steven D'Aprano
On Thu, 23 Apr 2009 17:18:25 +0800, Leo wrote: There's also the performance issue. I might have a sequence-like structure where calling len() takes O(N**2) time, (say, a graph) but calling __nozero__ might be O(1). Why defeat the class designer's optimizations? Is that true? Calling len()

wxpython notebook oddness

2009-04-24 Thread Lawson English
Can anyone tell me why these two behave differfently? http://pastebin.com/m57bee079 vs http://pastebin.com/m3c044b29 Lawson -- http://mail.python.org/mailman/listinfo/python-list

Raw command line arguments

2009-04-24 Thread Enchanter
How to pass the raw command line arguments to the python? Such as: mypython.py txt -c Test Only {Help} The arguments I hope to get is: txt -c Test Only {Help} -- Keep the quotation marks in the arguments. --

Re: unicode(lString, utf8) vs. lString.encode(utf8) vs. urjakiś tekst

2009-04-24 Thread Jax
Sorry, my mistake. My interntion was post this message on pl.comp.lang.python. Jax -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw command line arguments

2009-04-24 Thread Chris Rebert
On Fri, Apr 24, 2009 at 2:40 AM, Enchanter ensoul.magaz...@gmail.com wrote: How to pass the raw command line arguments to the python? Such as:     mypython.py  txt -c Test Only {Help} The arguments I hope to get is:              txt -c Test Only {Help}               -- Keep the

Convert numpy.ndarray into normal array

2009-04-24 Thread Johannes Bauer
Hi group, I'm confused, kind of. The application I'm writing currently reads data from a FITS file and should display it on a gtk window. So far I have: [...] pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height) pb_pixels = pb.get_pixels_array() print(type(fits_pixels))

if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread GC-Martijn
Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test(): return 'Vla' I searching something like this: if (t = Test()) == 'Vla': print t # Vla or if (t = Test()): print t # Vla

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Steven D'Aprano
On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test(): return 'Vla' I searching something like this: if (t = Test()) == 'Vla':

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Chris Rebert
On Fri, Apr 24, 2009 at 3:00 AM, GC-Martijn gcmart...@gmail.com wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():    return 'Vla' I searching something like this: if (t = Test()) ==

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread GC-Martijn
On 24 apr, 12:11, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():    

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Paul Rubin
Steven D'Aprano st...@remove-this-cybersource.com.au writes: len() works on dicts and sets, and they're not sequences. Of course dicts and sets are sequences. But there are also sequences on which len doesn't work. You could use: sum(1 for x in seq) Of course iterating through seq may have

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Paul Rubin
Chris Rebert c...@rebertia.com writes: Python forces you to do it the long way (the Right Way(tm) if you ask most Python partisans). If you could explain your situation and the context of your question in greater detail, someone might be able to suggest an alternate structure for your code

Re: Raw command line arguments

2009-04-24 Thread Dave Angel
Enchanter wrote: How to pass the raw command line arguments to the python? Such as: mypython.py txt -c Test Only {Help} The arguments I hope to get is: txt -c Test Only {Help} -- Keep the quotation marks in the arguments. As Chris has said, the shell

PDB break

2009-04-24 Thread Ricardo Aráoz
Hi, I need to track where a certain condition is met in a program. Checking on pdb docs I find the break statement : b(reak) [[/filename/:]/lineno/ | /function/[, /condition/]] But it requires me to name a line/function where my condition is tested. Now there are far too many places in a project

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
John Yeung wrote: so does your initial solution, which I like best: sorted(a)==sorted(b) This is concise, clear, and in my opinion, the most Pythonic. It may well even be the fastest. Great .. I can live with that :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Peter Otten
Paul Rubin wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: len() works on dicts and sets, and they're not sequences. Of course dicts and sets are sequences. But there are also sequences on which len doesn't work. That was my intuition, too. But Python takes a different

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Steven D'Aprano
On Fri, 24 Apr 2009 03:22:50 -0700, Paul Rubin wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: len() works on dicts and sets, and they're not sequences. Of course dicts and sets are sequences. Dicts and sets are explicitly described as other containers:

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
MRAB wrote: You could use Raymond Hettinger's Counter class: http://code.activestate.com/recipes/576611/ on both lists and compare them for equality. thanks for the pointer, I'll study the code provided. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread bearophileHUGS
Arnaud Delobelle: Thanks to the power of negative numbers, you only need one dict: d = defaultdict(int) for x in a:     d[x] += 1 for x in b:     d[x] -= 1 # a and b are equal if d[x]==0 for all x in d: not any(d.itervalues()) Very nice, I'll keep this for future use. Someday I'll have

HTTP Authentication using urllib2

2009-04-24 Thread Lakshman
I am trying to authenticate using urllib2. The basic authentication works if I hard code authheaders. def is_follows(follower, following): theurl = 'http://twitter.com/friendships/exists.json? user_a='+follower+'user_b='+following username = 'uname1' password = 'pwd1' handle =

Re: Convert numpy.ndarray into normal array

2009-04-24 Thread MRAB
Johannes Bauer wrote: Hi group, I'm confused, kind of. The application I'm writing currently reads data from a FITS file and should display it on a gtk window. So far I have: [...] pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height) pb_pixels = pb.get_pixels_array()

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Ulrich Eckhardt
Steven D'Aprano wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: t = Test() if (t == 'Vla': print t # must contain Vla What's wrong with that? It unnecessarily injects the name 't' into the scope. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread MRAB
GC-Martijn wrote: On 24 apr, 12:15, Chris Rebert c...@rebertia.com wrote: On Fri, Apr 24, 2009 at 3:00 AM, GC-Martijn gcmart...@gmail.com wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 7:12 am, bearophileh...@lycos.com wrote: [...] Another solution is to use frequency dicts, O(n): from itertools import defaultdict d1 = defaultdict(int) for el in a:     d1[el] += 1 d2 = defaultdict(int) for el in b:     d2[el] += 1 d1 == d2 Thanks to the power of negative

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread GC-Martijn
On 24 apr, 12:15, Chris Rebert c...@rebertia.com wrote: On Fri, Apr 24, 2009 at 3:00 AM, GC-Martijn gcmart...@gmail.com wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():    return

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
Thanks all, after reading all the posting and suggestions for alternatives, I think I'll be going with sorted(a)==sorted(b) it seems fast, intuitive and clean and can deal with duplicates too. Best, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Esmail
Piet van Oostrum wrote: John Yeung gallium.arsen...@gmail.com (JY) wrote: JY It takes care of the duplicates, but so does your initial solution, JY which I like best: sorted(a)==sorted(b) JY This is concise, clear, and in my opinion, the most Pythonic. It may JY well even be the

unicode(lString, utf8) vs. lString.encode(utf8) vs. urjakiś tekst

2009-04-24 Thread Jax
Witam Zakładam, że kod Pythona w drugiej lini ma: # -*- coding: utf-8 -*- oraz gdzieś na początku: reload(sys) sys.setdefaultencoding('utf8') No i mam takie pytania odnośnie unicode w utf8: Czy obie poniższe linie dają ten sam efekt, czyli obiekt unicode zakodowany w utf8? lString =

Re: Presentation software for Python code

2009-04-24 Thread Sebastian Wiesner
Michael Hoffman – Donnerstag, 23. April 2009 19:52 I'm willing to consider TeX- and HTML-based approaches. I can recommend latex with the beamer package. It doesn't directly support formatting of code snippets, but the pygments syntax highlighter comes with a Latex formatter. -- Freedom is

Re: JSON and Firefox sessionstore.js

2009-04-24 Thread Дамјан Георгиевски
Unless I'm badly mistaken, the Firefox sessionstore.js file is supposed to be JSON. ... If it matters, I'm using Firefox 2.0.0.5 under Linux. maybe it can be parsed with PyYAML? -- дамјан ( http://softver.org.mk/damjan/ ) Well when _I_ was in school, I had to run Netscape on HP/UX,

Re: Numpy Performance

2009-04-24 Thread timlash
Thanks for your replies. @Peter - My arrays are not sparse at all, but I'll take a quick look as scipy. I also should have mentioned that my numpy arrays are of Object type as each data point (row) has one or more text labels for categorization. @Robert - Thanks for the comments about how numpy

Python-URL! - weekly Python news and links (Apr 24)

2009-04-24 Thread Gabriel Genellina
QOTW: ... [C]alling Python Object-Orientated is a bit of an insult :-). I would say that Python is Ego-Orientated, it allows me to do what I want. - Martin P. Hellwig April 25: Python Bug Day A perfect opportunity to get involved in Python development, bring your own issues to

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Marco Mariani
Ulrich Eckhardt wrote: t = Test() if (t == 'Vla': print t # must contain Vla What's wrong with that? It unnecessarily injects the name 't' into the scope. Since there is no concept in Python of a scope local to block statements, I don't understant what you would like to happen

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Paul McGuire
On Apr 24, 5:00 am, GC-Martijn gcmart...@gmail.com wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():     return 'Vla' I searching something like this: if (t = Test()) == 'Vla':    

Failed to build these modules:_ctypes

2009-04-24 Thread PS
Hello all I can't install neither python 2.6.1 nor 2.6.2 because an error during compilation of _ctypes module, I don't need the module but I don't know how to instruct to skip it. The plattform is Suse 11.0 The steps I performed are the following: ./configure --prefix $HOME/app/Python-2.6.2

Re: getter and setter and list appends

2009-04-24 Thread dasacc22
On Apr 24, 4:04 am, Piet van Oostrum p...@cs.uu.nl wrote: dasacc22 dasac...@gmail.com (d) wrote: d Ah thank you for clarifying, I did confuse instance and class d attributes from creating the list in the class def. I actually just d spiffed up that class to represent a portion of a much

Re: Convert numpy.ndarray into normal array

2009-04-24 Thread Johannes Bauer
MRAB schrieb: type 'numpy.ndarray' type 'array' So now I want to copy the fits_pixels - pb_pixels. Doing pb_pixels = fits_pixels This simply makes pb_pixels refer to the same object as fits_pixels. It doesn't copy the values into the existing pb_pixels object. Oh okay, I was thinking of

Superclass initialization

2009-04-24 Thread Ole Streicher
Hi again, I am trying to initialize a class inherited from numpy.ndarray: from numpy import ndarray class da(ndarray): def __init__(self, mydata): ndarray.__init__(self, 0) self.mydata = mydata When I now call the constructor of da: da(range(100)) I get the message:

Re: Superclass initialization

2009-04-24 Thread Steven D'Aprano
On Fri, 24 Apr 2009 16:04:00 +0200, Ole Streicher wrote: I get the message: ValueError: sequence too large; must be smaller than 32 which I do not understand. This message is generated by the constructor of ndarray, but the ndarray constructor (ndarray.__init__()) has only 0 as argument,

Re: Superclass initialization

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 3:04 pm, Ole Streicher ole-usenet-s...@gmx.net wrote: Hi again, I am trying to initialize a class inherited from numpy.ndarray: from numpy import ndarray class da(ndarray):     def __init__(self, mydata):         ndarray.__init__(self, 0)         self.mydata = mydata When I

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-24 Thread Grant Edwards
On 2009-04-23, MRAB goo...@mrabarnett.plus.com wrote: tinn...@isbd.co.uk wrote: It seems to me that mailbox.mbox.add() sets the access time of a mbox file as well as the modification time. This is not good for MUAs that detect new mail by looking to see if the access time is before the

Re: Superclass initialization

2009-04-24 Thread Ole Streicher
Steven D'Aprano st...@remove-this-cybersource.com.au writes: Perhaps you should post the full trace back instead of just the final line. No Problem, although I dont see the information increase there: In [318]: class da(ndarray): .: def __init__(self, mydata): .:

Re: Superclass initialization

2009-04-24 Thread Ole Streicher
Arnaud Delobelle arno...@googlemail.com writes: numpy.ndarray has a __new__ method (and no __init__). I guess this is the one you should override. Try: What is the difference? best regards Ole -- http://mail.python.org/mailman/listinfo/python-list

Re: Superclass initialization

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 3:46 pm, Ole Streicher ole-usenet-s...@gmx.net wrote: Arnaud Delobelle arno...@googlemail.com writes: numpy.ndarray has a __new__ method (and no __init__).  I guess this is the one you should override.  Try: What is the difference? best regards Ole Here's an explanation.

repost: http web page fetch question

2009-04-24 Thread grocery_stocker
Given the following... [cdal...@localhost oakland]$ more basic.py #!/usr/bin/python import sched import time scheduler = sched.scheduler(time.time, time.sleep) def print_event(name): print 'EVENT:', time.time(), name print 'START:', time.time() scheduler.enter(2, 1, print_event,

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-24 Thread MRAB
Grant Edwards wrote: On 2009-04-23, MRAB goo...@mrabarnett.plus.com wrote: tinn...@isbd.co.uk wrote: It seems to me that mailbox.mbox.add() sets the access time of a mbox file as well as the modification time. This is not good for MUAs that detect new mail by looking to see if the access time

Re: Failed to build these modules:_ctypes

2009-04-24 Thread Thomas Heller
PS schrieb: Hello all I can't install neither python 2.6.1 nor 2.6.2 because an error during compilation of _ctypes module, I don't need the module but I don't know how to instruct to skip it. You only get a warning, right? So a subsequent 'make install' should work. --

Re: Large data arrays?

2009-04-24 Thread John Machin
On Apr 24, 5:17 pm, Ole Streicher ole-usenet-s...@gmx.net wrote: Hi John, John Machin sjmac...@lexicon.net writes: The Morton layout wastes space if the matrix is not square. Your 100K x 4K is very non-square. Looks like you might want to use e.g. 25 Morton arrays, each 4K x 4K. What I

Re: Help with code! Gamepad?

2009-04-24 Thread DC16
On Apr 23, 4:03 pm, Mike Driscoll kyoso...@gmail.com wrote: On Apr 23, 6:46 am, DC16 luster...@gmail.com wrote: I am using pygame and OpenGL. How do I make a gamepad able to move the camera to a side of a cube on screen. Here is the code for keyboard use: import pygame from

Re: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi John, John Machin sjmac...@lexicon.net writes: From my access pattern, it would be probably better to combine 25 rows into one slice and have one matrix where every cell contains 25 rows. Are there any objections about that? Can't object, because I'm not sure what you mean ... how many

python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. Now if so this is a

Re: Large data arrays?

2009-04-24 Thread John Machin
On Apr 25, 1:14 am, Ole Streicher ole-usenet-s...@gmx.net wrote: Hi John, John Machin sjmac...@lexicon.net writes: From my access pattern, it would be probably better to combine 25 rows into one slice and have one matrix where every cell contains 25 rows. Are there any objections about

Re: gethostbyname blocking

2009-04-24 Thread marc wyburn
On Apr 23, 2:16 pm, Piet van Oostrum p...@cs.uu.nl wrote: marc wyburn marc.wyb...@googlemail.com (MW) wrote: MW Hi, I am writing anasynchronousping app to check if 1000s of hosts MW are alive very quickly.  Everything works extremely quickly unless the MW host name doesn't have a DNS record.

Re: python list handling and Lisp list handling

2009-04-24 Thread MRAB
Mark Tarver wrote: This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time.

Re: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi John John Machin sjmac...@lexicon.net writes: On Apr 25, 1:14 am, Ole Streicher ole-usenet-s...@gmx.net wrote: John Machin sjmac...@lexicon.net writes: From my access pattern, it would be probably better to combine 25 rows into one slice and have one matrix where every cell contains 25

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing. Forgot to add: you might look at http://norvig.com/python-lisp.html Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing. For example, can I modify a Python list non-destructively? Are they equivalent to Lisp lists. Can CAR and CDR in Lisp be thought of as Python lists are

mod_python form upload: permission denied sometimes...

2009-04-24 Thread psaff...@googlemail.com
I have a mod_python application that takes a POST file upload from a form. It works fine from my machine, other machines in my office and my home machine. It does not work from my bosses machine in a different city - he gets You don't have permission to access this on this server. In the logs,

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Terry Reedy
Steven D'Aprano wrote: On Thu, 23 Apr 2009 21:51:42 -0400, Esmail wrote: set(a) == set(b)# test if a and b have the same elements # check that each list has the same number of each element # i.e. [1,2,1,2] == [1,1,2,2], but [1,2,2,2] != [1,1,1,2] for elem in set(a): a.count(elem) ==

Re: Help with code! Gamepad?

2009-04-24 Thread Mike Driscoll
On Apr 24, 10:11 am, DC16 luster...@gmail.com wrote: On Apr 23, 4:03 pm, Mike Driscoll kyoso...@gmail.com wrote: On Apr 23, 6:46 am, DC16 luster...@gmail.com wrote: I am using pygame and OpenGL. How do I make a gamepad able to move the camera to a side of a cube on screen. Here

Re: Raw command line arguments

2009-04-24 Thread Gabriel Genellina
En Fri, 24 Apr 2009 06:40:23 -0300, Enchanter ensoul.magaz...@gmail.com escribió: How to pass the raw command line arguments to the python? That depends on the OS or the shell you're using. Such as: mypython.py txt -c Test Only {Help} The arguments I hope to get is:

Re: sorting two corresponding lists?

2009-04-24 Thread tiefeng wu
Just being pedantic here :) [items[x] for x in [i for i in map(values.index, new_values)]] Is the same as [items[x] for x in map(values.index, new_values)] It's also the same as [items[x] for x in [values.index(i) for i in new_values]] Which reduces to

Re: first, second, etc line of text file

2009-04-24 Thread Gabriel Genellina
En Thu, 23 Apr 2009 18:50:06 -0300, Scott David Daniels scott.dani...@acm.org escribió: Gabriel Genellina wrote: En Wed, 25 Jul 2007 19:14:28 -0300, James Stroud jstr...@mbi.ucla.edu escribió: [nice recipe to retrieve only certain lines of a file] I think your time machine needs an

Python servlet for Java applet ?

2009-04-24 Thread Linuxguy123
Hi guys. Is there a way to use a python application as the back end (ie rpc) for a Java based applet ? How does it work compared to a Java servlet with a Java applet ? Thanks -- http://mail.python.org/mailman/listinfo/python-list

confused with so many python package locations for imports

2009-04-24 Thread Krishnakant
hello all, I was doing my first complete python packaging for my software and I am totally confused. I see, /usr/local/lib/python-2.6/site-packages and also dist-packages. Then I also see a directory called pyshare, then again site-packages in usr/lib/python (I am not even remembering correct

Re: best way to compare contents of 2 lists?

2009-04-24 Thread norseman
Esmail wrote: What is the best way to compare the *contents* of two different lists regardless of their respective order? The lists will have the same number of items, and be of the same type. E.g. a trivial example (my lists will be larger), a=[1, 2, 3] b=[2, 3, 1] should yield true if a==b

PyQt4 - widget signal trouble

2009-04-24 Thread Joacim Thomassen
Hello, I'm trying to get my first PyQt4 application to work as intended, but it seems I'm stuck and out of ideas for now. The program is a simple GUI showing an image. If the image on disk change my intension is that the displayed image in my application also change accordingly. What works:

Re: Convert numpy.ndarray into normal array

2009-04-24 Thread Aahz
In article 75dgm1f16hqn...@mid.dfncis.de, Johannes Bauer dfnsonfsdu...@gmx.de wrote: So now I want to copy the fits_pixels - pb_pixels. Doing pb_pixels = fits_pixels works and is insanely fast, however the picture looks all screwed-up (looks like a RGB picture of unititialized memory, huge

Help AIX 5.3 build on Python-3.1a2

2009-04-24 Thread pruebauno
OPT=-O2 LDFLAGS=-s ./configure --prefix=/ptst --with-gcc=xlc_r -q64 --with-cxx=xlC_r -q64 --disable-ipv6 AR=ar -X64 --without-locale -- without-ctypes checking for --with-universal-archs... 32-bit checking MACHDEP... aix5 checking machine type as reported by uname -m... 00023AAA4C00 checking for

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-24 Thread Lawrence D'Oliveiro
In message gtudnry7tappu2zunz2dnuvz_h6dn...@posted.visi, Grant Edwards wrote: AFAIK, atimemtime has been the standard way to determine when an mbox contains new mail for at least 20 years. Doesn't apply to maildir though, does it? Updating atime adds a lot of filesystem overhead; that's why

Re: best way to compare contents of 2 lists?

2009-04-24 Thread Steven D'Aprano
On Fri, 24 Apr 2009 10:39:39 -0700, norseman wrote: Technically, == is reserved for identical, as in byte for byte same Really? Then how do you explain these? u'abc' == 'abc' True 1 == 1.0 True 2L == 2 True import decimal decimal.Decimal('42') == 42 True Here's one to think about:

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 17:19, Paul Rubin http://phr...@nospam.invalid wrote: Mark Tarver dr.mtar...@ukonline.co.uk writes: But are Python lists also indistinguishable from conventional Lisplists for list processing.   Forgot to add: you might look athttp://norvig.com/python-lisp.html Mark Tarver

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-24 Thread Grant Edwards
On 2009-04-24, MRAB goo...@mrabarnett.plus.com wrote: [snip] The access time is the time it was last accessed, ie read or modified. Usually. The modification time is the time it was last modified. Usually. The access time can never be before the modification time because it must be

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-24 Thread Grant Edwards
On 2009-04-24, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message gtudnry7tappu2zunz2dnuvz_h6dn...@posted.visi, Grant Edwards wrote: AFAIK, atimemtime has been the standard way to determine when an mbox contains new mail for at least 20 years. Doesn't apply to maildir

Re: repost: http web page fetch question

2009-04-24 Thread Emile van Sebille
grocery_stocker wrote: Given the following... [cdal...@localhost oakland]$ more basic.py snip How do I modify it so that it runs every hour on the hour. I'd probably use cron, but here's one way. Emile - import sched import time scheduler = sched.scheduler(time.time, time.sleep)

Re: and [True,True] -- [True, True]?????

2009-04-24 Thread Martin v. Löwis
Of course dicts and sets are sequences. But there are also sequences on which len doesn't work. That was my intuition, too. But Python takes a different stance: It's a sequence if it can be indexed by numbers in range(len(seq)). Neither dicts nor sets can be indexed that way. Regards,

  1   2   >