Re: Lisp mentality vs. Python mentality

2009-04-24 Thread Lawrence D'Oliveiro
In message , Emmanuel Surleau wrote: > Ah well. I guess this explains Emacs. So how would you explain someone who uses Emacs to write Python code? Like me? -- http://mail.python.org/mailman/listinfo/python-list

Re: http web fetch question

2009-04-24 Thread Tim Roberts
grocery_stocker wrote: >On Apr 23, 3:29 pm, Chris Rebert wrote: >> On Thu, Apr 23, 2009 at 3:21 PM, grocery_stocker wrote: >> > Say I have a script that fetches data from a website every hour. Is >> > there a general solution or is the solution operating system specific? >> >> WRT the periodic

Re: pythoncom -- ImportError: DLL load failed - Solved, sort of.

2009-04-24 Thread Mark Hammond
Richard Whidden wrote: I installed a clean copy of Python 2.5, pywin32 and PyGreSQL and it works. I'll have to figure out what broke with my 2.6 install. Make sure you have 2.6.2 Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows Shell Extensions - Out of Proc

2009-04-24 Thread Mark Hammond
Thomas Heller wrote: Ralf schrieb: I think that for whatever reasons, explorer always tries to create shell extensions as InProc. CoCreateInstance, which is the usual API to create COM instances, allows to specify which one you want. Thomas So there is no way to do this, other than to create

Re: Installing 2.6 on a Mac

2009-04-24 Thread Ned Deily
In article , Greg Reyna wrote: > I want to install Python 2.6 on a dual 1.42 GHz MacG4 tower running > OS 10.5.6. The Python installer wants to create the Python.framework > directory in "/Library/Frameworks" but it can't because there's an > alias of the same name in there. On this machine,

Re: Lisp mentality vs. Python mentality

2009-04-24 Thread Emmanuel Surleau
On Saturday 25 April 2009 08:06:30 Carl Banks wrote: > In answering the recent question by Mark Tarver, I think I finally hit > on why Lisp programmers are the way they are (in particular, why they > are often so hostile to the "There should only be one obvious way to > do it" Zen). > > Say you put

authentication example with urllib.request

2009-04-24 Thread larryzhang
Dear all, I am trying to download data from a website that requires authentication (maybe with cookies). Any suggestions on how i can do this with the urllib.request module in py3? Where can I can find some working examples? Thanks a lot. Larry -- http://mail.python.org/mailman/listinfo/python-li

Lisp mentality vs. Python mentality

2009-04-24 Thread Carl Banks
In answering the recent question by Mark Tarver, I think I finally hit on why Lisp programmers are the way they are (in particular, why they are often so hostile to the "There should only be one obvious way to do it" Zen). Say you put this task to a Lisp and a Python programmer: Come up with a goo

Re: Presentation software for Python code

2009-04-24 Thread Michael Hoffman
Sebastian Wiesner wrote: 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. This is what I have been doing so fa

Re: repost: http web page fetch question

2009-04-24 Thread Gabriel Genellina
En Fri, 24 Apr 2009 11:54:40 -0300, grocery_stocker escribió: scheduler = sched.scheduler(time.time, time.sleep) How do I modify it so that it runs every hour on the hour. (The sched module is almost useless, IMHO) I'd use cron (linux) or schtasks (windows). If it has to be a Python scrip

Re: repost: http web page fetch question

2009-04-24 Thread Gabriel Genellina
En Fri, 24 Apr 2009 11:54:40 -0300, grocery_stocker escribió: scheduler = sched.scheduler(time.time, time.sleep) How do I modify it so that it runs every hour on the hour. (The sched module is almost useless, IMHO) I'd use cron (linux) or schtasks (windows). If it has to be a Python scrip

Re: confused with so many python package locations for imports

2009-04-24 Thread David Cournapeau
On Sat, Apr 25, 2009 at 2:36 AM, Krishnakant wrote: > > 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-pa

Installing 2.6 on a Mac

2009-04-24 Thread Greg Reyna
I want to install Python 2.6 on a dual 1.42 GHz MacG4 tower running OS 10.5.6. The Python installer wants to create the Python.framework directory in "/Library/Frameworks" but it can't because there's an alias of the same name in there. On this machine, Python 2.5.1 is installed in "/System/

