Re: Slicing matrix

2006-04-17 Thread Alex Martelli
Robert Kern <[EMAIL PROTECTED]> wrote: ... > array([[ 0, 1, 2, 3, 4], >[ 5, 6, 7, 8, 9], >[10, 11, 12, 13, 14], >[15, 16, 17, 18, 19], >[20, 21, 22, 23, 24]]) > > > How do I easily slice out [0,1,2] > > In [7]: p[0, :3] > Out[7]: array([0, 1, 2]) > > >

Re: Missing interfaces in Python...

2006-04-17 Thread Alex Martelli
Jonathan Daugherty <[EMAIL PROTECTED]> wrote: > # "parser"...?! If you have an 'Object o', say one just received as an > # argument, and cast it to IBlahble, a la > # > # IBlahble blah = (IBlahble) o; > # > # ...what can the parser ever say about it? > > Maybe you didn't read the "I think"

Re: Ironpython book?

2006-04-17 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Anyone know if there is a book for Ironpython in the works? A good > knowledge of .NET and Python is enough to get started but just poking > around Ironpython homepage it seems like there are some new language > features added to handle some quirks with working within

Re: Ironpython book?

2006-04-17 Thread Alex Martelli
BartlebyScrivener <[EMAIL PROTECTED]> wrote: > Alex: > > So is the ruling hierarchy all using the UNIX command line on Mac OSX? > Free BSD? Linux? I'm a struggling novice. I'm just curious. Uh? Who's "the ruling hierarchy"? If you're talking about the PSF, I guess Linux, overall, may hold the

Re: Ironpython book?

2006-04-17 Thread Alex Martelli
Jay Parlar <[EMAIL PROTECTED]> wrote: ... > > I don't know of any such books, but if M$ is willing to slip me a > > suitable sweetener (to make it worth my while to install Windows again ... > Q: "So Alex, what are you doing with your 20% time at Google right now?" > A: "Working for Microsoft

Re: Ironpython book?

2006-04-18 Thread Alex Martelli
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > I suspected. I've played with Linux distros, but never a Mac. That > > takes more $$ than M$, Find me a 2-kg, 5+ battery hours, well-heeled laptop (with wifi, 801b, etc etc) below the $999 of the iBook G4... it's hard today, it was just imposible b

Re: Ironpython book?

2006-04-18 Thread Alex Martelli
BartlebyScrivener <[EMAIL PROTECTED]> wrote: > >> If you are interested in a pure managed-code > >> implementation of the Python language, > >> you should check out the IronPython project > > There's the rub. I don't know what "pure managed-code" means. But I'll You can find much material about

Re: Any Python lullabies?

2006-04-18 Thread Alex Martelli
Dustan <[EMAIL PROTECTED]> wrote: ... > Howsabout this? > > > >>> import this > The Zen of Python, by Tim Peters > > Beautiful is better than ugly. ... Anna and I used it as one of our wedding's readings back in 2004 (together with other texts from Dickinson, Petrarca, Lucretius...) and I

Re: 2.5 excitement

2006-04-18 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: ... > Heh. Since we're just finally turning in our 100% first draft of Python > for Dummies, I tend to think more in terms of what a Python newbie will Funny timing coincidence: your 1st draft of Python for Dummies going in now, my 2nd edition of Python in a Nut

Re: Missing interfaces in Python...

2006-04-18 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote: > Peter Maas <[EMAIL PROTECTED]> wrote: > > He probably means that with interfaces one could test compliance > > with the interface as a whole instead of testing each member and > > each signature as a single piece. > > All interfaces (as implemented by Java)

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote: ... > > A class asserting, e.g., "implements IPainter", doesn't thereby risk > > being accidentally misused where an IGunslinger is required (OTOH, > > implementing >1 of these IS a bother, but that's sort of inevitable). > > I suppose, but all you've really

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Ben <[EMAIL PROTECTED]> wrote: ... > It seems to me that a lot of python projects reimplement interfaces or > adaption of some kind once they reach a certain size (Zope, PEAK, eggs, > TurboGears, etc), which implies that they really do have some benefits, > particularly in documentation. PEAK i

Re: Ironpython book?

2006-04-19 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: ... > Just out of curiosity, is Python.NET a dead project? AFAIK, it's a long-completed research project. I do not know of anybody planning to fork it to a new project, though that of course does not rule out that somebody might be planning to do so. Al

