Re: shouldn't list comprehension be faster than for loops?

2009-12-19 Thread Steven D'Aprano
On Sat, 19 Dec 2009 12:28:32 +1100, Ryan Kelly wrote: >> Anything else being equal, list comprehensions will be the faster >> becuase they incur fewer name and attribute lookups. It will be the >> same as the difference between a for loop and a call to map. A list >> comprehension is basically an

Re: iterators and views of lists

2009-12-19 Thread Terry Reedy
On 12/19/2009 12:10 AM, Gregory Ewing wrote: Terry Reedy wrote: On the other hand, Python indexes are a form of random access iterator, the top of the hierarchy. The term "random access iterator" seems oxymoronic to me. Iteration is all about operating on things in sequence. If you're accessin

Minor bug in multiprocessing?

2009-12-19 Thread Frank Millman
Hi all This is a minor issue, but I thought I would mention it. I am on Python 2.6.2. I have 'from __future__ import unicode_literals' at the top of my programs. I am experimenting with multiprocessing, and in particular subclassing the Process class. If I create a subclass and pass "name='te

Re: Moving from PHP to Python. Is it Possible

2009-12-19 Thread AppRe Godeck
On Mon, 14 Dec 2009 12:25:16 +0100, Bruno Desthuilliers wrote: > r0g a écrit : >> Bruno Desthuilliers wrote: >>> Sancar Saran a écrit : >>> (snip) My problem is with PHP syntax and performance. I'm just trying to replicate my recepies in python... >>> Python is not PHP, and trying to wr

Re: Sort the values of a dict

2009-12-19 Thread mattia
Il Sat, 19 Dec 2009 17:30:27 +1100, Lie Ryan ha scritto: > On 12/19/2009 9:34 AM, mattia wrote: >> Can you provide me a much pythonic solution (with comments if possible, >> so I can actually learn something)? > > If you only need to get i'th element sometimes, sorting the dict is > fine. Otherwi

Re: How Do I...?

2009-12-19 Thread Victor Subervi
On Fri, Dec 18, 2009 at 3:03 PM, Tim Chase wrote: > Victor Subervi wrote: > >> How do I...? >> > > Well, you start by reading a book on how to program. You would then learn > that what you want (in all likelihood) is a dictionary/map structure for > dynamically created key/value pairs. Once you h

numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
Dear friends, I plan to port a Monte Carlo engine from Matlab to Python. However, when I timed randn(N1, N2) in Python and compared it with Matlab's randn, Matlab came out as a clear winner with a speedup of 3-4 times. This was truly disappointing. I ran tthis test on a Win32 machine and without t

Re: Eclipse Carriage Return Workaround