Re: python list handling and Lisp list handling

2009-04-24 Thread Carl Banks
On Apr 24, 8:19 am, 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 sho

Re: JSON and Firefox sessionstore.js

2009-04-24 Thread Matt Nordhoff
Steven D'Aprano wrote: > On Thu, 23 Apr 2009 05:08:35 +0100, I V wrote: > >> For something with at least a vague air of credibility to it, somebody >> who appears to be a Mozilla developer comments on their bug tracker, >> that sessionstore.js isn't "pure JSON" (though he only identifies the >> pa

Re: Finding partition containing a path?

2009-04-24 Thread Lawrence D'Oliveiro
In message , s...@pobox.com wrote: > Is there an easy way in Python to get the mount point in which a path > resides? (Unix only is fine.) See the os.statvfs call . -- http://mail.python.org/mailman/listinfo/python-list

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

2009-04-24 Thread Lawrence D'Oliveiro
In message , GC-Martijn wrote: > Nothing is wrong with it , but it cost more lines (= more scrolling) > When possible I want to keep my code small. Maybe you'd be better off with Perl than Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python the quick way

2009-04-24 Thread Tim Chase
I am not sure what will happen if I do the programing in python the find the program doesn't deliver the desired performance due to lack of a good compiler. I've rarely found this to be a problem unless you're doing CPU-intensive work. However, the usual workflow involves: 1) code it in Pyt

An unexpected visit_decref assertion fail (code works under python 2.4, doesn't under 2.5)

2009-04-24 Thread Joe Ardent
Hello, I'm running into a very odd problem here with a Python module (written in C). The following code works fine when built against and loaded into Python 2.4, but fails when built against and loaded into Python 2.5.1: klass = PyClass_New(bases, classDict, className); if (klass && meth

Re: Collections.py -- any help?

2009-04-24 Thread Terry Reedy
Josh English wrote: Sorry, I was referring to the abstract base classes defined there... ABCs are new in 3.0. I have not used them, have no immediate plans to do so, and consider them a somewhat advanced feature. I suggest that you find the PEP 3### that gives their rationale and intended u

Learning Python the quick way

2009-04-24 Thread mercurish
Hi guys, I have decided to learn Python a little more than I already do. But I found few problems, I am not sure what will happen if I do the programing in python the find the program doesn't deliver the desired performance due to lack of a good compiler. So I wanted to learn more about the proj

Re: python list handling and Lisp list handling

2009-04-24 Thread Rhodri James
On Sat, 25 Apr 2009 00:32:26 +0100, Mark Tarver wrote: OK; I think I get it. RPLACA and RPLACD are part of the id of Common Lisp which I rarely contemplate. However what it seems to be is that the difference is this. Lisp operates a destructive operation like RPLACA in such a way that RPLAC

Re: Python servlet for Java applet ?

2009-04-24 Thread Piet van Oostrum
> Linuxguy123 (L) wrote: >L> Hi guys. >L> Is there a way to use a python application as the back end (ie rpc) for >L> a Java based applet ? Yes, you can use Corba, XMLRPC, SOAP, JSON-RPC. Corba probably will have to be tunnelled through port 80 (the others already do this by default because

Re: getter and setter and list appends

2009-04-24 Thread Piet van Oostrum
> dasacc22 (d) wrote: >d> The property method of parent and children actually calls a >d> _set_as_parent() and _set_as_child() method after setting the private >d> variable to pack the object for display purposes so that children can >d> be detached from the parent (becoming its own parent) a

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

2009-04-24 Thread Piet van Oostrum
> Steven D'Aprano (SD) wrote: >SD> On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: >>> -- The long way >>> t = Test() >>> if (t == 'Vla': >>> print t # must contain Vla >SD> What's wrong with that? Missing ')' or better spurious '(' :=) -- Pi

Re: Collections.py -- any help?

2009-04-24 Thread Josh English
Sorry, I was referring to the abstract base classes defined there... mea culpa. I didn't get out of my head while posting. Josh On Apr 24, 4:15 pm, Jerry Hill wrote: > On Fri, Apr 24, 2009 at 6:56 PM, Josh English > > > Doug Hellmann wrote an article on the collections module for his > Python M

Re: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 19:54, Arnaud Delobelle wrote: > Mark Tarver writes: > > Ah;  so this > > > def cons (x,y): > >   return [x] + y > > > is not accurate? > > Depends what you mean by accurate! > > in lisp, if you do: > >     (setq a '(1 2)) >     (setq b (cons 0 a)) >     (rplaca a 3) > > Then >     a i

Re: Convert numpy.ndarray into "normal" array

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

Re: Collections.py -- any help?

2009-04-24 Thread Jerry Hill
On Fri, Apr 24, 2009 at 6:56 PM, Josh English wrote: > In my quest to learn more, I've been trying to get the collections.py > module to do anything but look cool. So far, it's only a cool idea. > How do they work? I can't find a tutorial on the web anywhere > explaining how I would use them in my

Re: confused with so many python package locations for imports

2009-04-24 Thread Ben Finney
Krishnakant writes: > Now my question is, which the perfect place? Your question is unrelated to the message to which you're replying. To start a new discussion, do not reply to an existing message (causing your message to be incorrectly associated with that existing message). Instead, compose

Collections.py -- any help?

2009-04-24 Thread Josh English
In my quest to learn more, I've been trying to get the collections.py module to do anything but look cool. So far, it's only a cool idea. How do they work? I can't find a tutorial on the web anywhere explaining how I would use them in my code. Any clues? Josh -- http://mail.python.org/mailman/lis

Re: Superclass initialization

2009-04-24 Thread Aahz
In article , Ole Streicher wrote: > >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(r

Re: Finding partition containing a path?

2009-04-24 Thread Christian Heimes
s...@pobox.com schrieb: > This little shell script lists the partitions containing /var/opt on a set > of hosts: > > for h in host1 host2 host3 ; do > echo -n "$h " > ssh $h df -h /var/opt | egrep -v '^Filesystem' | awk '{print $6}' > done > > producing output like this: > >

Re: HTTP Authentication using urllib2

2009-04-24 Thread Wojtek Walczak
On Fri, 24 Apr 2009 04:25:20 -0700 (PDT), Lakshman wrote: > I am trying to authenticate using urllib2. The basic authentication > works if I hard code authheaders. ... > except IOError, e: > print "Something wrong. This shouldnt happen" First of all, don't shoot yourself in the foot an

debugging in IPython

2009-04-24 Thread Nick Matzke
This is a general question, but maybe there is some obvious solution I've missed. When I am writing code, I have a main script that calls functions in another .py file. When there is a bug or crash in the main script, in IPython I can just start typing the names of variables etc. to see what

Re: Presentation software for Python code

2009-04-24 Thread ajaksu
alex23 wrote: >Michael Hoffman 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 feel like pur

Re: Modifying the value of a float-like object

2009-04-24 Thread C or L Smith
I happened across the recent discussion and found it very interesting as I have been dusting off and trying to get ready a module that I had made that created a number class that handled numeric values and uncertainties in computations by computing (via overloaded operators) a new value and unce

Re: PyQt4 - widget signal trouble

2009-04-24 Thread Phil Thompson
On Fri, 24 Apr 2009 12:37:02 -0500, Joacim Thomassen wrote: > 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

Finding partition containing a path?

2009-04-24 Thread skip
This little shell script lists the partitions containing /var/opt on a set of hosts: for h in host1 host2 host3 ; do echo -n "$h " ssh $h df -h /var/opt | egrep -v '^Filesystem' | awk '{print $6}' done producing output like this: host1 /var/opt host2 /var/opt host

Re: pythoncom -- ImportError: DLL load failed - Solved, sort of.

2009-04-24 Thread Richard Whidden
I installed a clean copy of Python 2.5, pywin32 and PyGreSQL and it works. I'll have to figure out what broke with my 2.6 install. Thanks for letting me scribble here. "Richard Whidden" wrote in message news:002a58fa$0$25248$c3e8...@news.astraweb.com... > I've sniffed around for a solution to

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-24 Thread Martin v. Löwis
> Why not use U+DCxx for non-UTF-8 encodings too? I thought of that, and was tricked into believing that only U+DC8x is a half surrogate. Now I see that you are right, and have fixed the PEP accordingly. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python not importing mysqldb

2009-04-24 Thread Jerry Hill
On Fri, Apr 24, 2009 at 4:04 PM, 83nini <83n...@gmail.com> wrote: > hi guys, > > i've been sweating the whole day trying to make python work with mysql > but in vain! > i'm doing the following: > 1. visiting http://sourceforge.net/projects/mysql-python > 2. dowloading mysql-python-test-1.2.3c1 > 3.

Re: Python not importing mysqldb

2009-04-24 Thread Christian Heimes
83nini schrieb: > hi guys, > > i've been sweating the whole day trying to make python work with mysql > but in vain! > i'm doing the following: > 1. visiting http://sourceforge.net/projects/mysql-python > 2. dowloading mysql-python-test-1.2.3c1 > 3. extracting the files to C:\Python26\Lib\site-pac

Re: Python servlet for Java applet ?

2009-04-24 Thread ryniek90
Temat: Python servlet for Java applet ? Od: Linuxguy123 Data: Fri, 24 Apr 2009 11:34:09 -0600 Do: python-list@python.org Do: python-list@python.org Hi guys. Is there a way to use a python application as the back end (i

Re: pythoncom -- ImportError: DLL load failed - Update

2009-04-24 Thread Richard Whidden
By including the following DLLs on a Windows 2000 image I have running Python 2.5, my little sample app works... comerr32.dll krb5_32.dll libintl-8.dllpython26.dll gssapi32.dll libeay32.dll libpq.dllssleay32.dll k5sprt32.dll libiconv-2.dll python25.dll msvcm90.dl

Re: Python not importing mysqldb

2009-04-24 Thread Emile van Sebille
83nini wrote: hi guys, i've been sweating the whole day trying to make python work with mysql but in vain! i'm doing the following: 1. visiting http://sourceforge.net/projects/mysql-python 2. dowloading mysql-python-test-1.2.3c1 3. extracting the files to C:\Python26\Lib\site-packages From tha

Re: Numpy Performance

2009-04-24 Thread Robert Kern
On 2009-04-24 08:05, timlash wrote: Essentially, I'm testing tens of thousands of scenarios on a relatively small number of test cases. Each scenario requires all elements of each test case to be scored, then summarized, then sorted and grouped with some top scores captured for reporting. It se

Python not importing mysqldb

2009-04-24 Thread 83nini
hi guys, i've been sweating the whole day trying to make python work with mysql but in vain! i'm doing the following: 1. visiting http://sourceforge.net/projects/mysql-python 2. dowloading mysql-python-test-1.2.3c1 3. extracting the files to C:\Python26\Lib\site-packages 4. writing "import MySQLdb

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-24 Thread Lino Mastrodomenico
2009/4/22 "Martin v. Löwis" : > To convert non-decodable bytes, a new error handler "python-escape" is > introduced, which decodes non-decodable bytes using into a private-use > character U+F01xx, which is believed to not conflict with private-use > characters that currently exist in Python codecs.

Re: best way to compare contents of 2 lists?

2009-04-24 Thread norseman
Steven D'Aprano wrote: 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 Her

pythoncom -- ImportError: DLL load failed

2009-04-24 Thread Richard Whidden
I've sniffed around for a solution to this problem but I can't find anything. The simple COM example in the "Programming on Win32" O'Reilly book works fine. However, as soon as I add 'import pgdb' to the object, chaos ensues promply. Here's what I did. Step 1, write this: foo.py -- # pri

Re: python list handling and Lisp list handling

2009-04-24 Thread Arnaud Delobelle
Mark Tarver writes: > Ah; so this > > def cons (x,y): > return [x] + y > > is not accurate? Depends what you mean by accurate! in lisp, if you do: (setq a '(1 2)) (setq b (cons 0 a)) (rplaca a 3) Then a is now (3 2) b is now (0 3 2) In Python, if you do: a = [1

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

2009-04-24 Thread Scott David Daniels
Marco Mariani wrote: 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. Imagine debugging a pile of code that includes a module with: import random def random.random():

Re: Large data arrays?

2009-04-24 Thread Scott David Daniels
Ole Streicher wrote: Hi John John Machin writes: On Apr 25, 1:14 am, Ole Streicher wrote: John Machin 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? C

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

2009-04-24 Thread Grant Edwards
On 2009-04-24, Grant Edwards wrote: > Anybody writing to an mbox mailbox has to follow the rules if > they expect to interoperate with other mail applications. If > mailbox.mbox.add() doesn't preserve the atime when writing to > an mbox, then mailbox.mbox.add is broken. I should qualify that: s

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

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 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) def pri

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 wrote: > In message , Grant Edwards > wrote: > >> AFAIK, atime> when an mbox contains new mail for at least 20 years. > > Doesn't apply to maildir though, does it? Nope. With maildir, there's a completely separate directory where one puts new messages. > Upda

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

2009-04-24 Thread Grant Edwards
On 2009-04-24, MRAB 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: python list handling and Lisp list handling

2009-04-24 Thread Mark Tarver
On 24 Apr, 17:19, Paul Rubin wrote: > Mark Tarver 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 writes: > > But ar

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 t

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

2009-04-24 Thread Lawrence D'Oliveiro
In message , Grant Edwards wrote: > AFAIK, atime 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 the relatime option was invented . But better still is not to bothe

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

Re: Convert numpy.ndarray into "normal" array

2009-04-24 Thread Aahz
In article <75dgm1f16hqn...@mid.dfncis.de>, Johannes Bauer 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 chunks of 0s >

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

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

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 path

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

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 escribió: Gabriel Genellina wrote: En Wed, 25 Jul 2007 19:14:28 -0300, James Stroud escribió: [nice recipe to retrieve only certain lines of a file] I think your time machine needs an adjustment, it spits things almost two years la

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: Raw command line arguments

2009-04-24 Thread Gabriel Genellina
En Fri, 24 Apr 2009 06:40:23 -0300, Enchanter 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: txt -c "Test Only" {He

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver 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 vectors that automatic

Re: python list handling and Lisp list handling

2009-04-24 Thread Paul Rubin
Mark Tarver 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 writes: > But are Python lists also indistinguishable from conventional > Lisplists for list pr

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, i

Re: Help with code! Gamepad?

2009-04-24 Thread Mike Driscoll
On Apr 24, 10:11 am, DC16 wrote: > On Apr 23, 4:03 pm, Mike Driscoll wrote: > > > > > On Apr 23, 6:46 am, DC16 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: > > >

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: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi John John Machin writes: > On Apr 25, 1:14 am, Ole Streicher wrote: >> John Machin 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? >> >

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

Re: gethostbyname blocking

2009-04-24 Thread marc wyburn
On Apr 23, 2:16 pm, Piet van Oostrum wrote: > > marc wyburn (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. > >MW> when calling socke

Re: Large data arrays?

2009-04-24 Thread John Machin
On Apr 25, 1:14 am, Ole Streicher wrote: > Hi John, > > John Machin 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'

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 boo

Re: Large data arrays?

2009-04-24 Thread Ole Streicher
Hi John, John Machin 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 elements > in a "

Re: Help with code! Gamepad?

2009-04-24 Thread DC16
On Apr 23, 4:03 pm, Mike Driscoll wrote: > On Apr 23, 6:46 am, DC16 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 pygame.locals import

Re: Large data arrays?

2009-04-24 Thread John Machin
On Apr 24, 5:17 pm, Ole Streicher wrote: > Hi John, > > John Machin 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 shal

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. -- http://mail.pyt

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

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, ('firs

Re: Superclass initialization

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 3:46 pm, Ole Streicher wrote: > Arnaud Delobelle 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. http://www.python.org/download/re

Re: Superclass initialization

2009-04-24 Thread Ole Streicher
Arnaud Delobelle 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 Ole Streicher
Steven D'Aprano 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): .: ndarray.__init__(self, 0) .

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

2009-04-24 Thread Grant Edwards
On 2009-04-23, MRAB 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 >> modification time. >>

Re: Superclass initialization

2009-04-24 Thread Arnaud Delobelle
On Apr 24, 3:04 pm, Ole Streicher 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 now call the

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 a

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

Re: Convert numpy.ndarray into "normal" array

2009-04-24 Thread Johannes Bauer
MRAB schrieb: >> >> >> >> 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 C++ std::vector

Re: getter and setter and list appends

2009-04-24 Thread dasacc22
On Apr 24, 4:04 am, Piet van Oostrum wrote: > > dasacc22 (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> tha

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 m

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 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': >     print t

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 instead

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 att

  1   2   >