Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Rocco Moretti
Steve Holden wrote: The principle of least surprise is all very well, but "needless surprise of newbies" is a dangerous criterion to adopt for programming language design and following it consistently would lead to a mess like Visual Basic, which grew by accretion until Microsoft realized it was

Re: Python or PHP?

2005-04-24 Thread Rocco Moretti
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2005-04-23 15:53:17 +0200: Lad wrote: Is anyone capable of providing Python advantages over PHP if there are any? The irreverant would point you to http://www.python.org/doc/Humor.html#vowels *I* wouldn't consider doing anything like that, though. ch

Re: Variables

2005-04-24 Thread Rocco Moretti
Richard Blackwood wrote: Robert Kern wrote: His problem is that he doesn't respect that technical terms can have different meanings in different fields and contexts. No authoritative reference can solve his problem for him. He's being overly pedantic about a field in which *he* is clearly not an

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Rocco Moretti
[EMAIL PROTECTED] wrote: > Chris Mellon wrote: > >>Any time you want to write something in any way other than the obvious >>way, ask yourself why? Is it more obvious *to you*, which is a good >>reason as long as you're only writing code for yourself? Or is it just >>to be different, or because you

Re: Guido at Google

2005-12-21 Thread Rocco Moretti
Jack Diederich wrote: > On Wed, Dec 21, 2005 at 01:36:42PM -0500, rbt wrote: > >>Alex Martelli wrote: >> >>>I don't think there was any official announcement, but it's true -- he >>>sits about 15 meters away from me;-). >> >>For Americans: 15 meters is roughly 50 feet. > > > Right, so that is ab

Re: deal or no deal

2005-12-22 Thread Rocco Moretti
rbt wrote: > The TV show on NBC in the USA running this week during primetime (Deal > or No Deal). I figure there are roughly 10, maybe 15 contestants. They > pick a briefcase that has between 1 penny and 1 million bucks and then > play this silly game where NBC tries to buy the briefcase from

Re: One-step multiples list generation?

2006-01-03 Thread Rocco Moretti
Rocco Moretti wrote: > Damien Wyart wrote: > >> * Efrat Regev <[EMAIL PROTECTED]> in comp.lang.python: >> >>> Suppose I have some non-numerical Foo and would like to create a list >>> of 20 Foo-s. Is there a one-step method (not a loop) of doing so? >&

Re: One-step multiples list generation?