2009-12-19 Thread Fabio Zadrozny
On Fri, Dec 18, 2009 at 1:38 PM, Steve Holden wrote: > I've written a Python 3 course that uses an Eclipse-based teaching > system. The school is telling me that their version of Eclipse/pydev > appears to have an input() function that appends a carriage return > character to the user's input. Thi

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-19 Thread Emeka
Okay if that is the case, why do we need it? By having int a = 65, b = 66 , why should we also have *kwlist[]? static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) { int a=65, b=66; char *kwlist[] = {"a", "b", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC",

Re: Eclipse Carriage Return Workaround

2009-12-19 Thread Fabio Zadrozny
On Sat, Dec 19, 2009 at 8:36 AM, Fabio Zadrozny wrote: > On Fri, Dec 18, 2009 at 1:38 PM, Steve Holden wrote: >> I've written a Python 3 course that uses an Eclipse-based teaching >> system. The school is telling me that their version of Eclipse/pydev >> appears to have an input() function that a

Re: Seek support for new slice syntax PEP.

2009-12-19 Thread Colin W.
On 18-Dec-09 23:16 PM, Nobody wrote: On Fri, 18 Dec 2009 09:49:26 -0500, Colin W. wrote: You don't say, but seem to imply that the slice components include None. That's how missing components are implemented at the language level: > class foo: = def __getitem__(self, s):

py itertools?

2009-12-19 Thread mattia
Hi all, I need to create the permutation of two strings but without repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my solution, but maybe the python library provides something better: >>> def mcd(a, b): ... if b == 0: ... return a ... else: ... return mcd(b

comparing dialects of csv-module

2009-12-19 Thread Malte Dik
Hi out there! I want to put some intelligence into a csv reading script and in order to do so I want to compare possible different dialects I collect with some random d = csv.Sniffer().sniff("1,2,3,4"), because the csv is kinda dirty. Now sniff() returns a class object and those aren't compara

Re: numpy performance and random numbers

2009-12-19 Thread Steven D'Aprano
On Sat, 19 Dec 2009 02:05:17 -0800, Carl Johan Rehn wrote: > Dear friends, > > I plan to port a Monte Carlo engine from Matlab to Python. However, when > I timed randn(N1, N2) in Python and compared it with Matlab's randn, What's randn? I don't know that function. I know the randint, random, and

Re: Creating Classes

2009-12-19 Thread Emeka
Hello Dave > > There are more complex things that can go on, like creating "bound" > function objects, but I think this should get you pretty far. > > Could explain the complex things for me? Regards, Janus -- http://mail.python.org/mailman/listinfo/python-list

Re: Using ZODB (or something else) for storing lots of metadata about RSS/Atom feeds and posts

2009-12-19 Thread Bruno Desthuilliers
Thomas Doggette a écrit : > I'm working on (or rather, at this point, planning) a project that > will involve keeping track of every post in a large number of Atom > feeds, as well as a lot of metadata about how posts are linked and how > users interact with them. > > The idea of having all of the

Re: Help with invoking standard mail app in windows

2009-12-19 Thread Kev Dwyer
On Sat, 19 Dec 2009 06:36:32 +1100, Astan Chee wrote: > Kev Dwyer wrote: >> Hello Astan, >> >> Your code executes without error for me on Win98 (!) with Python 2.5 or >> XP with Python 2.6. >> >> It would help people to help you if you could provide the *exact* >> console output from when you try

Re: py itertools?

2009-12-19 Thread Chris Rebert
On Sat, Dec 19, 2009 at 2:54 AM, mattia wrote: > Hi all, I need to create the permutation of two strings but without > repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my > solution, but maybe the python library provides something better: > def mcd(a, b): > ...     if b == 0: > .

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 12:29 pm, Steven D'Aprano wrote: > On Sat, 19 Dec 2009 02:05:17 -0800, Carl Johan Rehn wrote: > > Dear friends, > > > I plan to port a Monte Carlo engine from Matlab to Python. However, when > > I timed randn(N1, N2) in Python and compared it with Matlab's randn, > > What's randn? I don

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 11:05, Carl Johan Rehn wrote: > I plan to port a Monte Carlo engine from Matlab to Python. However, > when I timed randn(N1, N2) in Python and compared it with Matlab's > randn, Matlab came out as a clear winner with a speedup of 3-4 times. > This was truly disappointing. I ran tthis t

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 12:29, Steven D'Aprano wrote: > Perhaps > the Matlab random number generator is a low-quality generator which is > fast but not very random. Python uses a very high quality RNG which is > not cheap. Marsaglia and Matlab's implementation of ziggurat uses a slightly lower quality RNG fo

Re: comparing dialects of csv-module

2009-12-19 Thread Peter Otten
Malte Dik wrote: > Hi out there! > > I want to put some intelligence into a csv reading script and in order to > do so I want to compare possible different dialects I collect with some > random > > d = csv.Sniffer().sniff("1,2,3,4"), > > because the csv is kinda dirty. > > Now sniff() returns

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 14:06, Carl Johan Rehn wrote: > Matlab and numpy have (by chance?) the exact names for the same > functionality, Common ancenstry, NumPy and Matlab borrowed the name from IDL. LabView, Octave and SciLab uses the name randn as well. > So the basioc question is, how can I speed up r

Re: shouldn't list comprehension be faster than for loops?

2009-12-19 Thread sturlamolden
On 19 Des, 02:28, Ryan Kelly wrote: > Not so.  If you use the "dis" module to peek at the bytecode generated > for a list comprehension, you'll see it's very similar to that generated > for an explicit for-loop.  The byte-code for a call to map is very > different. First, you failed to realize t

Re: py itertools?

2009-12-19 Thread Lie Ryan
On 12/19/2009 11:48 PM, Chris Rebert wrote: Surprised you didn't think of the seemingly obvious approach: def permute_chars(one, two): for left in set(one): for right in set(two): yield (left, right) list(permute_chars('abc', 'wt')) [('a', 'w'), ('a', 't'), ('b', '

Re: comparing dialects of csv-module

2009-12-19 Thread Malte Dik
quote: > An implementation for the lazy > import csv d = csv.Sniffer().sniff("1,2,3") def eq(a, b, attributes=[name for name in dir(d) if not > name.startswith("_")]): > ... return all(getattr(a, n, None) == getattr(b, n, None) for n in > attributes) > ... Wow, this is awesome.

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 2:49 pm, sturlamolden wrote: > On 19 Des, 11:05, Carl Johan Rehn wrote: > > > I plan to port a Monte Carlo engine from Matlab to Python. However, > > when I timed randn(N1, N2) in Python and compared it with Matlab's > > randn, Matlab came out as a clear winner with a speedup of 3-4 ti

Re: How Do I...?

2009-12-19 Thread Tim Chase
Victor Subervi wrote: On Fri, Dec 18, 2009 at 3:03 PM, Tim Chase wrote: Well, you start by reading a book on how to program. You would then learn that what you want (in all likelihood) is a dictionary/map structure for dynamically created key/value pairs. Once you have progressed from your curr

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 3:16 pm, sturlamolden wrote: > On 19 Des, 14:06, Carl Johan Rehn wrote: > > > Matlab and numpy have (by chance?) the exact names for the same > > functionality, > > Common ancenstry, NumPy and Matlab borrowed the name from IDL. > > LabView, Octave and SciLab uses the name randn as well

Re: numpy performance and random numbers

2009-12-19 Thread Steven D'Aprano
On Sat, 19 Dec 2009 05:06:53 -0800, Carl Johan Rehn wrote: > so I was very happy with numpy's implementation until I timed it. How did you time it? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 16:20, Carl Johan Rehn wrote: > How about mulit-core or (perhaps more exciting) GPU and CUDA? I must > admit that I am extremely interested in trying the CUDA-alternative. > > Obviously, cuBLAS is not an option here, so what is the safest route > for a novice parallel-programmer? The

Re: Seek support for new slice syntax PEP.

2009-12-19 Thread Dave Angel
Colin W. wrote: On 18-Dec-09 23:16 PM, Nobody wrote: On Fri, 18 Dec 2009 09:49:26 -0500, Colin W. wrote: You don't say, but seem to imply that the slice components include None. That's how missing components are implemented at the language level: > class foo: = def __getitem__(self, s): = r

Re: py itertools?

2009-12-19 Thread mattia
Il Sat, 19 Dec 2009 10:54:58 +, mattia ha scritto: > Hi all, I need to create the permutation of two strings but without > repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my > solution, but maybe the python library provides something better: > def mcd(a, b): > ... if b

how do I set a Python installation as the default under windows ?

2009-12-19 Thread Stef Mientki
hello, I just upgraded from Python 2.5 to 2.6. Most of the things work, but I'm struggling with one issue, when I start Python in a command window, it still uses Python 2.5. Is there a way to get Python 2.6 as my default Python environment ? thanks, Stef Mientki -- http://mail.python.org/mailma

Re: How Do I...?

2009-12-19 Thread Victor Subervi
On Sat, Dec 19, 2009 at 10:22 AM, Tim Chase wrote: > Victor Subervi wrote: > >> On Fri, Dec 18, 2009 at 3:03 PM, Tim Chase > >wrote: >> >> Well, you start by reading a book on how to program. You would then >>> learn >>> that what you want (in all likelihood) is a dictionary/map structure for >>

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 4:47 pm, sturlamolden wrote: > On 19 Des, 16:20, Carl Johan Rehn wrote: > > > How about mulit-core or (perhaps more exciting) GPU and CUDA? I must > > admit that I am extremely interested in trying the CUDA-alternative. > > > Obviously, cuBLAS is not an option here, so what is the safe

Re: iterators and views of lists

2009-12-19 Thread Anh Hai Trinh
On Dec 19, 5:47 am, Bearophile wrote: > It seems you have missed my post, so here it is, more explicitly: > > http://www.boostcon.com/site-media/var/sphene/sphwiki/attachment/2009... Interestingly, my `listagent` can be used as a lazy iterator and thus using itertools we can compose them just l

Re: Creating Classes

2009-12-19 Thread Steve Holden
Dave Angel wrote: > seafoid wrote: >> Hey Guys, >> >> I have started to read over classes as a brief respite from my parsing >> problem. >> >> When a class is defined, how does the class access the data upon which >> the >> class should act? >> >> Example: >> >> class Seq:

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-19 Thread John Posner
On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach wrote: Chapter 2 is about Basic Concepts (of programming). It's the usual: variables, ... 1. Overall suggestion You have a tendency to include non-pertinent asides [1]. But then, rambling a bit endows a manuscript with the author's

Re: How Do I...?

2009-12-19 Thread Rami Chowdhury
On Dec 19, 2009, at 08:50 , Victor Subervi wrote: > On Sat, Dec 19, 2009 at 10:22 AM, Tim Chase > wrote: > Victor Subervi wrote: > On Fri, Dec 18, 2009 at 3:03 PM, Tim Chase > wrote: > > Well, you start by reading a book on how to program. You would then learn > that what you want (in all lik

Tutorial: Accessing Desktop CouchDB with Python

2009-12-19 Thread Terry Reedy
Above is a section heading in Code tutorial: make your application sync with Ubuntu One http://arstechnica.com/open-source/guides/2009/12/code-tutorial-make-your-application-sync-with-ubuntu-one.ars I just read part of it and thought others might find it interesting. tjr -- http://mail.python.o

Re: numpy performance and random numbers

2009-12-19 Thread Lie Ryan
On 12/20/2009 4:02 AM, Carl Johan Rehn wrote: How did you time it? Well, in Matlab I used "tic; for i = 1:1000, randn(100, 1), end; toc" and in IPython i used a similar construct but with "time" instead of tic/(toc. Code? Parallel PRNGs are an unsolved problem in computer science. Tha

Re: How Do I...?

2009-12-19 Thread Victor Subervi
On Sat, Dec 19, 2009 at 3:06 PM, Rami Chowdhury wrote: > Tim's given you a few suggestions, as have many others -- perhaps it would > be worth making a note, somewhere, of checks to go through before you post, > to ensure that you come across as well as you intend? > I appreciate Tim's advice. I

Re: Anybody use web2py?

2009-12-19 Thread Yarko
On Dec 19, 12:42 am, AppRe Godeck wrote: > Just curious if anybody prefers web2py over django, and visa versa. I > know it's been discussed on a flame war level a lot. I am looking for a > more intellectual reasoning behind using one or the other. Chevy or Ford? (or whatever pair you prefer) vi

Re: Anybody use web2py?

2009-12-19 Thread Yarko
On Dec 19, 2:48 pm, Yarko wrote: > On Dec 19, 12:42 am, AppRe Godeck wrote: > > > Just curious if anybody prefers web2py over django, and visa versa. I > > know it's been discussed on a flame war level a lot. I am looking for a > > more intellectual reasoning behind using one or the other. > > Ch

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 21:26, Lie Ryan wrote: > you can just start two PRNG at two distinct states No. You have to know for certain that the outputs don't overlap. If you pick two random states (using any PRNG), you need error- checking that states are always unique, i.e. that each PRNG never reaches the s

ANNOUNCE: awstats_reader 0.5

2009-12-19 Thread Joshua Kugler
ABOUT THE MODULE AwstatsReader is a pythonic interface to AWStats data cache files. Using it, you can access year and month via dict-like subscripts, and and individual data points via both dict-like subscripts and attribute-like accessors. As of version 0.5, it includes a script

Re: numpy performance and random numbers

2009-12-19 Thread sturlamolden
On 19 Des, 22:58, sturlamolden wrote: > If you pick two random states (using any PRNG), you need error- > checking that states are always unique, i.e. that each PRNG never > reaches the starting state of the other(s). Another note on this: Ideally, we would e.g. know how to find (analytically)

Re: Sort the values of a dict

2009-12-19 Thread Rory Campbell-Lange
> mylist = [z for z in zip(list(d), list(d.values()))] > The Pythonic way for the above line is: > >>> mylist = list(d.items()) Quite right. Thanks for pointing that out. I liked Chris Kaynor's solution: s = sorted(d.items(), key=lambda i: i[1][2]) I'm a bit rusty, and have just picked up

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On 19 Dec, 23:09, sturlamolden wrote: > On 19 Des, 22:58, sturlamolden wrote: > > > If you pick two random states (using any PRNG), you need error- > > checking that states are always unique, i.e. that each PRNG never > > reaches the starting state of the other(s). > > Another note on this: > > I

Re: Sort the values of a dict

2009-12-19 Thread John Bokma
Rory Campbell-Lange writes: > I'm a bit rusty, and have just picked up the new "Learning Python" book > but I'm finding that it isn't providing a useful refresher to the > language or a particularly good introduction to version 3. Have you any > suggestions. While you aren't addressing me, I do

a python downloader for the Amazon mp3 store

2009-12-19 Thread Chris Colbert
So, I wasn't happy with the Amazon mp3 downloader for linux (because it sucks). And clamz is written in C with a bunch of dependencies. Thus, I've created a python downloader for .amz files using the crypto keys figured out by Ben Moody (clamz author). Its just command line only right now, but I

Re: Anybody use web2py?

2009-12-19 Thread mdipierro
On Dec 19, 12:42 am, AppRe Godeck wrote: > Just curious if anybody prefers web2py over django, and visa versa. I > know it's been discussed on a flame war level a lot. I am looking for a > more intellectual reasoning behind using one or the other. Of course I am the most biased person in the worl

Re: Anybody use web2py?

2009-12-19 Thread mdipierro
Errata. I said "The dal supports transactions" where I meant "the dal supports migrations". Of course it also supports "transactions" as well as "distributed transactions". On Dec 19, 5:32 pm, mdipierro wrote: > On Dec 19, 12:42 am, AppRe Godeck wrote: > > > Just curious if anybody prefers web2

Re: Anybody use web2py?

2009-12-19 Thread Jake
On Dec 19, 1:42 am, AppRe Godeck wrote: > Just curious if anybody prefers web2py over django, and visa versa. I > know it's been discussed on a flame war level a lot. I am looking for a > more intellectual reasoning behind using one or the other. Hi! I come from a mvc framework background in a f

Re: numpy performance and random numbers

2009-12-19 Thread Gregory Ewing
Lie Ryan wrote: If you don't care about "repeatability" (which is already extremely difficult in parallel processing even without random number generators), you can just start two PRNG at two distinct states (and probably from two different algorithms) There's no need for different algorithm

Re: Raw string substitution problem

2009-12-19 Thread Rhodri James
On Fri, 18 Dec 2009 17:58:08 -, Alan G Isaac wrote: On 12/17/2009 7:59 PM, Rhodri James wrote: "re.compile('a\\nc')" passes a sequence of four characters to re.compile: 'a', '\', 'n' and 'c'. re.compile() then does it's own interpretation: 'a' passes through as is, '\' flags an escape w

Re: Anybody use web2py?

2009-12-19 Thread mdipierro
Errata 2. Before people jump on me. I said "copyright" but I meant "trademark". Of course web2py is GPL2 so everybody can copy and modify it. The license has an exception that basically treats the compiled web2py as freeware. The license does not extend to apps that require web2py. They can be di

Class variables static by default?

2009-12-19 Thread KarlRixon
Given the following script, I'd expect p1.items to just contain ["foo"] and p2.items to contain ["bar"] but they both contain ["foo", "bar"]. Why is this? Are object variables not specific to their instance? --- #!/usr/bin/env python class Parser: items = []

Re: how do I set a Python installation as the default under windows ?

2009-12-19 Thread Steve Holden
Stef Mientki wrote: > hello, > > I just upgraded from Python 2.5 to 2.6. > Most of the things work, > but I'm struggling with one issue, > when I start Python in a command window, > it still uses Python 2.5. > > Is there a way to get Python 2.6 as my default Python environment ? > > thanks, > St

Re: numpy performance and random numbers

2009-12-19 Thread Steven D'Aprano
On Sat, 19 Dec 2009 09:02:38 -0800, Carl Johan Rehn wrote: > Well, in Matlab I used "tic; for i = 1:1000, randn(100, 1), end; > toc" and in IPython i used a similar construct but with "time" instead > of tic/(toc. I don't know if this will make any significant difference, but for the record

Question about dir function

2009-12-19 Thread Ray Holt
When I run a dir(_builtins_) I get the error message that the name _builtins_ is not defined. I haven't tried the dir function on other functions, but can someone tell me why I am getting this message? Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Re: Class variables static by default?

2009-12-19 Thread John Posner
On Sat, 19 Dec 2009 19:10:13 -0500, KarlRixon wrote: Given the following script, I'd expect p1.items to just contain ["foo"] and p2.items to contain ["bar"] but they both contain ["foo", "bar"]. Why is this? Are object variables not specific to their instance? --- #!/u

Re: Class variables static by default?

2009-12-19 Thread Xavier Ho
Yes, if you want instance variables that are unique to each instance of a class, do the following: class Parser: def __init__(self): self.items = [] And that should work fine. J:\_Programming Projects\Python>python test.py <__main__.Parser object at 0x0240E7B0> <__main__.Parser object

Re: Question about dir function

2009-12-19 Thread Matt Nordhoff
Ray Holt wrote: > When I run a dir(_builtins_) I get the error message that the name > _builtins_ is not defined. I haven't tried the dir function on other > functions, but can someone tell me why I am getting this message? > Thanks, Ray You are getting that message because the name "_builtins_" i

Re: Class variables static by default?

2009-12-19 Thread Cameron Simpson
On 19Dec2009 16:10, KarlRixon wrote: | Given the following script, I'd expect p1.items to just contain | ["foo"] and p2.items to contain ["bar"] but they both contain ["foo", | "bar"]. | | Why is this? Are object variables not specific to their instance? You haven't instatiated "items" in the ob

Re: Class variables static by default?

2009-12-19 Thread Lie Ryan
On 12/20/2009 11:10 AM, KarlRixon wrote: Given the following script, I'd expect p1.items to just contain ["foo"] and p2.items to contain ["bar"] but they both contain ["foo", "bar"]. Why is this? Are object variables not specific to their instance? First of all, dump all the preconception of w

Please Help Publicize PyCon

2009-12-19 Thread Steve Holden, Chairman, PSF
Hi,everyone. This year I hope all readers of this list will assist me in crass commercial promotion of next year's PyCon. I will be speaking about "Building the Python Community", and we can't do that without advertising that the Python community exists (and hey, has pretty good conferences too).

Re: Question about dir function

2009-12-19 Thread Tim Chase
Ray Holt wrote: When I run a dir(_builtins_) I get the error message that the name _builtins_ is not defined. I haven't tried the dir function on other functions, but can someone tell me why I am getting this message? Thanks, Ray So close, and yet thrown by requisite extra underscores: >>> di

Re: numpy performance and random numbers

2009-12-19 Thread Lie Ryan
On 12/20/2009 8:58 AM, sturlamolden wrote: On 19 Des, 21:26, Lie Ryan wrote: you can just start two PRNG at two distinct states No. You have to know for certain that the outputs don't overlap. Not necessarily, you only need to be certain that the two streams don't overlap in any reasonabl

Checker 1.0 Released!

2009-12-19 Thread Chris Withers
I'm pleased to announce the first release of Checker. This is a cross-platform, pluggable tool for comparing the configuration of a machine with a known configuration stored in text files in a source control system all written in Python. For more information, please see: http://www.simplistix

Re: numpy performance and random numbers

2009-12-19 Thread Steven D'Aprano
On Sat, 19 Dec 2009 13:58:37 -0800, sturlamolden wrote: > On 19 Des, 21:26, Lie Ryan wrote: > >> you can just start two PRNG at two distinct states > > No. You have to know for certain that the outputs don't overlap. "For certain"? Why? Presumably you never do a Monte Carlo simulation once, y

Re: How Do I...?

2009-12-19 Thread Steve Holden, Chairman, PSF
Victor Subervi wrote: > On Sat, Dec 19, 2009 at 10:22 AM, Tim Chase > mailto:python.l...@tim.thechases.com>> > wrote: > > Victor Subervi wrote: > > On Fri, Dec 18, 2009 at 3:03 PM, Tim Chase > >wrote: > > Well, you st

Re: Sort the values of a dict

2009-12-19 Thread Rhodri James
On Fri, 18 Dec 2009 23:00:42 -, David Robinow wrote: I won't engage in any arguments about pythonicity but it seems simpler if you convert to a list of tuples right away. d = {1:('a', 1, 12), 5:('r',21,10), 2:('u',9,8)} l = [(x, d[x]) for x in d.keys()] which is a long way of writing "

doing cool stuff with Python and Industrial Robots....

2009-12-19 Thread Chris Colbert
Im just finishing up some research work during a stint as a visiting researcher in Germany. I've made a short clip showing a KUKA robot performing object reconstruction using a single camera mounted on the robot. The entire system is written in Python (control, math, everything) and related infra

using time.gov to get the current time

2009-12-19 Thread Rick
Is there any way to get the current time from time.gov using urllib2 or something similar? Does anyone have any examples of doing this? Thanks! Rick King Southfield MI -- http://mail.python.org/mailman/listinfo/python-list

Re: Dangerous behavior of list(generator)

2009-12-19 Thread Albert van der Horst
In article , Gabriel Genellina wrote: > >Despite a promise in PEP 289, generator expressions semantics isn't >explained in detail in the language reference. I can't tell if the >difference is intentional, accidental, undocumented behavior, an >implementation accident, a bug, or what... Philosoph

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-19 Thread Joachim Dahl
My mistake seems to be that I declared char a, b; instead of int a, b; Thank you for sorting this out. Joachim -- http://mail.python.org/mailman/listinfo/python-list

Re: iterators and views of lists

2009-12-19 Thread Carl Banks
On Dec 18, 12:18 pm, "Alf P. Steinbach" wrote: [lots of tangential information snipped] > ...but I don't understand why you're limiting yourself to the STL. Because I believe the vast majority of iterators used in C++ in practice are the ones provided by STL types, therefore I felt a statement ab

Using ZODB (or something else) for storing lots of metadata about RSS/Atom feeds and posts

2009-12-19 Thread Thomas Doggette
I'm working on (or rather, at this point, planning) a project that will involve keeping track of every post in a large number of Atom feeds, as well as a lot of metadata about how posts are linked and how users interact with them. The idea of having all of these be persistent objects is very appea

Re: using time.gov to get the current time

2009-12-19 Thread Matt Nordhoff
Rick wrote: > Is there any way to get the current time from time.gov using urllib2 or > something similar? > > Does anyone have any examples of doing this? > > Thanks! > Rick King > Southfield MI Why isn't your local system's clock accurate enough? -- Matt Nordhoff -- http://mail.python.org/m

Re: I look for proxy cache like apt-proxy (for Debian Package) but for python eggs package…

2009-12-19 Thread Steve Holden
Diez B. Roggisch wrote: > Klein Stéphane schrieb: >> Hi, >> >> I look for a tools to do proxy cache like apt-proxy (for Debian >> Package) but for python eggs package. >> >> Can a easy-install option perform this feature ? > > No. But you might install EggBasket, which is a PyPI-like server. > >

Re: iterators and views of lists

2009-12-19 Thread Rhodri James
On Fri, 18 Dec 2009 21:10:28 -, Brendan Miller wrote: When I said they are "weak" I meant it in sense that the algorithms writeable against an InputerIterator interface (which is what python's iterator protocol provides) is a proper subset of the algorithms that can be written against a R

Re: using time.gov to get the current time

2009-12-19 Thread Matt Nordhoff
Matt Nordhoff wrote: > Rick wrote: >> Is there any way to get the current time from time.gov using urllib2 or >> something similar? >> >> Does anyone have any examples of doing this? >> >> Thanks! >> Rick King >> Southfield MI > > Why isn't your local system's clock accurate enough? Bah, I'm bet

Re: Anybody use web2py?

2009-12-19 Thread AppRe Godeck
On Sat, 19 Dec 2009 12:48:07 -0800, Yarko wrote: > On Dec 19, 12:42 am, AppRe Godeck wrote: >> Just curious if anybody prefers web2py over django, and visa versa. I >> know it's been discussed on a flame war level a lot. I am looking for a >> more intellectual reasoning behind using one or the ot

Re: Creating Classes

2009-12-19 Thread Dave Angel
Steve Holden wrote: Dave Angel wrote: seafoid wrote: Hey Guys, I have started to read over classes as a brief respite from my parsing problem. When a class is defined, how does the class access the data upon which the class should act? Example: class Seq:

Re: Anybody use web2py?

2009-12-19 Thread mdipierro
> Why does web2py have classes that represent HTML? I can't see ever > needing to write VIEW code in my controller, since thats what views are > for. You do not need to use but if, for example, you want to build a menu recursively, having a server-side presentation of the DOM allows to do it witho

Re: Moving from PHP to Python. Is it Possible

2009-12-19 Thread mdipierro
About you point 3). You may want to look into: http://www.web2py.com/php It translates a PHP page into a web2py template. It is crude and primitive and fails in some cases. Moreover a literal translation is not what you really want since you want to follow a more MVC design. Moreover it will not

Re: Class variables static by default?

2009-12-19 Thread Steven D'Aprano
On Sun, 20 Dec 2009 11:44:11 +1100, Lie Ryan wrote: > In python, 'class variable' is a variable that belongs to a class; not > to the instance and is shared by all instance that belong to the class. Surely, since string variables are strings, and float variables are floats, and bool variables ar

Re: Anybody use web2py?

2009-12-19 Thread Thadeus Burgess
On Dec 19, 8:39 pm, AppRe Godeck wrote: > On Sat, 19 Dec 2009 12:48:07 -0800, Yarko wrote: > > On Dec 19, 12:42 am, AppRe Godeck wrote: > >> Just curious if anybody prefers web2py over django, and visa versa. I > >> know it's been discussed on a flame war level a lot. I am looking for a > >> more

Re: Class variables static by default?

2009-12-19 Thread Chris Rebert
On Sat, Dec 19, 2009 at 8:16 PM, Steven D'Aprano wrote: > On Sun, 20 Dec 2009 11:44:11 +1100, Lie Ryan wrote: > >> In python, 'class variable' is a variable that belongs to a class; not >> to the instance and is shared by all instance that belong to the class. > > Surely, since string variables ar

Re: Anybody use web2py?

2009-12-19 Thread Anand Vaidya
On Dec 19, 2:42 pm, AppRe Godeck wrote: > Just curious if anybody prefers web2py over django, and visa versa. I > know it's been discussed on a flame war level a lot. I am looking for a > more intellectual reasoning behind using one or the other. Hi, I am not very familiar with Django, anyway, m

tkinter import problem

2009-12-19 Thread harish anand
Hi, I have Mandriva 2010.0 in my laptop. I installed python3.1 from the repository. But i am unable to import tkinter in python console. When I try to import tkinter I get the following error, `ImportError : No module named _tkinter` Am I doing something wrong? Thanks, -- http://mail.python.

Re: iterators and views of lists

2009-12-19 Thread Anh Hai Trinh
On Dec 20, 12:04 am, Anh Hai Trinh wrote: > chain: > >   sorted(itertools.chain(listagent(x)[::2], listagent(y)[-1:1:-2])) >   [0, 4, 8, 12, 13, 15, 16, 17, 19] > > zip: > >   sorted(itertools.izip(listagent(z)[1::3], listagent(x)[2::3])) >   [(452, 16), (758, 4), (898, 10)] I think I mis-interp

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-19 Thread Alf P. Steinbach
* John Posner: On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach wrote: Chapter 2 is about Basic Concepts (of programming). It's the usual: variables, ... 1. Overall suggestion You have a tendency to include non-pertinent asides [1]. But then, rambling a bit endows a manuscript with