[ANN] mlabwrap-1.0.1 released

2009-03-24 Thread Alexander Schmolck
Mlabwrap allows pythonistas to interface to Matlab(tm) in a very straightforward fashion: >>> from mlabwrap import mlab >>> mlab.eig([[0,1],[1,1]]) array([[-0.61803399], [ 1.61803399]]) More at . Mlabwrap 1.0.1 is just a maintenance release

Re: Inefficient summing

2008-10-10 Thread Alexander Schmolck
beginner <[EMAIL PROTECTED]> writes: > On Oct 9, 3:53 pm, Alexander Schmolck <[EMAIL PROTECTED]> wrote: >> beginner <[EMAIL PROTECTED]> writes: >> how about: >> >> ratio = (lambda c: c.real/c.imag)(sum(complex(r["F1"], r["F2"]

Re: Inefficient summing

2008-10-09 Thread Alexander Schmolck
beginner <[EMAIL PROTECTED]> writes: > Hi All, > > I have a list of records like below: > > rec=[{"F1":1, "F2":2}, {"F1":3, "F2":4} ] > > Now I want to write code to find out the ratio of the sums of the two > fields. > > One thing I can do is: > > sum(r["F1"] for r in rec)/sum(r["F2"] for r in re

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > A problem is that '1234' in Python is a string, so using ' in numbers > looks a bit dangerous to me (and my editor will color those numbers as > alternated strings, I think). Yeah, editors, especially those with crummy syntax highlighting (like emacs) might get it wron

Re: Numeric literal syntax

2008-09-04 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: > >> It seems to me that the right choice for thousands seperator is the >> apostrophe. > > You mean the character already used as a string delimiter?

Re: Numeric literal syntax

2008-09-03 Thread Alexander Schmolck
Ben Finney <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: > >> For Python 2.7/3.1 I'd now like to write a PEP regarding the >> underscores into the number literals, like: 0b_0101_, 268_435_456 >> etc. > > +1 on such a capability. > > -1 on underscore as the separator. > > When you pro

Re: Programmatically exit the REPL

2008-08-26 Thread Alexander Schmolck
Without reading your post properly or having tried to do the same thing myself: I think you might want to have a look at ipython; it gives a better REPL and "embedding ipython" should give you plenty of hits as well. Matthew Fitzgibbons <[EMAIL PROTECTED]> writes: > I've got a pretty complex inte

Re: python-mode is missing the class browser

2008-08-08 Thread Alexander Schmolck
"Adam Jenkins" <[EMAIL PROTECTED]> writes: > On Fri, Aug 8, 2008 at 7:32 AM, Michele Simionato > <[EMAIL PROTECTED]> wrote: >> On Aug 7, 5:55 pm, Alexander Schmolck <[EMAIL PROTECTED]> wrote: > ... >> >> I have solved by using ipython.el wh

Re: python-mode is missing the class browser

2008-08-07 Thread Alexander Schmolck
Michele Simionato <[EMAIL PROTECTED]> writes: > I have noticed that the python-mode for Emacs that comes with the > latest Ubuntu is missing the class browser. Moreover if works > differently from the python-mode I was used to (for instance CTRL-c-c > works as CTRL-c-! whereas CTRL-c-! is missing,

Re: how to indent/dedent a region in emacs?

2008-06-11 Thread Alexander Schmolck
Grant Edwards <[EMAIL PROTECTED]> writes: > I've recently switched from Jed to Emacs for editing python > source, and I'm still stumped as to how one indents or dedents > a region of code. In Jed it's 'C-c <' or 'C-c >'. Google has > found several answers, but none of them work, for example I've

Re: Separators inside a var name

2008-06-09 Thread Alexander Schmolck
Rainy <[EMAIL PROTECTED]> writes: > I have a stylistic question. In most languages words in var. name are > separated by underscores or cap letters, resulting in var names like > var_name, VarName and varName. I don't like that very much because all > 3 ways of naming look bad and/or hard to type.

Re: is +=1 thread safe

2008-05-04 Thread Alexander Schmolck
Gary Herron <[EMAIL PROTECTED]> writes: > The test was meant to simulate the OP's problem, but even with your suggestion > of using numpy, it *still* fails! Well, although I haven't tested it extensively, it doesn't appear to fail for me, with numpy 1.02 and an AMD Athlon(tm) XP 2800+ under lin

Re: is +=1 thread safe

2008-05-04 Thread Alexander Schmolck
Gary Herron <[EMAIL PROTECTED]> writes: > But... It's not! > > A simple test shows that. I've attached a tiny test program that shows this > extremely clearly. Please run it and watch it fail. In [7]: run ~/tmp/t.py final count: 200 should be: 200 (I took the liberty to correct yo

Re: is +=1 thread safe

2008-05-03 Thread Alexander Schmolck
AlFire <[EMAIL PROTECTED]> writes: >> The threading module already has a function to return the number of Thread >> objects currently alive. > > I have threads within threads - so it does not suit me :-(. How about using a scalar numpy array? They are mutable, so I assume that x += 1 should be at

Re: Calling a matlab script from python

2007-09-05 Thread Alexander Schmolck
n o s p a m p l e a s e <[EMAIL PROTECTED]> writes: > Suppose I have a matlab script mymatlab.m. How can I call this script > from a python script? You could use . 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: best GUI library for vector drawing program

2007-08-17 Thread Alexander Schmolck
[x-posts removed] chewie54 <[EMAIL PROTECTED]> writes: > I should have also mentioned that is for a commercial application. That > doesn't rule Qt or PyQt out, but this is a startup company with very little > income so my first choice would be to use some GUI library that is free to > use for comme

Re: Fatest standard way to sum bytes (and their squares)?

2007-08-13 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > Erik Max Francis <[EMAIL PROTECTED]> writes: > >> Alexander Schmolck wrote: >> >>> Is this any faster? >>> >>> ordSum, orsSumSq = (lambda c:c.real,c.imag)(sum(complex(ord(x),ord(x)&

Re: decorators - more than just syntactic sugar

2007-08-13 Thread Alexander Schmolck
Michele Simionato <[EMAIL PROTECTED]> writes: > On Aug 11, 8:30 pm, Helmut Jarausch <[EMAIL PROTECTED]> wrote: >> Hi, >> >> are decorators more than just syntactic sugar in python 2.x and what >> about python 3k ? > > Well, I argued may times that syntactic sugar is important (all Turing > complet

Re: Fatest standard way to sum bytes (and their squares)?

2007-08-13 Thread Alexander Schmolck
Erik Max Francis <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > >> Is this any faster? >> >> ordSum, orsSumSq = (lambda c:c.real,c.imag)(sum(complex(ord(x),ord(x)<<1) >> for x in data)) > > That's pretty clever, but I neglected to

Re: Fatest standard way to sum bytes (and their squares)?

2007-08-12 Thread Alexander Schmolck
Erik Max Francis <[EMAIL PROTECTED]> writes: > For a file hashing system (finding similar files, rather than identical ones), > I need to be able to efficiently and quickly sum the ordinals of the bytes of > a file and their squares. Because of the nature of the application, it's a > requirement

Re: What is the "functional" way of doing this?

2007-08-01 Thread Alexander Schmolck
beginner <[EMAIL PROTECTED]> writes: > Hi, > > If I have a number n and want to generate a list based on like the > following: > > def f(n): > l=[] > while n>0: > l.append(n%26) > n /=26 > return l > > I am wondering what is the 'functional' way to do the same. Thi

Re: bool behavior in Python 3000?

2007-07-12 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Expressions like (i == j) used to return 0 and 1, and it was to avoid > breaking hacks like the above that bools were implemented as a subclass of > int, not because being able to write the above was a specific feature > requested. In the hypothetical

Re: Tuple vs List: Whats the difference?

2007-07-11 Thread Alexander Schmolck
Shafik <[EMAIL PROTECTED]> writes: > Hello folks, > > I am an experienced programmer, but very new to python (2 days). I > wanted to ask: what exactly is the difference between a tuple and a > list? I'm sure there are some, but I can't seem to find a situation > where I can use one but not the oth

Re: bool behavior in Python 3000?

2007-07-10 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I mean, really, does anyone *expect* True+True to give 2, or that 2**True > even works, without having learnt that Python bools are ints? I doubt it. Sure, why not? It's pretty damn useful. Ever heard of things like "indicator functions", "Iverson bra

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-25 Thread Alexander Schmolck
Douglas Alan <[EMAIL PROTECTED]> writes: >> Python has built-in abstractions for a few container types like >> lists and dicts, and now a new and more general one (iterators), so >> it's the next level up. > > Common Lisp has had all these things for ages. Rubbish. Do you actually know any common

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
"Anders J. Munch" <[EMAIL PROTECTED]> writes: > Like Steven said, tail-call optimisation is not necessary as you can always > hand-optimise it yourself. Care to demonstrate on some code written in CPS (a compiler or parser, say)? 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-12 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Mon, 11 Jun 2007 01:28:09 +0100, Alexander Schmolck wrote: > >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >> >>> On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: >>> >>

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-10 Thread Alexander Schmolck
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 09 Jun 2007 22:42:17 +0100, Alexander Schmolck wrote: > >>> As for why tail calls are not optimized out, it was decided that being able >>> to have the stack traces (with variable information, etc.) was more

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-09 Thread Alexander Schmolck
Josiah Carlson <[EMAIL PROTECTED]> writes: > James Stroud wrote: >> Terry Reedy wrote: >>> In Python, you have a choice of recursion (normal or tail) >> >> Please explain this. I remember reading on this newsgroup that an advantage >> of ruby (wrt python) is that ruby has tail recursion, implying

Re: matplotlib, usetex

2007-05-27 Thread Alexander Schmolck
Bill Jackson <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote the following on 05/25/2007 02:33 PM: >> I have no idea whether this will resolve your problem, but you could try >> updating to 0.90 (BTW what happens if you do axis([0,128,0,128])). > > The p

Re: matplotlib, usetex

2007-05-25 Thread Alexander Schmolck
Bill Jackson <[EMAIL PROTECTED]> writes: > > The problem does not exist when text.usetex is False. Ideas? I have no idea whether this will resolve your problem, but you could try updating to 0.90 (BTW what happens if you do axis([0,128,0,128])). cheers, 'as -- http://mail.python.org/mailman/l

Re: Lists vs tuples (newbie)

2007-05-21 Thread Alexander Schmolck
Szabolcs <[EMAIL PROTECTED]> writes: > Thanks for all the replies! > > Phoe6 wrote: >> 1) Return values from a function. When you return multiple values >> from a function. You store them as a tuple and access them >> individually rather then in the list, which bear the danger of being >> modifie

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-14 Thread Alexander Schmolck
Neil Hodgson <[EMAIL PROTECTED]> writes: > Paul Rubin wrote: >>> Plenty of programming languages already support unicode identifiers, >> >> Could you name a few? Thanks. > >C#, Java, Ecmascript, Visual Basic. (i.e. everything that isn't a legacy or niche language) scheme (major implementat

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Alexander Schmolck
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > PEP 1 specifies that PEP authors need to collect feedback from the > community. As the author of PEP 3131, I'd like to encourage comments > to the PEP included below, either here (comp.lang.python), or to > [EMAIL PROTECTED] > > In summary, this PEP

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Alexander Schmolck
Jarek Zgoda <[EMAIL PROTECTED]> writes: > Martin v. Löwis napisał(a): > >> So, please provide feedback, e.g. perhaps by answering these >> questions: >> - should non-ASCII identifiers be supported? why? > > No, because "programs must be written for people to read, and only > incidentally for machi

Re: Emacs and pdb after upgrading to Ubuntu Feisty

2007-05-08 Thread Alexander Schmolck
levander <[EMAIL PROTECTED]> writes: > Okay, thanks Alexander and Bernstein. I'll lookinto Emacs 23, but I'm > worried about compatibility with modes. Does all the stuff that works > in Emacs 21 work in 23? I've switched from 21 to 23 a few weeks ago and don't recall any particular issues (an

Re: Emacs and pdb after upgrading to Ubuntu Feisty

2007-05-06 Thread Alexander Schmolck
levander <[EMAIL PROTECTED]> writes: > Anybody can tell me who to get pdb working under emacs on Ubuntu > Feisty? This is not a direct answer to your question, but I'd recommend you try ipython (apt-get'able) and ipython.el; (manual install). Just enter ``pdb on`` in the interactive shell to end

Re: List objects are un-hashable

2007-04-27 Thread Alexander Schmolck
Andy <[EMAIL PROTECTED]> writes: > Hi, I'm trying to search and print any no# of Python keywords present > in a text file (say - foo.txt), and getting the above error. Sad for > not being able to decipher such a simple problem (I can come up with Without looking at the docs, it seems save to assu

Re: [ANN] mlabwrap-1.0final

2007-04-22 Thread Alexander Schmolck
Stef Mientki <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > I'm pleased to finally announce mlabwrap-1.0: > > Project website > > > --- > > <http://mlabwrap.sourceforge.net/> > > Description > > > --

[ANN] mlabwrap-1.0final

2007-04-11 Thread Alexander Schmolck
eedback and keep informed about new releases is mlabwrap-user: <https://lists.sourceforge.net/lists/listinfo/mlabwrap-user> the list is low-volume and subscription is recommended. Discussion of mlabwrap development takes place on the scipy-dev (please mention mlabwrap in the subject line):

Re: itertools, functools, file enhancement ideas

2007-04-08 Thread Alexander Schmolck
[EMAIL PROTECTED] (Alex Martelli) writes: > > 4. functools enhancements (Haskell-inspired): > >Let f be a function with 2 inputs. Then: > > a) def flip(f): return lambda x,y: f(y,x) > > b) def lsect(x,f): return partial(f,x) > > c) def rsect(f,x): return partial(flip(f), x)

Re: block scope?

2007-04-08 Thread Alexander Schmolck
Neal Becker <[EMAIL PROTECTED]> writes: > One thing I sometimes miss, which is common in some other languages (c++), > is idea of block scope. It would be useful to have variables that did not > outlive their block, primarily to avoid name clashes. This also leads to > more readable code. I h

Re: String manipulation

2007-04-05 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > On 4 Apr, 21:47, Alexander Schmolck <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] writes: > > > Thank you very much, your code works perfectly! > > > > One thing I forgot: you might want to make the whitespace handling a bit

Re: String manipulation

2007-04-04 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > Thank you very much, your code works perfectly! One thing I forgot: you might want to make the whitespace handling a bit more robust/general e.g. by using something along the lines of set_phrase.replace(' ', r'\w+') 'as -- http://mail.python.org/mailman/listinfo/p

Re: String manipulation

2007-04-04 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > That doesn't work. What about "kindest\nregard"? I think you're best of > reading the whole file in (don't forget to close the files, BTW). I should have written "that may not always work, depending of wh

Re: String manipulation

2007-04-04 Thread Alexander Schmolck
All the code is untested, but should give you the idea. [EMAIL PROTECTED] writes: > Hi all! > > I have a file in which there are some expressions such as "kindest > regard" and "yours sincerely". I must create a phyton script that > checks if a text contains one or more of these expressions an

Re: zip list with different length

2007-04-04 Thread Alexander Schmolck
MC <[EMAIL PROTECTED]> writes: > Hi! > > Brutal, not exact answer, but: > > a = range(5) > b = range(3) > print zip(a+[None]*(len(b)-len(a)),b+[None]*(len(a)-len(b))) You reinvented map(None,a,b). 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: zip list with different length

2007-04-04 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: C> hi > suppose i have 2 lists, a, b then have different number of elements, > say len(a) = 5, len(b) = 3 > >>> a = range(5) > >>> b = range(3) > >>> zip(b,a) > [(0, 0), (1, 1), (2, 2)] > >>> zip(a,b) > [(0, 0), (1, 1), (2, 2)] > > I want the results to be > [(0, 0), (1,

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Alexander Schmolck
"Luis M. González" <[EMAIL PROTECTED]> writes: > On Mar 31, 8:38 am, Bjoern Schliessmann [EMAIL PROTECTED]> wrote: > > Mark Dufour wrote: > > > Shed Skin allows for translation of pure (unmodified), implicitly > > > statically typed Python programs into optimized C++, and hence, > > > >

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread Alexander Schmolck
"dmitrey" <[EMAIL PROTECTED]> writes: > Thank you > (however in MATLAB ischar is the same as isstr) Right, sorry. > but what if I don't know the name of module? > I.e. I have > > def myfunc(param): ... > #where param can be both funcName or a function, and I want to obtain > both name and func,

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread Alexander Schmolck
"dmitrey" <[EMAIL PROTECTED]> writes: > I can't find these via web serch > > thank you in advance, > Dmitrey str2func: getattr(some_module, 'f') func2str: f.__name__ ischar: isinstance(x, basestring) and len(x) == 1 isfunc: callable(x) # is most likely to be what you want 'as -- http://mail.p

Re: Try to get help on pymat

2007-03-06 Thread Alexander Schmolck
"CHRIS CHEW" <[EMAIL PROTECTED]> writes: > I am trying to get my pymat to work. The Python script did not interface to > matlab yet. What are the required script to get the interface to work? Please > send me email at [EMAIL PROTECTED] You might want to have a look at . c

[ANN] mlabrap-1.0b: a high level python to matlab bridge

2007-02-27 Thread Alexander Schmolck
URL --- Description --- Mlabwrap-1.0 is a high-level python to matlab(tm) bridge that makes calling matlab functions from python almost as convenient as using a normal python library. It is available under a very liberal license (BSD/MIT) and should work

Re: Calling J from Python

2007-02-09 Thread Alexander Schmolck
[restoring context] "Ant" <[EMAIL PROTECTED]> writes: > > On Feb 6, 12:21 am, greg <[EMAIL PROTECTED]> wrote: > > > > Alexander Schmolck wrote: > > > For example I once wrote this (slow) code to display > > > part of a mandelbrot fractal: &

Re: Calling J from Python

2007-02-05 Thread Alexander Schmolck
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > No, thanks. But hopefully we have Python : > > Python 2.4.1 (#1, Jul 23 2005, 00:37:37) > [GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. >

Re: Calling J from Python

2007-02-05 Thread Alexander Schmolck
Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > > Apart from being less to type > > Cool. Less to type. Yes. Readability is more important in many context, but for something designed for interactive experimentation and exploration lit

Re: Calling J from Python

2007-02-05 Thread Alexander Schmolck
Larry Bates <[EMAIL PROTECTED]> writes: > And why is that superior to this: > > def avg(l): > return float(sum(l))/len(l) > > >>>avg([1,2,3,4]) > 2.5 Apart from being less to type and it is superior in that it's generalizes much better, e.g: avg&.^. NB. geomtric mean avg&.%NB. harmon

Re: Calling J from Python

2007-02-05 Thread Alexander Schmolck
Robin Becker <[EMAIL PROTECTED]> writes: > Dennis Lee Bieber wrote: > > On Mon, 05 Feb 2007 17:52:27 +0100, Bjoern Schliessmann > > <[EMAIL PROTECTED]> declaimed the following > > in comp.lang.python: > > > > >> Mh, just looking at some "advanced" J source taken from > >> wikipedia.org makes me f

Re: Calling J from Python

2007-02-05 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > Gosi> J is in many ways similar to Python. > > Gosi> J has very many advanced operations. > > Gosi> http://www.jsoftware.com/ > > Doesn't look like open source of any variety. If a person uses Python with > various add-ons (RPy, numpy, matplotlib, etc) w

Re: in place-ness of list.append

2007-02-05 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: > > > >>>>> "Bart" == Bart Van Loon <[EMAIL PROTECTED]> writes: > > > > >> Such an operation will be O(N**2), > > > > Bart>

Re: in place-ness of list.append

2007-02-05 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > > "Bart" == Bart Van Loon <[EMAIL PROTECTED]> writes: > > >> Such an operation will be O(N**2), > > Bart> why is that? > > The a[:] operation makes a copy of a (as will the x = a + [n] idiom). I'm pretty confident append itself (and a+[n]) are linear in

Re: Very newbie programming

2006-06-10 Thread Alexander Schmolck
TheSaint <[EMAIL PROTECTED]> writes: > # Filling the c with the list of devices which are recorded to be mounted > > d = filter((lambda a: a[:2] =='/d'),mnt.readlines()) # non /dev-mounts are > off > d = map((lambda a: a.split()[:1]),d) # only the first info column is used Just focusing one one

Re: string.count issue (i'm stupid?)

2006-05-22 Thread Alexander Schmolck
"Dirk Hagemann" <[EMAIL PROTECTED]> writes: > I think I can tell you WHY this happens, but I don't know a work-around > at the moment. len(re.findall('_(?=a_)', '_a_a_a_a_')) # untested def countWithOverlaps(s, pat): return len(re.findall("%s(?=%s)" % (re.escape(pat[0]), re.escape(pat[1:]))

Re: round numbers in an array without importing Numeric or Math?

2006-05-16 Thread Alexander Schmolck
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > Is there an easy way to round numbers in an array? > > I have > Test = [1.1,2.2,3.7] > > and want to round so the values are > > print Test [1,2,4] [int(x+0.5) for x in Test] 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
Ken Tilton <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > Ken Tilton <[EMAIL PROTECTED]> writes: > > > > >>In Common Lisp we would have: > >> > >>(defvar *x*) ;; makes it special > >>(setf *x* 1) >

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
jayessay <[EMAIL PROTECTED]> writes: > > Great -- so can I see some code? Can't be that difficult, it takes about > > 10-15 > > lines in python (and less in scheme). > > Do you actually need the code to understand this relatively simple concept??? Yes. I'd be genuinely curious to see how an imp

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
Duane Rettig <[EMAIL PROTECTED]> writes: > My reason for responding to you in the first place was due to your poor use > of the often misused term "bug". You could have used many other words or > phrases to describe the situation, and I would have left any of those alone. I'm happy to accept you

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
Duane Rettig <[EMAIL PROTECTED]> writes: > Alexander Schmolck <[EMAIL PROTECTED]> writes: > > > Ken Tilton <[EMAIL PROTECTED]> writes: > > > >> In Common Lisp we would have: > >> > >> (defvar *x*) ;; makes it special > >

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
Ken Tilton <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > jayessay <[EMAIL PROTECTED]> writes: > > > > >>"Michele Simionato" <[EMAIL PROTECTED]> writes: > >> > >> > >>>I was interested in a proo

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
Ken Tilton <[EMAIL PROTECTED]> writes: > In Common Lisp we would have: > > (defvar *x*) ;; makes it special > (setf *x* 1) > (print *x*) ;;-> 1 > (let ((*x* 2)) >(print *x*)) ;; -> 2 > (print *x*) ;; -> 1 You seem to think that conflating special variable binding and

Re: New tail recursion decorator

2006-05-12 Thread Alexander Schmolck
Duncan Booth <[EMAIL PROTECTED]> writes: > Tim N. van der Leeuw wrote: > > > The other thing I do not understand, due to my limited understanding of > > what is tail-recursion: factorial2 (Duncan's definition) is not proper > > tail-recursion. Why not? How does it differ from 'real' tail recursio

Re: A critic of Guido's blog on Python's lambda

2006-05-12 Thread Alexander Schmolck
jayessay <[EMAIL PROTECTED]> writes: > "Michele Simionato" <[EMAIL PROTECTED]> writes: > > > I was interested in a proof of concept, to show that Python can > > emulate Lisp special variables with no big effort. > > OK, but the sort of "proof of concept" given here is something you can > hack up

Re: Matplotlib in Python vs. Matlab, which one has much better graphical pressentation?

2006-05-11 Thread Alexander Schmolck
N/A <[EMAIL PROTECTED]> writes: > Hi all, > > Can I have your opinions on Matlab vs. Matplotlib in Python in terms of 2D and > 3D graphical presentation please. > > > Matplotlib in Python vs. Matlab, which one has much better graphical > pressentation? As far as 2D plots are concerned I think

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Alexander Schmolck
Bill Atkins <[EMAIL PROTECTED]> writes: > Here's how one of the cells examples might look in corrupted Python > (this is definitely not executable): > > class FallingRock: > def __init__(self, pos): > define_slot( 'velocity', lambda: self.accel * self.elapsed ) > define_slot( 'p

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Alexander Schmolck
[trimmed groups] Ken Tilton <[EMAIL PROTECTED]> writes: > yes, but do not feel bad, everyone gets confused by the /analogy/ to > spreadsheets into thinking Cells /is/ a spreadsheet. In fact, for a brief > period I swore off the analogy because it was so invariably misunderstood. > Even Graham mis

Re: NaN handling

2006-05-06 Thread Alexander Schmolck
Felipe Almeida Lessa <[EMAIL PROTECTED]> writes: > Em Sex, 2006-05-05 às 16:37 -0400, Ivan Vinogradov escreveu: > > This works to catch NaN on OSX and Linux: > > > > # assuming x is a number > > if x+1==x or x!=x: > > #x is NaN > > This works everywhere: > > nan = float('nan') > > . > . >

Re: NaN handling

2006-05-06 Thread Alexander Schmolck
Robert Kern <[EMAIL PROTECTED]> writes: > Ivan Vinogradov wrote: > > > It doesn't seem to be here under OSX either (universal Python install). > > It's not enabled by default. In the source distribution, it is > Modules/fpectlmodule.c . > > > Since numpy seems to be working on a variety of plat

Re: Calling Python from Matlab

2006-04-23 Thread Alexander Schmolck
"Daniel Nogradi" <[EMAIL PROTECTED]> writes: > > I am desperately looking for a way to call Python from Matlab. I have become > > used to Python's rich syntax and large number of libraries, and feel > > ridiculously clumsy being stuck with Matlab's rather restricted facilities > > for doing other

Re: Automated Graph Plotting in Python

2006-04-09 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > 1. Which is the best graph plotting utility in python or linux. matplotlib (provided it does the type of graphs you need, which is likely) 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Dice probability problem

2006-04-05 Thread Alexander Schmolck
Tomi Lindberg <[EMAIL PROTECTED]> writes: > # Adds another die to results. > def add_dice(sums, die): > # If first die, all values appear once I'd add something like sums = sums or {} because otherwise your function will sometimes mutate sums and sometimes return a fresh object, whi

Re: Dice probability problem

2006-04-04 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > addDice(resultFor1, pool[1]) > addDice(pool[0], pool[1]) sorry should have spelled out that successive lines are meant to be equivalent, i.e. addDice(resultFor1, pool[1]) == addDice(pool[0], pool[1])

Re: Dice probability problem

2006-04-04 Thread Alexander Schmolck
Tomi Lindberg <[EMAIL PROTECTED]> writes: > I'm trying to find a way to calculate a distribution of outcomes with any > combination of dice. I have the basics done, but I'm a bit unsure how to > continue. My main concern is how to make this accept any number of dice, > without having to write a ne

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Alexander Schmolck
Mark Carter <[EMAIL PROTECTED]> writes: > A programmers mindset is usually geared towards "writing applications". What > I'm currently doing in Lisp is building up functions as I need them. Using > emacs, I can just C-x C-e to make my functions "live", and when it's time to > stop for the day, save

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-20 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > (defun >> (val num-bytes) > "Right-shift positive integer val by num-bytes" > (floor (/ val (expt 2 num-bytes or just (floor val (expt 2 num-bytes)) 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > The easiest way to do this is to have a nested dictionary of prefixes: for > each prefix as key add a nested dictionary of the rest of the split as value > or an empty dict if the split is empty. Accessing the dict with an userinput

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
"rh0dium" <[EMAIL PROTECTED]> writes: > Hi all, > > I am having a bit of difficulty in figuring out an efficient way to > split up my data and identify the unique pieces of it. > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] > > Now I want to split each item up on the "_" and compare i

Re: Python vs. Lisp -- please explain

2006-02-22 Thread Alexander Schmolck
Rocco Moretti <[EMAIL PROTECTED]> writes: > I think it's worth pointing out that not all dynamicism is equal, when it > comes to difficulty in compiling to machine code. No kidding (do you have any idea how this thread started out?). > Lisp, like the good functional language that it is, has (pri

Re: Python vs. Lisp -- please explain

2006-02-22 Thread Alexander Schmolck
"Michele Simionato" <[EMAIL PROTECTED]> writes: > I replied to this message yesterday, but it did not appear, so let's > try again. > > I agree with your points, but I would not say that Lisp is > intrinsically more dynamic than Python as a language; Neither would I -- I don't think either is ob

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
"Michele Simionato" <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > As common lisp and scheme demonstrate you can have high level of dynamism > > (and > > in a number of things both are more dynamic than python) and still get very > >

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
"Kay Schluehr" <[EMAIL PROTECTED]> writes: > Alexanders hypothesis is completely absurd. You're currently not in the best position to make this claim, since you evidently misunderstood what I wrote (I certainly did not mean to suggest that Guido *deliberately* chose to make python slow; quite th

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
Torsten Bronger <[EMAIL PROTECTED]> writes: > I was rather stunned, too, when I read his line of thought. > Nevertheless, I think it's not pointless, albeit formulated in an > awkward way. Of course, Python has not been deliberately slowed > down. Indeed -- and I'm really not sure what defect in

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
"Donn Cave" <[EMAIL PROTECTED]> writes: > Quoth Alexander Schmolck <[EMAIL PROTECTED]>: > | "Fredrik Lundh" <[EMAIL PROTECTED]> writes: > ... > |> the only even remotely formal definition I've ever seen is "language with > |>

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Alexander Schmolck a écrit : > > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > > > >>DH a écrit : > >>(snip) > >> > >>>It is by design. Python is dynamically typed. It is

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > > My point was that Guido probably (and fortunately!) was unaware of the > > extent > > to which you can have both dynamism and speed For the convenience of other readers, allow

Re: Python vs. Lisp -- please explain

2006-02-19 Thread Alexander Schmolck
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > > You might want to argue about whether scriping language is a meaningful and > > useful concept, but it's really hard to see how you could talk about > > "scripting &g

Re: Python vs. Lisp -- please explain

2006-02-19 Thread Alexander Schmolck
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > > What's far more interesting to me, however, is that I think there a good > > reasons to suspect python's slowness is more of a feature than a flaw: I'd > > n

Re: Python vs. Lisp -- please explain

2006-02-19 Thread Alexander Schmolck
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > DH a écrit : > (snip) > > It is by design. Python is dynamically typed. It is essentially an > > interpreted scripting language like javascript or ruby or perl, > > > It's not a "scripting" language, and it's not interpreted. Of course it is. Wh

Re: Python vs. Lisp -- please explain

2006-02-19 Thread Alexander Schmolck
[EMAIL PROTECTED] writes: > Hi, I've been thinking about Python vs. Lisp. I've been learning > Python the past few months and like it very much. A few years ago I > had an AI class where we had to use Lisp, and I absolutely hated it, > having learned C++ a few years prior. They didn't teach Lis

Re: Python vs. Lisp -- please explain

2006-02-19 Thread Alexander Schmolck
"Terry Reedy" <[EMAIL PROTECTED]> writes: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > In learning Python I've read more about Lisp than when I was actually > > trying to learn it, and it seems that the two languages have lots of > > similarities: > > > > http://www.norvig.

py-ext: casting pointers to ints on 32bit and 64bit systems

2006-01-27 Thread Alexander Schmolck
what's the best approach to write C(++)-extension code that has to create a python int from a C pointer and vice versa so that it works smoothly on 32 bit and 64 platforms (on which sizeof(int) != sizeof(*void)) equally work (under unix,mac&windows and with gcc, vc and borland)? Currently the rele

  1   2   >