Re: Ironpython book?

2006-04-19 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > John Salerno <[EMAIL PROTECTED]> wrote: > >... > >> Just out of curiosity, is Python.NET a dead project? > > > > AFAIK, it's a long-completed research project. I do not kno

Re: Ironpython book?

2006-04-19 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > are we talking about two different things here, perhaps ? > > > > the "Python for .Net" tool I'm talking about is an integration tool that > > lets you use CPython and CPython extensions together with CLR stuff, > > while IronP

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Rene Pijlman <[EMAIL PROTECTED]> wrote: > Alex Martelli: > >PEAK is an interesting counterexample, particularly since Philip Eby > >tends to be "ahead of the curve": > > I never noticed PEAK before. Is it well worth studying? Oh yes. Alex -- http://ma

Re: How protect proprietary Python code? (bytecode obfuscation?, what better?)

2006-04-20 Thread Alex Martelli
Ben Sizer <[EMAIL PROTECTED]> wrote: > bruno at modulix wrote: > > Let's rephrase it: > > "do you really think that native code is harder *enough* to > > reverse-engineer ?" > > I don't know. In terms of copy protection, popular off-the-shelf > software is going to get cracked whether it's writte

Re: perspective on ruby

2006-04-20 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: ... > course in C++ doesn't cut it, the curriculum should either use different > languages fitted to each task or emphasize a single language with broad > abilities (picking the best programming model for each task). Java is The only "single language"

Re: Looking for a programming resource for newbees