2006-01-03 Thread Rocco Moretti
Damien Wyart wrote: > * Efrat Regev <[EMAIL PROTECTED]> in comp.lang.python: > >>Suppose I have some non-numerical Foo and would like to create a list >>of 20 Foo-s. Is there a one-step method (not a loop) of doing so? > > > Maybe : > > [ Foo ] * 20 > > or, more verbose, > > [ Foo for _ in ra

Re: inline function call

2006-01-04 Thread Rocco Moretti
Riko Wichmann wrote: > hi everyone, > > I'm googeling since some time, but can't find an answer - maybe because > the answer is 'No!'. > > Can I call a function in python inline, so that the python byte compiler > does actually call the function, but sort of inserts it where the inline > call

Re: Converting milliseconds to human amount of time

2006-01-09 Thread Rocco Moretti
Max wrote: > Harlin Seritt wrote: > >> How can I take a time given in milliseconds (I am doing this for an >> uptime script) and convert it to human-friendly time i.e. "4 days, 2 >> hours, 25 minutes, 10 seonds."? Is there a function from the time >> module that can do this? >> >> Thanks, >> >> Ha

Re: New Python.org website ?

2006-01-11 Thread Rocco Moretti
Roy Smith wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: > >>http://beta.python.org > > All I can say is, "Wow!". If nothing else, it will forever eliminate the > idea that the web site doesn't look professional. It's almost *too* slick. I agree with the "too slick" impression. The "learn w

Re: Decimal ROUND_HALF_EVEN Default

2006-01-17 Thread Rocco Moretti
LordLaraby wrote: > If 'bankers rounding' is HALF_ROUND_EVEN, what is HALF_ROUND_UP? I > confess to never having heard the terms. There was a Slashdot article on rounding a short while back: http://developers.slashdot.org/article.pl?sid=06/01/05/1838214 -- http://mail.python.org/mailman/listinfo

Re: making objects unassignable "read-only" (especially when extending)

2006-01-18 Thread Rocco Moretti
Johannes Zellner wrote: > Hi, > > can I make an object read-only, so that > > x = new_value > > fails (and x keeps it's orginal value)? Simon gave you a way of doing it when x is an attribute access (e.g. p.x). I am unaware of a way of doing it when x is a straight global or local. Unlike

Re: OT: excellent book on information theory

2006-01-18 Thread Rocco Moretti
Alex Martelli wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: >... > >>due to the Evil Conspiracy of region-coding, I couldn't >>watch the British DVD even if I were to import it (Well, >>yeah I could, but it would be painful, and probably illegal, > > > I have a region-free DVD player her

Re: list(...) and list comprehensions (WAS: Arithmetic sequences in Python)

2006-01-20 Thread Rocco Moretti
Antoon Pardon wrote: > Well we could have list(a) return [a], and have a list_from_iterable. > Although I would prefer a different name. Or reverse it - list() always takes a single iterable, and list_from_scalars() is defined something like follows: >>> def list_from_scalars(*args): retu

Re: Using non-ascii symbols

2006-01-24 Thread Rocco Moretti
Giovanni Bajo wrote: > Robert Kern wrote: > > >>>I can't find "?, ?, or ?" on my keyboard. Posting code to newsgroups might get harder too. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using non-ascii symbols

2006-01-24 Thread Rocco Moretti
Robert Kern wrote: > Rocco Moretti wrote: > > [James Stroud wrote:] > >>>>>I can't find "?, ?, or ?" on my keyboard. >> >>Posting code to newsgroups might get harder too. :-) > > > His post made it through fine. Your newsreader

Re: Using non-ascii symbols

2006-01-26 Thread Rocco Moretti
Terry Hancock wrote: > One thing that I also think would be good is to open up the > operator set for Python. Right now you can overload the > existing operators, but you can't easily define new ones. > And even if you do, you are very limited in what you can > use, and understandability suffers.

Re: Question about isinstance()

2006-01-26 Thread Rocco Moretti
Dave Benjamin wrote: > On Thu, 26 Jan 2006, Mr.Rech wrote: > >> Suppose I'm writing a base class with an __eq__ special methods, using >> isinstance() I would have wrote: >> >> class foo(object): >>... >>def __eq__(self, other): >> return isinstance(other, type(self)) and self.an_at

Re: beta.python.org content

2006-01-26 Thread Rocco Moretti
Peter Maas wrote: > - The logo does indeed resemble a cross. How about rotating it at 45 deg > to make it look like an x? Or give it a circular shape? Please note > that there are no religious motives in this remark :) It looks like a plus sign to me. Do you also advocate renaming "C++" to "

Re: Question about isinstance()

2006-01-26 Thread Rocco Moretti
Mr.Rech wrote: > All in all it seems that the implementation that uses isinstance() is > better in this case... Well what's "better" depends on what you want to happen when you compare an unrelated class that also defines 'an_attribute'. Unlike in statically typed languages, certain things are m

Re: beta.python.org content

2006-01-27 Thread Rocco Moretti
Paul Boddie wrote: > With the nice font they've used, I don't understand why they didn't > turn the "p" into a snake itself. I'm sure I've seen that done > somewhere before. You're probably thinking of PyPy: http://codespeak.net/pypy/dist/pypy/doc/news.html -- http://mail.python.org/mailman/lis

Re: Using non-ascii symbols

2006-01-27 Thread Rocco Moretti
Ivan Voras wrote: > It's not a far-out idea. I stumbled about a year ago on a programming > language that INSISTED on unicode characters like ≤ as well as the rest > of mathematical/logical symbols; I don't remember its name but the > source code with characters like that looked absolutely beau

Re: locals() and dictionaries

2006-02-01 Thread Rocco Moretti
JerryB wrote: > Hi, > I have a dictionary, a string, and I'm creating another string, like > this: > > dict = {} > dict[beatles] = "need" > str = "love" > > mystr = """All you %(dict[beatles])s is %(str)s""" % locals() > > Why do I get > keyerror: 'dict[one]'? > > Is there a way to reference th

Re: Compiling

2006-02-03 Thread Rocco Moretti
Simon Faulkner wrote: > Pardon me if this has been done to death but I can't find a simple > explanation. > > I love Python for it's ease and speed of development especially for the > "Programming Challenged" like me but why hasn't someone written a > compiler for Python? > > I guess it's not

Re: how do you pronounce 'tuple'?

2006-02-14 Thread Rocco Moretti
Erik Max Francis wrote: > If a 4-tuple is a quadruple, a 3-tuple is a triple, a > 2-tuple is an pair, then I guess a 1-tuple would be a single. Granted > that's not nearly as gruesome enough a name to go with the special > lopsided Pythonic creature mentioned above. I suggest we name it a > h

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-14 Thread Rocco Moretti
Gregory Piñero wrote: > On 14 Feb 2006 06:44:02 -0800, [EMAIL PROTECTED] > > >>5./2.=2.5 is floating point math, with all the round off errors that >>incorporates. > > Thanks Curtis, I never knew that trick. I guess for variables do have > true division you have to make them floats? e.g. > flo

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-17 Thread Rocco Moretti
Steven D'Aprano wrote: > Anybody using Python *should* be aware of the division issue. As soon as > they see a division, it is their responsibility to *find out what it > means*. That doesn't require much work: they can scroll up to the > beginning of the module and look at the first few lines. Th

Re: Mutable numbers

2006-02-21 Thread Rocco Moretti
Steve Holden wrote: > fraca7 wrote: > >> The memory allocation for integers is optimized. 'Small' integers >> (between -5 and 100 IIRC) are allocated once and reused. The memory >> for larger integers is allocated once and reused whenever possible, so >> the malloc() overhead is negligible. >

Re: That's really high-level: bits of beautiful python

2006-02-21 Thread Rocco Moretti
Max wrote: > But today we were discussing the problem of running externally-provided > code (e.g. add-on modules). Neither of us knew how to do it in C, though > I suggested using DLLs. However, I quickly installed python on his > laptop and coded this: > > exec "import %s as ext_mod" % raw_in

Re: can't use NetcdfFile

2006-02-22 Thread Rocco Moretti
[EMAIL PROTECTED] wrote: > Hi, > I'm trying to open a Netcdf file using NetcdfFile but I always get an > import error DLL failed > even though I've tried using all these: > > import Numeric > from Scientific.IO.NetCDF import NetCDFFile > from Scientific.IO import NetCDF > from Scientific import *

Re: Python vs. Lisp -- please explain

2006-02-22 Thread Rocco Moretti
Alexander Schmolck wrote: > I wanted to point > out that one could with just as much justification claim CL to be more dynamic > than python (it is in some regards, but not in others -- how to weight them to > achieve some overall "score" is not obvious. I think it's worth pointing out that not a

Re: pyvm -- faster python

2005-05-12 Thread Rocco Moretti
Paul Rubin wrote: > Despite the shrieks of the "Python is not Lisp!" crowd, Python > semantics and Lisp semantics aren't THAT different, and yet compiled > Lisp implementations com completely beat the pants off of interpreted > Python in terms of performance. I know little about Lisp compilatio

Re: Python Documentation (should be better?)

2005-05-12 Thread Rocco Moretti
Terry Hancock wrote: > *But you do have to remember that strings are documented under "sequences" > this is probably my biggest complaint about the Library Reference --- > something > as important as string methods should have its own heading in the top-level > outline. But that's a nitpick, of

Re: Python Documentation (should be better?)

2005-05-13 Thread Rocco Moretti
bruno modulix wrote: > > I fail to see why would it would be better to have to open a browser, go > to python.org, go to the doc, find the right link etc instead of just > typing dir(xxx) and/or help(xxx). Well, for those with Windows machines, the documentation is a simple Start->All Programs

Re: Python forum

2005-05-17 Thread Rocco Moretti
Dave Brueck wrote: > Grant Edwards wrote: > >> >> Except for the torture of using a web forum's UI. >> >> [In case you can't tell, I hate web forums. I've never seen a >> single one with a suable UI.] > > > Amen! Generally they are an abomination. > > To make matters worse, many forums that be

Re: first release of PyPy

2005-05-23 Thread Rocco Moretti
Alex Stapleton wrote: > The question still remains, can it run it's self? ;) > I think they try, every once in a while, to self host. The only problem at this stage of the game is the ~2000x speed slowdown. Using that figure, a five second startup time for PyPy on CPython would take about 3 ho

Re: Dr. Dobb's Python-URL! - weekly Python news and links (May 24)

2005-05-24 Thread Rocco Moretti
Simon Brunning wrote: > QOTW: "If you're sick of answering newbie questions, and don't think you > can do so politely, for the sake of the community, DON'T! You're not that > necessary." - Joal Heagney Taken out of context, Joal's comments might seem a bit rude and abrasive - I don't think they

Re: Incrementing letters

2005-05-27 Thread Rocco Moretti
Dan Sommers wrote: > On Fri, 27 May 2005 16:10:32 +0200, > Wolfram Kraus <[EMAIL PROTECTED]> wrote: > > >>Duncan Booth wrote: > > >>import string >>upone = string.maketrans( >>> >>>'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', >>>'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTU

Re: Software licenses and releasing Python programs for review

2005-05-30 Thread Rocco Moretti
poisondart wrote: > With the exception of the example with neighbour Bobby (which directly > utilizes my code for profit, in which case is a definite no), I don't > see why your other examples should make me reconsider releasing my > software for free. I don't think he's trying to make you recons

Re: prime number

2005-05-30 Thread Rocco Moretti
lostinpython wrote: > But needless to say, I'm stumped on this > problem. I keep ending up in a never ending loop. I've been told that the trick with recursion/iteration is to always determine what your ending condition is first, and then construct the body of the recursion/loop to reach that e

Re: first release of PyPy

2005-05-30 Thread Rocco Moretti
Kay Schluehr wrote: > Anton Vredegoor wrote: > > >>I'm not involved in PyPy myself but this would seem a logical >>possibility. To go a step further, if the compiler somehow would know >>about the shortest machine code sequence which would produce the >>desired effect then there would be no reaso

Re: working with pointers

2005-05-31 Thread Rocco Moretti
> "Dave Brueck" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Michael wrote: >> >>>sorry, I'm used to working in c++ :-p >>> >>>if i do >>>a=2 >>>b=a >>>b=0 >>>then a is still 2!? >>> >>>so when do = mean a reference to the same object >> >>Always. >> >> >>>and when does it mea

Re: anygui,anydb, any opinions?

2005-06-01 Thread Rocco Moretti
Skip Montanaro wrote: > Thomas> The Python world lacks the phenomenally successful development > Thomas> models enjoyed by the now ancient Turbo Pascal, Delphi and > Thomas> Visual Basic. > Thomas> AND > Thomas> If the likes of Visual Basic can have it, then it becomes >

Re: PySol not working on WinXP, SP2

2005-06-01 Thread Rocco Moretti
Ivan Van Laningham wrote: > Hi All-- > I've been using PySol-4.40 for years, because that was the last Windows > installer version I could find. My wife's been using it for almost the > same length of time. That version's worked just fine on W98, W98SE, W2K > (server included), and WinXP SP1. >

Re: Lost in the inheritance tree...

2005-06-06 Thread Rocco Moretti
Adam Munoz Lopez wrote: > Can anyone help with this code... I have infinite > recursion but since I'm pretty new to Python (and > programming in general) I can't find where I did the > mistake. It really does help to start removing things trying to get the minimal code which causes the problem.

Re: Annoying behaviour of the != operator

2005-06-08 Thread Rocco Moretti
Jordan Rastrick wrote: > Unless someone can explain some sort of problem that arises from having > != take advantage of a __eq__ method where present, I'd suggest that it > should do so in Python 2.5. If you're serious about this proposal, please formalize it in a PEP. Things to specify: How ex

Re: Annoying behaviour of the != operator

2005-06-08 Thread Rocco Moretti
Matt Warden wrote: > Jordan, > > On 8 Jun 2005 11:44:43 -0700, Jordan Rastrick > <[EMAIL PROTECTED]> wrote: > >>But I explicitly provided a method to test equality. And look at the >>plain english meaning of the term "Not equals" I think its pretty >>reasonable > > > Indeed. Furthermore, it see

Re: Annoying behaviour of the != operator

2005-06-10 Thread Rocco Moretti
Dan Sommers wrote: > On Thu, 09 Jun 2005 15:50:42 +1200, > Greg Ewing <[EMAIL PROTECTED]> wrote: > > >>Rocco Moretti wrote: >> >>>The main problem is that Python is trying to stick at least three >>>different concepts onto the same set of operators

Re: Annoying behaviour of the != operator

2005-06-10 Thread Rocco Moretti
George Sakkis wrote: > "Rocco Moretti" wrote: > > >>One way to handle that is to refuse to sort anything that doesn't have a >>"natural" order. But as I understand it, Guido decided that being able >>to sort arbitrary lists is a feature, n

Re: Annoying behaviour of the != operator

2005-06-13 Thread Rocco Moretti
Before I answer, let me clarify my position. I am NOT advocating any change for the 2.x series. I'm not even forwarding any particular proposal for 3.0/3000. My key (and close to sole) point is that behavior of > & < is conceptually distinct from ordering in a sorted list, even though the beha

<    1   2