2006-04-20 Thread Alex Martelli
bambooforest <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm from a Linguistics background and am new(er) to programming. Could Welcome! Some of my best memories date from back when I did computational linguistics (with emphasis on the 'computational', but in close cooperation with people with emp

Re: Thanks from the Java Developer

2006-04-20 Thread Alex Martelli
Ant <[EMAIL PROTECTED]> wrote: > Python ruined my life. > > I am a Java programmer by profession, and ever since learning Python, I > find it a real chore to open Eclipse and write Java code (or worse - > the XML config files that seem to glue J2EE together). And while I > spend some of my spare

Re: Strategy Design Pattern

2006-04-20 Thread Alex Martelli
Daniel Santa Cruz <[EMAIL PROTECTED]> wrote: ... > I'm at a loss at how I can do this with Python, any pointers would be > more than welcomed! Check out my homepage, www.aleax.it, you'll find several PDFs for my various presentations over the years: many have to do with DPs and Python, and I s

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Alex Martelli
Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Over the time I've seen lots of remarks about python that read like "a > lot like lists in lisp" or "like the hashtable in java" or any other > form of "like in ". Since Python was released well before Java, saying that a feature in Python is "

Re: how to append to a list twice?

2006-04-21 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: > If I want to create a list of the form [100, 99, 99, 98, 98, 97, 97...] > (where each item is repeated twice after the first one), how might I do > that most efficiently? > > Right now I have this: > > series = [100] > for x in range(10): # just for te

Re: how to append to a list twice?

2006-04-21 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > > But of course that only does it once, and I don't want to have to copy > > > and paste the append line. Perhaps there's a better way than this. > > > > def makeseries

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-22 Thread Alex Martelli
Anthony Liu <[EMAIL PROTECTED]> wrote: ... > As a matter of fact, given that we have to specify the > number of states for an HMM, I would like to create a > specified number of random floating numbers whose sum > is 1.0. def forAL(N): N_randoms = [random.random() for x in xrange(N)]

Re: Problem calling math.cos()

2006-04-22 Thread Alex Martelli
Sambo <[EMAIL PROTECTED]> wrote: > I have the following module: > --- > import math > > def ac_add_a_ph( amp1, ph1, amp2, ph2 ): > > amp3 = 0.0 > ph3 = 0.0 > ac1 = ( 0, 0j ) > ac2 = ( 0, 0j ) > ac3 = ( 0, 0j ) You're defining ac1, ac2, ac3 as tup

MS VC++ Toolkit 2003, where?

2006-04-23 Thread Alex Martelli
So, I thought I'd tool up to let me build and test Python extensions on Windows (as well as Mac and Linux) -- I'm trying out Parallels Workstation beta on my new Macbook Pro (and so far it seems to work very well), I bought and installed a Win2000 Pro on it (since according to the grapevine it work

Re: MS VC++ Toolkit 2003, where?

2006-04-23 Thread Alex Martelli
David Rushby <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > So -- does anybody know if the 2003-level Toolkit is STILL available for > > download somewhere... > > >http://www.microsoft.com/downloads/details.aspx?FamilyId=272BE09D-40BB- >49FD-9CB0-4BF

Re: Problem calling math.cos()

2006-04-23 Thread Alex Martelli
Thomas Bellman <[EMAIL PROTECTED]> wrote: > Alex Martelli <[EMAIL PROTECTED]> wrote: > > > C has no stand on complex numbers. > > If by that you mean that C does not have complex numbers, then > you are wrong. C99 defines the three types float _Complex, &

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-23 Thread Alex Martelli
fumanchu <[EMAIL PROTECTED]> wrote: > I'm surprised noone has pursued a course of subtraction rather than > division. Say you want 10 numbers: > > >>> s = 1.0 > >>> n = [] > >>> for x in xrange(9): > ... value = random.random() * s > ... n.append(value) > ... s -= value > ... > >>> n.append

Re: getattr from local scope

2006-04-23 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Basically my application has a scheduler which stores names of functions > > defined in the "schedule" module in a database, to be run on certain > > days. Every night I call schedule.RunSchedule, which grabs all the rows on

Re: Using distutils in Windows XP / "Python in a Nutshell"

2006-04-23 Thread Alex Martelli
Blair LeGent <[EMAIL PROTECTED]> wrote: > Following the directions in "Python in a Nutshell" (an excellent book), Thanks! > I entered the C code for "helloworld.c", saved it as a file, and entered > this script and saved it as setup.py: > > from distutils.core import setup, Extension > setup(na

Re: MS VC++ Toolkit 2003, where?

2006-04-23 Thread Alex Martelli
AIM <[EMAIL PROTECTED]> wrote: > The site comes back with a message saying ... > > "The download you requested is unavailable. If you continue to see this > message when trying to access this download, go to the "Search for a > Download" area on the Download Center home page." > > Does anyone ha

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
JW <[EMAIL PROTECTED]> wrote: ... > > As suggested to me by David Rushby 10 hours ago, > > > > ... < huge URL snipped > ... > > Alas, somehow this URL was split in two, and all the kings horses and all > the kings men can't seem to put it back together again (at least in my > browser). Could

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Can anybody suggest where to get a Framework SDK 1.1., or any other > > legal way to get "the core msvcrt.lib for msvcr71.dll against which to > > link your extensions. Thi

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > As suggested to me by David Rushby 10 hours ago, > > > > http://www.microsoft.com/downloads/details.aspx?FamilyId=272BE09D-40BB-4 > > 9FD-9CB0-4BFA122FA91B&displaylang=en &

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
Robert Kern <[EMAIL PROTECTED]> wrote: > Edward Elliott wrote: > > I think Apple switched to the Intel compiler for > > x86 macs, was python built with that or with gcc? > > I'm pretty sure MacTel OS X still uses gcc 4 (although I think there is a beta > version of the Intel compiler available).

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
Ron Adam <[EMAIL PROTECTED]> wrote: ... > I still get the following with the tinyurl link: > > ~~~ > The download you requested is unavailable. If you continue to see this > message when trying to access this download, go to the "Search for a > Download" area on the Download Center home page.

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > the Windows version, despite the slight > > overhead of running under Parallels' virtualization, is an impressive > > 12%+ _faster_ than the "native" MacOSX Python 2.4.3 (I

Re: MS VC++ Toolkit 2003, where?

2006-04-24 Thread Alex Martelli
Andrew Trevorrow <[EMAIL PROTECTED]> wrote: > Ron Adam wrote: > > > > Try tinyurl http://tinyurl.com/gv8wr please. > > > > I still get the following with the tinyurl link: > > > > ~~~ > > The download you requested is unavailable. If you continue to see this > > message when trying to access th

Re: Probability Problem

2006-04-24 Thread Alex Martelli
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Elliot Temple <[EMAIL PROTECTED]> wrote: > > >Problem: Randomly generate 10 integers from 0-100 inclusive, and sum > >them. Do that twice. What is the probability the two sums are 390 apart? > > I think the sum w

Re: Probability Problem

2006-04-24 Thread Alex Martelli
Elliot Temple <[EMAIL PROTECTED]> wrote: > On Apr 24, 2006, at 8:24 PM, Alex Martelli wrote: > > > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > > > >> In article <[EMAIL PROTECTED]>, > >> Elliot Temple <[EMAIL PROTECTED]> wr

Re: MinGW and Python

2006-04-25 Thread Alex Martelli
sturlamolden <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > > Dunno. Depends on the machine. Depends on the program. Depends on how > > the interpreter and any extension modules and underlying libraries were > > built. Depends on which Linux and which Windows. > > > > I'm sorry, but your que

Re: MinGW and Python

2006-04-25 Thread Alex Martelli
sturlamolden <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > > - gcc does not optimize particularly well. > > That is beyond BS. The more recent gcc releases optimize as well as any > commercial compiler. GCC 4 may even optimize better than MSVC. > > GCC is the compiler used to build the Li

Re: MinGW and Python

2006-04-25 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > about MacOSX, which also uses gcc: 14% faster pybench using Python 2.4.3 > > this is the second time I've seen that 14% figure. OOC, where does it come > from? the data sets you posted show an ave

Re: MinGW and Python

2006-04-25 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > At the same time, if the 14% slowdown is representative, then it's not > > true that the compiler responsible for it "optimizes as well" as the > > other; indeed, "doe

Re: OOP / language design question

2006-04-25 Thread Alex Martelli
Duncan Booth <[EMAIL PROTECTED]> wrote: ... > Actually, this is quite an interesting example becaue it wouldn't work in > C++: if you tried the same trick the call to dothis from the base > constructor (even assuming it is virtual) would actually call Base.dothis. Yep. > I think you have demo

Re: Type-Def-ing Python

2006-04-27 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Brett Cannon's thesis in which he tweaks the compiler and shows that > type-defing python would not help the compiler achieve a 5% performace > increase. > > Brett Cannon, "Localized Type Inference of Atomic Types in Python": > http://www.ocf.berkeley.edu/~bac/t

Re: Unpacking a list of strings

2006-04-27 Thread Alex Martelli
Panos Laganakos <[EMAIL PROTECTED]> wrote: > Is there some other practice than reading all the strings and slicing > them later? > > They're stored in the form of: > List Group[10]: > char[17] name; > > So I thought of doing: > unpacked = unpack('%s' % (10*17), data) > > And then slicing th

Re: Type-Def-ing Python

2006-04-27 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Alex Martelli <[EMAIL PROTECTED]> wrote: > ><[EMAIL PROTECTED]> wrote: > > ... > >> Brett Cannon's thesis in which he tweaks the compiler and shows that > &g

Re: Non-web-based templating system

2006-04-28 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Hi, > > I'm creating a small application in Python that uses lists and > dictionaries to create a rudimentary database. I'd like to create some > "fill-in-the-blanks" reports from this data, ideally by taking an RTF > or plaintext file as a template and replacing plac

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau <[EMAIL PROTECTED]> wrote: > Hi all, > > Is there any reason that under Python you cannot instantiate the object > class and create any attributes like you would be able for a normal class? Yep: instances of type object do not have a __dict__ and therefore there is no place to put

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau <[EMAIL PROTECTED]> wrote: ... > I can understand the design decision not to give object a __dict__, but > I wonder if i'd be a good idea to have a class that derives from object > and has a __dict__ to be in the standard library. I posted the original > question because I run in

Re: Can we create an_object = object() and add attribute like fora class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > Pierre Rouleau wrote: > > > > > >>I can understand the design decision not to give object a __dict__, but > >>I wonder if i'd be a good idea to have a class that derives from object > >>and has a __dict__ to be in the standa

Re: How to efficiently read binary files?

2006-04-30 Thread Alex Martelli
David Lees <[EMAIL PROTECTED]> wrote: > I want to process large binary files (>2GB) in Python. I have played > around with prototypes in pure Python and profiled the code. Most of > the time seems to be spent converting back and forth to and from strings > using the struct module. Is there a wa

Re: Setting a module package to use new-style classes

2006-05-02 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: > "Panos Laganakos" <[EMAIL PROTECTED]> writes: > > > Is there a way to have a whole module package use the new-style > > classes, without having to specify it per module-file or even worse, > > per class definition? > > TTBOMK, you do that with a single sta

Re: Sorting a list of dictionaries by dictionary key

2006-05-04 Thread Alex Martelli
Tim Chase <[EMAIL PROTECTED]> wrote: > > assuming that DateTime returns something that compares correctly, you can > > do something like: > > > > def sortkey(item): > > return item.get("from_datetime") > > > > data.sort(key=sortkey) > > > > (assuming Python 2.4 or later) > > Bu

Re: Subclassing array

2006-05-04 Thread Alex Martelli
TG <[EMAIL PROTECTED]> wrote: ... > When I call Vector.__init__() in Stimulus, doesn't it also call __new__ > ? I don't understand the detail of callings to __new__ and __init__ in > python inheritance ... Calling a (new-style) class does __new__ first, THEN calls the class's __init__ on the re

Re: stripping unwanted chars from string

2006-05-04 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > I'm looking for the "best" way to strip a large set of chars from a filename > string (my definition of best usually means succinct and readable). I > only want to allow alphanumeric chars, dashes, and periods. This is what I > would write in Perl (bl

Re: Python for Perl programmers

2006-05-05 Thread Alex Martelli
John J. Lee <[EMAIL PROTECTED]> wrote: > "A.M" <[EMAIL PROTECTED]> writes: > > > Is there any efficient online resource or book that help experienced Perl > > programmers to Python? > > Worry instead about how you're going to keep maintaining your Perl > code after you've developed an allergic r

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

2006-05-05 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: ... > But the key in the whole thread is simply that indentation will not > scale. Nor will Python. Absolutely. That's why firms who are interested in building *seriously* large scale systems, like my employer (and supplier of your free mail account), wou

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

2006-05-06 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: ... > > Absolutely. That's why firms who are interested in building *seriously* > > large scale systems, like my employer (and supplier of your free mail ... > > Obviously will not scale. Never. > > > > Well... hardly ever! > > You are talking about b

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

2006-05-06 Thread Alex Martelli
ter characterization than "curious", even if you're seriously into understatement. > I won't say more, since Alex Martelli already pointed out that Google is > doing big things with Python and it seems to scale well for them. And of course we're not the only ones.

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

2006-05-06 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: > Martin P. Hellwig wrote: > > Bill Atkins wrote: > > > > > >> > >> How do you define scalability? > >> > > http://www.google.com/search?hl=en&q=define%3Ascalability&btnG=Google+Search > > > > Damn! Google can do that?! Omigod!!! Not joking, I never knew t

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

2006-05-06 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: ... > Looks like dictionaries are no match for the ambiguity of natural > language. :) Let me try again: it is Python itself that cannot scale, as > in gain "new power and capability", and at least in the case of lambda > it seems to be because of indentati

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

2006-05-06 Thread Alex Martelli
Bill Atkins <[EMAIL PROTECTED]> wrote: ... > > ``allow ( as an ordinary single-character identifier'' as for the > > unneded feature ``allow unnamed functions with all the flexibility of > > named ones''. > > Not so infeasible: > > (let ((|bizarrely(named()symbol| 3)) > (+ |bizarrely(na

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

2006-05-06 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: ... > True but circular, because my very point is that () was a great design > choice in that it made macros possible and they made CL almost > infinitely extensible, while indentation-sensitivity was a mistaken > design choice because it makes for very cl

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

2006-05-06 Thread Alex Martelli
Bill Atkins <[EMAIL PROTECTED]> wrote: ... > > > > Read again what I wrote: I very specifically said "ordinary > > *single-character* identifier" (as opposed to "one of many characters > > inside a multi-character identifier"). Why do you think I said > > otherwise, when you just quoted what I

Re: Splice two lists

2006-05-06 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Is there a good way to splice two lists together without resorting to a > manual loop? Say I had 2 lists: > > l1 = [a,b,c] > l2 = [1,2,3] > > And I want a list: > > [a,1,b,2,c,3] as the result. > > I've been searching around but I can't seem to fi

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

2006-05-06 Thread Alex Martelli
Bill Atkins <[EMAIL PROTECTED]> wrote: ... > Does Python have any support for closures? If so, ignore this point. Ignored, since closures are there. > Being able to keep pass around state with functions is useful. Sure, but naming the functions doesn't hamper that. > There are also cases wh

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

2006-05-06 Thread Alex Martelli
Bill Atkins <[EMAIL PROTECTED]> wrote: ... > Believe it or not, _you_ got it wrong. Acknowledged: Common Lisp is even MORE insane (note that the quote "INSANELY extensible" is from Tilton) than I believed -- I'm pretty sure that the Lisp dialects I used in 1979-1981 didn't go to such crazy extr

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

2006-05-06 Thread Alex Martelli
Paul Rubin wrote: ... > > Yes, we are, because the debate about why it's better for Python (as a > > language used in real-world production systems, *SCALABLE* to extremely > > large-scale ones) to *NOT* be insanely extensible and mutable is a > > separate one -- Pytho

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

2006-05-06 Thread Alex Martelli
Ken Tilton <[EMAIL PROTECTED]> wrote: ... > Why? (symbol-name '|(|) -> "(" (No, the "s are not part of the name!) > > If you want to argue about that, I will have to bring up the Lisp > readtable. Or did you forget that, too? Mea culpa -- it wasn't in the Lisp(s) I used 25+ years ago, nor in

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

2006-05-06 Thread Alex Martelli
Bill Atkins <[EMAIL PROTECTED]> wrote: ... > > And here is where we check if you're as gracious about admitting your > > errors, as I am about mine. Brooks' law is: > > > > """Adding manpower to a late software project makes it later.""" > > > > These are Brooks' words, literally. OK so far? >

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

2006-05-06 Thread Alex Martelli
Tomasz Zielonka <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Having to give functions a name places no "ceiling on expressiveness", > > any more than, say, having to give _macros_ a name. > > And what about having to give numbers a name? Excellent

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

2006-05-06 Thread Alex Martelli
Tomasz Zielonka <[EMAIL PROTECTED]> wrote: ... > higher level languages. There are useful programming techniques, like > monadic programming, that are infeasible without anonymous functions. > Anonymous functions really add some power to the language. Can you give me one example that would be f

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

2006-05-07 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > > Being able to keep pass around state with functions is useful. > > I agree and Python supports this. What is interesting is how > counter-intuitive many programmers find this. For example, one of my Funny: I have taught/mentored large number of people in Pyth

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

2006-05-07 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > >> 2. There has to be a mechanism where an organization can add > >>developers - even if it is only for new projects. Python advocates > > > > Obviously. > > It's good that you agree. I think that the ability to add new > productive developers to a project/t

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

2006-05-07 Thread Alex Martelli
Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: ... > > an extension that allows the programmer to specify how the value of > > some slot (Lisp lingo for "member variable") can be computed. It > > frees the programmer from having to recompute slot values since Cells ... > I have not looked at

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

2006-05-07 Thread Alex Martelli
Tomasz Zielonka <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Tomasz Zielonka <[EMAIL PROTECTED]> wrote: > > > >> Alex Martelli wrote: > >> > Having to give functions a name places no "ceiling on expressiveness", > >> &

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

2006-05-07 Thread Alex Martelli
I V <[EMAIL PROTECTED]> wrote: ... > >> higher level languages. There are useful programming techniques, like > >> monadic programming, that are infeasible without anonymous functions. > >> Anonymous functions really add some power to the language. > > > > Can you give me one example that would

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

2006-05-07 Thread Alex Martelli
Frank Buss <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > I cannot conceive of one. Wherever within a statement I could write the > > expression > > lambda : body > > I can *ALWAYS* obtain the identical effect by picking an otherwise > >

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

2006-05-07 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Patrick May wrote: > > [EMAIL PROTECTED] (Alex Martelli) writes: > >> In my opinion (and that of several others), the best way for Python to > >> grow in this regard would be to _lose_ lambda altogether, since named > >> fun

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

2006-05-07 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > I do hate it that > > [ x for x in container if predicate(x) ] > > is an exact synonym of the more legible > > list( x for x in container if predicate(x) ) >

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

2006-05-07 Thread Alex Martelli
Frank Buss <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > Sorry, but I just don't see what lambda is buying you here. Taking just > > one simple example from the first page you quote, you have: > > > > (defun blank () > > "a b

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

2006-05-07 Thread Alex Martelli
Frank Buss <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > Not sure what the &key means here, but omitting that > > > > def black_white(function, limit): > > def result(x,y): > > if function(x, y) > limit: return 1.0 &

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

2006-05-07 Thread Alex Martelli
Chris Lambacher <[EMAIL PROTECTED]> wrote: > On Sun, May 07, 2006 at 11:57:55AM -0700, Alex Martelli wrote: > > > [1] I'm considering introducing bugs or misdesigns that have to be > > > fixed > > > as part of training for the purposes of this discuss

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

2006-05-07 Thread Alex Martelli
Tomasz Zielonka <[EMAIL PROTECTED]> wrote: ... > Also, having anonymous functions doesn't take your common sense away, so > you still "have a chance". I've seen many people (presumably coming from Lisp or Scheme) code Python such as: myname = lambda ... rather than the obvious Python way to d

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

2006-05-07 Thread Alex Martelli
Patrick May <[EMAIL PROTECTED]> wrote: ...an alleged reply to me, which in fact quotes (and responds to) only to statements by Brian, without mentioning Brian... Mr May, it seems that you're badly confused regarding Usenet's quoting conventions. You may want to repeat your answer addressing spec

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

2006-05-08 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: ... > If you language allows unnamed integers, unnamed strings, unnamed > characters, unnamed arrays or aggregates, unnamed floats, unnamed > expressions, unnamed statements, unnamed argument lists, etc. why > *require* a name for trivial functions? I th

Re: Python's DSLs

2006-05-08 Thread Alex Martelli
Cameron Laird <[EMAIL PROTECTED]> wrote: ... > On this one isolated matter, though, I'm confused, Alex: I sure > think *I* have been writing DSLs as specializations of Python, > and NOT as "a language in its own right". Have I been fooling > myself, or are you making the point that Lisp-based

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

2006-05-08 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: ... > Doesn't Google also employ such people as the inventor of Limbo > programming language, one of the inventors of Dylan, and a Smalltalk > expert? ...not to mention Lisp gurus (such as Peter Norvig), C++ gurus (such as Matt Austern) and Java ones (suc

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

2006-05-08 Thread Alex Martelli
Patrick May <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > ...an alleged reply to me, which in fact quotes (and responds to) > > only to statements by Brian, without mentioning Brian... > > > > Mr May, it seems that you're badly c

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

2006-05-08 Thread Alex Martelli
M Jared Finder <[EMAIL PROTECTED]> wrote: ... > Any time you want an anonymous function (or class, or type, or number) > it would be because that thing is sufficiently small and simple that the > best name for it is the code itself. In one game I worked on, there was That's not what I see happ

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

2006-05-09 Thread Alex Martelli
Stefan Nobis <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > > if anonymous functions are available, they're used in even more > > cases where naming would help > > Yes, you're right. But don't stop here. What about

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

2006-05-09 Thread Alex Martelli
Pisin Bootvong <[EMAIL PROTECTED]> wrote: ... > Is there such language that allow scalability without any need for > design on the underlying architecture? Perhaps Erlang...? I have no specific experience with it, but according to the rumor mill it forces or cajoles you into an architecture th

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

2006-05-09 Thread Alex Martelli
Rob Warnock <[EMAIL PROTECTED]> wrote: ... > If "only" being useful is enough, 100 cycles is enough for a DNS server, > or an NTP server, or even a stub HTTP server that delivers some small > piece of real-time data, like a few realtime environmental sensors > [temperature, voltages, etc.]. Rem

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

2006-05-09 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: ... > The problem is that a `name' is a mapping from a symbolic identifier to > an object and that this mapping must either be global (with the > attendant name collision issues) or within a context (with the > attendant question of `in which context'). W

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

2006-05-09 Thread Alex Martelli
Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > I think it's reasonable to make a name a part of functions, classes and > > modules because they may often be involved in tracebacks (in case of > > uncaught errors): to me

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

2006-05-09 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: > Pisin Bootvong wrote: > > Is this a Slippery Slope fallacious argument? > > (http://c2.com/cgi/wiki?SlipperySlope) > > > > "if python required you to name every function then soon it will > > require you to name every number, every string, every immediate

<    11   12   13   14   15   16   17   18   >