Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-13 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Op 2005-01-13, Fredrik Lundh schreef <[EMAIL PROTECTED]>: >> Antoon Pardon wrote: >> >>> Well, it seems that Guido is wrong then. The documentation clearly >>> states that an expression is a statement. >> >> no, it says

Re: sorted (WAS: lambda)

2005-01-13 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > Steven Bethard <[EMAIL PROTECTED]> writes: >> Note that sorted is a builtin function, not a method of a list >> object. > > Oh, same difference. I thought it was a method because I'm not using > 2.4 yet. The

Re: how to stop google from messing Python code

2005-01-14 Thread Terry Reedy
"Fuzzyman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Xah Lee wrote: >> gmane is great! > I guess that most people use google to post to newsgroups is that they > don't have nntp access. Anyone with a normal internet connection has nntp access. What some do not get from t

Re: Pointer or unique id

2005-01-15 Thread Terry Reedy
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >id(object) -> integer >Return the identity of an object. This is guaranteed to be unique among >simultaneously existing objects. This is part of the language specification. Also, the identity of an object must

Re: interpret 4 byte as 32-bit float (IEEE-754)

2005-01-15 Thread Terry Reedy
"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > franzkowiak wrote: >> I've read some bytes from a file and just now I can't interpret 4 bytes >> in this dates like a real value. An extract from my program: >> def l32(c): >> return ord(c[0]) + (ord(c[1])<<

Re: wxPython and PyGame - do they play well together?

2005-01-18 Thread Terry Reedy
"Erik Bethke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am having a great time with python and pygame, and last night I took > a long look at the wxPython demo. I think that rocks as well. > > So now, my question is do wxPython and PyGame work together? I have no personal

Re: RuntimeError: dictionary changed size during iteration

2005-01-20 Thread Terry Reedy
RE: RuntimeError: dictionary changed size during iteration "Batista, Facundo" <[EMAIL PROTECTED]> wrote [Robert Brewer] #- But not unexpected, since vars() returns a dictionary, and #- binding 'e' #- changes that dictionary while you are iterating over it. >For me, the point is: vars() returns th

Re: need help on need help on generator...

2005-01-22 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >If I understand correctly, Almost... > a "generator" produce something over which you can > iterate with the help of an "iterator". To be exact, the producer is a generator function, a function whose body contains

Re: Tuple slices

2005-01-24 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Why does slicing a tuple returns a new tuple instead of a > view of the existing one, given that > tuples are immutable ? I ended up writing a custom > ImmutableSequence class that does this, but I > wonder why it is no

Re: Help with saving and restoring program state

2005-01-24 Thread Terry Reedy
"Jacob H" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm developing an adventure game in Python Since you are not the first, have you looked at what others have done to save/restore? The Pygame site has code you can look at for adventure (I believe) and other game types (I

Re: Another scripting language implemented into Python itself?

2005-01-24 Thread Terry Reedy
"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > Quest Master <[EMAIL PROTECTED]> wrote: > >> So, my question is simply this: is there an implementation of another >> scripting language into Python? > > Python *is* a scripting language.

Re: Tuple slices

2005-01-24 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Actually my initial motivation was not a huge tuple I had to slice many > times. It was something much > less extraordinarily unlikely, a recursive function with a sequence > parameter: > > def foo(sequence): ># b

Re: is extending an object considered acceptable usage?

2005-01-24 Thread Terry Reedy
"mike" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > sometimes i want a list of categories, and from each i want to be able to > access a list of its items. in this case is it considered acceptable to > just create a list of those items and assign it as a property of their > c

Re: Another scripting language implemented into Python itself?

2005-01-25 Thread Terry Reedy
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The original poster wants to work in Python. That's > fine. Several of us have suggested he further > expose Python itself to his end-users as an extension > language. That certainly is feasible. He needn't > explai

Re: Tuple slices

2005-01-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Terry Reedy wrote: >> In other words, if you don't really want slices copied out of the >> sequence, >> then don't slice! Just use 2 ints to indicate the working region or >> view.

Re: python without OO

2005-01-25 Thread Terry Reedy
Davor, Before I learned Python, I too was put off by OO hype. And I suppose I still would be if I still listened to it. But Python's class statement is somewhere inbetween a C typedef and C++/Jave classes. Stripped down pretty much to the essentials and only used when really useful, it made m

Re: python without OO

2005-01-26 Thread Terry Reedy
"Peter Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Davor schrieb: >> so initially I was hoping this is all what Python is about, but when I >> started looking into it it has a huge amount of additional (mainly OO) >> stuff which makes it in my view quite bloated now. > >

Re: how to write a tutorial

2005-01-26 Thread Terry Reedy
Xah the arrogant wrote, among other things, # one can change data inside the class x.i = 400 # one can also add new data to the class x.j=4 print x.j # or even override a method x.square = 333 # (the following line will no longer work) # print "3 squared is:", x.square(3) # in Python, one must

Re: "pickle" vs. f.write()

2005-01-26 Thread Terry Reedy
For basic builtin objects, repr(ob) generally produces a string that when eval()ed will recreate the object. IE eval(repr(ob) == ob # sometimes For writing and reading class instances, pickle is the way to go. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassed dict as globals

2005-01-26 Thread Terry Reedy
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Evan Simpson wrote: > >> In Python 2.4 the following works: >> >> >>> class G(dict): >> ... def __getitem__(self, k): >> ... return 'K' + k >> ... >> >>> g = G() >> >>> exec 'print x, y, z' in g >> Kx Ky Kz >> >>>

Responding to trollish postings.

2005-01-26 Thread Terry Reedy
[New subject line] In response to my response to a trollish posting... > There isn't any doubt that these 'tutorials' are generally unwelcome and > unhelpful. Numerous people have kindly taken the time to flag some of the > problems. So much so that any competent google of the archives would >

Re: Which is faster?

2005-01-26 Thread Terry Reedy
"Aggelos I. Orfanakos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Any idea which of the following is faster? > > 'a/b/c/'[:-1] > 'a/b/c/'.rstrip('/') I find the first easier to read and mentally process. Others may have a different answer. But perhaps you meant with the CPy

Talking to the wind

2005-01-27 Thread Terry Reedy
"The Flow" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Xah Lee, > > Do you want to be taken seriously? > First, stop posting. > Second, learn perl. > Third, learn python. Hey all, I have seen no evidence that XL even reads the responses that have been directed thereto. The ab

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Terry Reedy
"Kamilche" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I see what you're attempting to do. However, your code, if it DID run, > would result in a method being added to the object, not the object's > class! Modify the class itself, not the object, as follows: > > |class Test: > |

Re: py.dll for version 2.2.1 (Windows)

2005-01-28 Thread Terry Reedy
"mike" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just recently, my virus checker detected what it called a Trojan Horse > in the py.dll file in the python22 folder. Installation is version > 2.2.1 and I think that it came installed when I bought the PC in > October 2002. My

Re: Who should security issues be reported to?

2005-01-28 Thread Terry Reedy
OP: >>I find this response a bit dissappointing frankly. Open Source people >>make such a big deal about having lots of people being able to look at >>source code and from that discover security problems, thus making it >>somehow making it better than proprietary source code. OP: Did you discover

{Spam?} Re: bound vs unbound functions

2005-01-29 Thread Terry Reedy
"Michael Tobis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd like to dynamically add a method to an instance at > instantiation time. No can do. A method is function that is an attribute of a class, even if accessed via an instance. A function added to an instance as an

{Spam?} Re: naive doc question

2005-01-29 Thread Terry Reedy
"Gabriel B." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I wanted a list of all the methods of dict for example... where can i > find it? Lib Ref 2.3.8 Mapping Types. Do browse chapter 2 so you know what is there. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/

Test of comp.lang.python to python-list to gmane pathway.

2005-01-30 Thread Terry Reedy
Feel free to ignore this. Some system falsely labeled this post (sent via gmane) as possible spam. I am sending it back in the opposite direction to see what transpires that way. Sorry for the disturbance. tjr "Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:

Re: Next step after pychecker

2005-02-01 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I don't know much about what pychecker does, but if it works with the > bytecode, shouldn't it be fine for jython and IronPython? I thought the > bytecode was part of the language spec, and what was CPython specific

Re: Suggesion for an undergrad final year project in Python

2005-02-01 Thread Terry Reedy
"Sridhar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am doing my undergrade CS course. I am in the final year, and would > like to do my project involving Python. Our instructors require the > project to have novel ideas. Can the c.l.p people shed light on this > t

Re: Next step after pychecker

2005-02-02 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So I assume the language spec is basically the grammar and the > Language Reference docs[1]? Yes. The de facto governing syntax specification is the grammar file in the source code from which the parser is generate

Re: pythonic equivalent of Mathematica's FixedPoint function

2005-02-02 Thread Terry Reedy
"jelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >You could probably write your own FixedPoint function without too much >>difficulty, with the only tricky part being for it to know when to > stop! > > It would be quite interesting to have this kind of function. But > likely

Re: Is this a contradiction in the docs ?

2005-02-02 Thread Terry Reedy
"Fuzzyman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Equally possible (or more likely !) is that I misunderstand it : Or that you did not sufficiently test the indicated difference ;-) > The docs for compile say that if you are creating a code object from a > sequence of sta

Re: Where are list methods documented?

2005-02-03 Thread Terry Reedy
"Nelson Minar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You're not the only one with a hard time finding the list > documentation. It's even crazier for string docs. To repeat the advice I gave someone asking about dict methods: Read or at least skim thru chapter 2 of the L

Re: string issue

2005-02-04 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You are modifying the list as you iterate over it. Instead, iterate over > > a copy by using: > for ip in ips[:]: Or if you are only deleting items, you can iterate backwards. You can also build a new list with only

Re: Weekly Python Patch/Bug Summary

2005-02-04 Thread Terry Reedy
"David Fraser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kurt B. Kaiser wrote: >> Patch / Bug Summary >> ___ >> >> Patches : 284 open ( +4) / 2748 closed ( +1) / 3032 total ( +5) >> Bugs: 804 open ( +1) / 4812 closed (+13) / 5616 total (+14) >> RFE

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-05 Thread Terry Reedy
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] If you ask too much that other people do your searching for you, answers will dry up. But here are a couple that you might not find on google anyway, at least not easily. > I want to add metadata to everything with

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Terry Reedy
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message >> Then 'print html_doc_instance' can print the html doc corresponding to >> the object model. > > I understand this procedure. > > I would like to use a standard way, which uses the standard metadata > [implicit/explicit defined]. > > Does

Re: Multiple constructors

2005-02-06 Thread Terry Reedy
"Philip Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Call this a C++ programmers hang-up if you like. > > I don't seem to be able to define multiple versions of __init__ in my > matrix Correct. > class (ie to initialise either from a list of values or from 2 dimensions

Re: Unbound names in __del__

2005-06-18 Thread Terry Reedy
"Torsten Bronger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Torsten Bronger wrote: >> >>> keithley = GpibInstrument(14) >>> keithley.write("*IDN?") >>> print keithley.read() >>> A keithley.close() would be a wart in my opinion; instead I want >>> to hide the whol

Re: struct.(un)pack and ASCIIZ strrings

2005-06-18 Thread Terry Reedy
"Sergey Dorofeev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I can use string.unpack if string in struct uses fixed amount of bytes. I presume you mean struct.unpack(format, string). The string len must be known when you call, but need not be fixed across multiple calls with

Re: What platforms have Python Virtual Machines and what version(s) ofPython do they support?

2005-06-19 Thread Terry Reedy
"Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What platforms have Python Virtual Machines and what version(s) of > Python do they support? > In particular: > Palm OS > PocketPC Try using Google (Python PocketPC, for instance) or the equivalent TJR -- http:/

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm working on it. I should have said it's trivial if you have > access to the platforms to be supported. I've tested a fix > that supports pickle streams generated under Win32 and glibc. > That's using the "native" s

Re: Python internals and parser

2005-06-22 Thread Terry Reedy
"Michael Barkholt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any detailed documentation on the structure of Pythons > internals, > besides the source code itself? In detail, in one place, no. There are bits and pieces in the C API docs and the Lib man chapters on

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The bit patterns are defined by the IEEE 754 standard. If > there are Python-hosting platoforms that don't use IEEE 754 as > the floating point representation, then that can be dealt with. > > Python has _tons_ of plat

Re: don't understand MRO

2005-06-23 Thread Terry Reedy
"Uwe Mayer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a subclassed PyQt class: > > class Node(object): >def move(self, x,y): pass > > class CRhomb(QCanvasPolygon, Node): pass > > $ python > v2.4.1 CRhomb.mro() > [, , 'qtcanvas.QCanvasPolygonalItem'>, , 'q

Re: Help me to log-in

2005-06-23 Thread Terry Reedy
"Apple Grew" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well can anyone tell me how do I login into newsgroup using Mozilla > 1.7.7. What should be the username? (I tried with with my e-mail address > I subscribed with but failed to log-in). The password asked during > log-in i

Re: Favorite non-python language trick?

2005-06-24 Thread Terry Reedy
"D H" <[EMAIL PROTECTED]> wrote in message > Roy Smith wrote: >> Tom Anderson <[EMAIL PROTECTED]> wrote: >>>The one thing i really do miss is method overloading by parameter >>>type. I used this all the time in java >> You do things like that in type-bondage languages like Java and C++ >> bec

Re: Favorite non-python language trick?

2005-06-24 Thread Terry Reedy
"Tom Anderson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > sometimes in python. No, it's not really possible in a typeless language, > and yes, there are implementations based on decorators, but frankly, > they're awful. Python has strongly typed objects. Only names are typel

Re: Two questions on lambda:

2005-06-24 Thread Terry Reedy
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I cannot find the way to do generic lambda functions using the lambda > syntax in python. I am probably missing a point. Thinking of lambda args: expression as more or less abbreviati

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
"Elmo Mäntynen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] n=(100,) tuple(*n) As posted, this gives a syntax error. What is missing? tjr -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread Terry Reedy
"Mandus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fri, 24 Jun 2005 16:31:08 +0100 skrev Tom Anderson: >> On Fri, 24 Jun 2005, Joseph Garvin wrote: >> Higher-order functions like map, filter and reduce. As of Python 3000, >> they're non-python tricks. Sigh - i guess it's time

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Elmo Mäntynen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >>>>> n=(100,) tuple(*n) > > As posted, this gives a syntax error

Re: Acceptance test spike example

2005-06-26 Thread Terry Reedy
"Steve Jorgensen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Note how the powerful, context-aware exec() and eval() procedures really > help > simplify the code. A stylistic note: I believe that most or all of your eval/exec uses could be done with getattr and setattr inste

Re: map vs. list-comprehension

2005-06-29 Thread Terry Reedy
"F. Petitjean" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] > Hoping that zip will not be deprecated. Cease worrying. Zip was added to replace the zipping behavior of map and the idiom map(None, a, b, ...). It simultaneously alter

Re: Favorite non-python language trick?

2005-06-29 Thread Terry Reedy
"Paddy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The OZ homepage has an example for solving the eight queens problem: Buried in the generator test module (something like lib/test/test_generators.py) are solutions for both 8Queens and Knight's Tour. You might find these of

Re: Favorite non-python language trick?

2005-06-30 Thread Terry Reedy
"Paddy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sadly, its not a solution that I'm after, but a particular toolkit that > can be used for solving that type of problem. Presuming this is an anwer to my comment about generators... I was pointing you more to the method used t

Re: Accepted Summer of Code proposals

2005-07-01 Thread Terry Reedy
"A.M. Kuchling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > For anyone who's interested: the Python wiki now contains a list of the > PSF-mentored proposals that were accepted for Google's Summer of Code: > http://wiki.python.org/moin/SummerOfCode Thanks for posting this and th

Re: Favorite non-python language trick?

2005-07-01 Thread Terry Reedy
"Devan L" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > With the exception of reduce(lambda x,y:x*y, sequence), reduce can be > replaced with sum, and Guido wants to add a product function. The update function is not at all limited to sums and products, but can be any callable w

Re: Modules for inclusion in standard library?

2005-07-02 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Isn't this where the discussion should start? There should be some >general policy guiding the types of modules which should be in the >standard library. A couple of times, Guido has given his general policy as gen

Re: A brief question.

2005-07-02 Thread Terry Reedy
"Nathan Pinno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Brief question for anyone who knows the answer, because I don't. > Is there anyway to make Python calculate square roots? Python can calculate any calculable function of the objects it has to work with. So the answer

Re: A Policy for Inclusion in the Standard Library: was Modules forinclusion in standard library?

2005-07-03 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> >> A couple of times, Guido has given his general policy as generally >> useful; >> best-of-breed, tested and accepted by the community; and backed

Re: Accepted Summer of Code proposals

2005-07-03 Thread Terry Reedy
"Peter Decker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Is it right that two Wax proposals were accepted? > > Or that Wax is being promoted over Dabo, which wraps wxPython just as > elegantly in its UI tier, and which is further along (more controls > supported) than Wax, i

Re: Accepted Summer of Code proposals

2005-07-04 Thread Terry Reedy
"A.M. Kuchling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 1 Jul 2005 14:22:51 -0400, > Terry Reedy <[EMAIL PROTECTED]> wrote: >> Thanks for posting this and thanks for coordinating the PSF effort. > > I did little beyond writin

Re: Considering moving from Delphi to Python [Some questions]

2005-07-04 Thread Terry Reedy
"Dark Cowherd" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We program in Delphi in our shop and are generally very happy with it. > We are now looking at cross-platform options especially for middle > tier and web server. > > I have been doing a lot of reading and testing of Pyt

Re: Existance of of variable

2005-07-04 Thread Terry Reedy
"Josiah Manson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. I am very new to Python, and have been unable to figure out how > to check if a variable exists or not. In the following code Python does not have variables is the sense some other languages do. It has (typele

Re: Existance of of variable

2005-07-04 Thread Terry Reedy
"tiissa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Variables are stored in two dictionnaries: globals() (for global > variables) and locals() (for the local ones, which are also global on > top level). Within a function, the local namespace is usually *not* a dictionary. D=lo

Re: "long int..." exception reported with strange traceback location

2005-07-04 Thread Terry Reedy
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I came up with a simpler testcase. Strangely, the exception occurs in > the statement *following* the os.utime() call: > > >>> import os, sys > >>> os.utime("foo_test_file", (0, float(sys.maxint+1))) > >>> print "hi"

Re: flatten(), [was Re: map/filter/reduce/lambda opinions andbackground unscientific mini-survey]

2005-07-05 Thread Terry Reedy
"Tom Anderson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I guess setslice is a lot faster than i thought. Nope, the example is too short to be meaningful. > How are python lists > implemented? Presumably not as straightforward arrays, where inserting a > bunch of items at th

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-05 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > OTOH, I fully agree with Peter Hansen: "Really, the name is such a > trivial, unimportant part of this whole thing that it's hardly worth > discussing." >From a certain viewpoint, I would agree. Yet, the word 'lambda

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-05 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Still it's hard to explain why four specific python keywords - def, > del, exec and elif - were chosen to be abbreviated, Precedence in other languages and CS usage? > So, who would object the full-word versions for p

Re: map/filter/reduce/lambda opinions and backgroundunscientificmini-survey

2005-07-06 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >> "George Sakkis" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > Still it&#x

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Terry Reedy
"jayessay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1. Someone recently remarked that good Lisp macros are basically > executable pseudo code. I think that is pretty much exactly right > and is a pretty good "sound bite" distillation of what it is all > about. Several

Re: Lisp development with macros faster than Python development?..

2005-07-07 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'll clarify. A lot of the time I hear arguments against > features that boils down to. > > 1) I don't need it. > > 2) Having the feature will make my job more difficult. > > 3) I don't understand the merrits of the fea

Re: Why anonymity? [was Re: map/filter/reduce/lambda opinions andbackground unscientific mini-survey]

2005-07-07 Thread Terry Reedy
The difference in readability between func = lambda x: x**3 - 5*x def func(x): return x**3 - 5*x def func(x): return x**3 - 5*x is obviously a matter of personal vision. The fuctional difference (and, I believe, the only difference) is that the def form attaches the specific name 'func' t

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-07 Thread Terry Reedy
"Pawe³ Sakowski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Tom Anderson wrote: > def flatten(ll): > return reduce(lambda a, l: a.extend(l), ll, []) > > How would one do that as a list comp, by the way? I'm really not very > good > with them yet. Not really a list-comprehensio

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-07 Thread Terry Reedy
"Stian Søiland" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 2005-07-06 02:46:27, George Sakkis wrote: >> So, who would object the full-word versions for python 3K ? >> def -> define >> del -> delete >> exec -> execute >> elif -> else if >Objections for the "else if" might be

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-08 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Steven Bethard" <[EMAIL PROTECTED]> wrote: >> Dict comprehensions were recently rejected: >> http://www.python.org/peps/pep-0274.html >> The reason, of course, is that dict comprehensions don't gain you much >> a

Re: PPC floating equality vs. byte compilation

2005-07-09 Thread Terry Reedy
"Tim Peters" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [Donn Cave] >> I ran into a phenomenon that seemed odd to me, while testing a >> build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. >> >> test_builtin.py, for example, fails a couple of tests with errors >> claiming that

Re: Should I use "if" or "try" (as a matter of speed)?

2005-07-09 Thread Terry Reedy
"Steve Juranich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Without fail, when I start talking with some of the "old-timers" > (people who have written code in ADA or Fortran), I hear the same > arguments that using "if" is "better" than using "try". I think that > the argumen

Re: Should I use "if" or "try" (as a matter of speed)?

2005-07-09 Thread Terry Reedy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My shot would be to test it like this on your platform like this: > > #!/usr/bin/env python > import datetime, time > t1 = datetime.datetime.now() > for i in [str(x) for x in range(100)]: > if int(i) == i: > i + 1 >

Re: decorators as generalized pre-binding hooks

2005-07-10 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The binding of a class name is similar, and class decorators > would seem natural, i.e., > >@cdeco >class Foo: pass > for >class Foo: pass >Foo = cdeco(Foo) This possibility was discussed on the py-dev

Re: Use cases for del

2005-07-10 Thread Terry Reedy
"Ron Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > To avoid that you either need to define the flag string as a global name > or use it strictly in the local scope it's defined in. Python will also > sometimes reuse strings as an optimization instead of creating a second >

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Terry Reedy
"Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a suggestion I don't remember seeing for flagging which vars to autoinit without new syntax: use '_' instead of '.'. I have never seen local vars with a leading '_'. So, in combination with whatever

Cat and Mouse (wes Re: Efficiency of using long integers to hold bitmaps)

2005-07-10 Thread Terry Reedy
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Right. OTOH, I notice a frequent game of Katze und Maus (cat and mouse?) Yes, apparently with the same idiomatic meaning, as you decribe the game here perfectly. TJR -- http://mail.python.org/mailman/listinfo

Re: decorators as generalized pre-binding hooks

2005-07-10 Thread Terry Reedy
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Terry Reedy" <[EMAIL PROTECTED]> wrote: >> This possibility was discussed on the py-dev list about a year or so >> ago. >> The twice monthly summaries should incl

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Terry Reedy
"Dan Sommers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 10 Jul 2005 16:26:24 -0400, > "Terry Reedy" <[EMAIL PROTECTED]> wrote: >> I have a suggestion I don't remember seeing for flagging which vars to >> autoi

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Me too. I liked the leading _, but on second thought it is a weird > language change > re names in a special context. Probably not so good. To repeat: while my '_' proposal could have been for a language change (in 3

Re: Trying to come to grips with static methods

2005-07-12 Thread Terry Reedy
| I've been doing a lot of reading about static methods in Python, and possibly getting over-confused by the minutia of the CPython implementation, as well as by the misnomer. Conceptually, a 'static method' is a function attribute of a class that is to be used as a function and not as a method

Re: Inconsistency in hex()

2005-07-12 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hex() of an int appears to return lowercase hex digits, and hex() of a > long uppercase. Already bug-reported and fixed for 2.5 (to use lowercase, I believe). http://sourceforge.net/tracker/?group_id=5470&atid=105470

Re: Python Programming Contest

2005-07-16 Thread Terry Reedy
"Tom Anderson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 16 Jul 2005, Joseph Garvin wrote: > >> Someone correct me if I'm wrong -- but isn't this the Shortest Path >> problem? > > Dang! I was just about to point that out. One twist is that it is not the shortest path

Re: list implementation

2005-07-17 Thread Terry Reedy
"sj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I believe the type "list" is implemented as an array of pointers. A Python list is sematically/behaviorally defined as a mutable extensible sequence of references to Python objects. For the CPython reference implementation, the

Re: Who uses input()? [was Re: question on "input"]

2005-07-18 Thread Terry Reedy
"Nathan Pinno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I use input() all the time. I know many people say it ain't safe, but > whose going to use it to crash their own comp? Only an insane person > would, This is usage Guido intended it for, not for production apps distri

Re: Earthquake Forecasting Program July 11, 2005

2005-07-18 Thread Terry Reedy
"Bob Officer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip over 100 lines that should have been snipped before] >>In particular I am interested in the EM dataset. > > There isn't any "data set" > > There are no "formula"... > > There is only EGD > > Crackpot. > > http://www

Re: Dictionary, keys and alias

2005-07-19 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 19 Jul 2005 10:20:04 +0200, Glauco wrote: > >>> The only niggly worry I have is I'm not sure when hash can be used, >>> when >>> it is unique, or even if is it guaranteed to be unique. >>> >> >> Thank Steve,

Re: socket programming

2005-07-19 Thread Terry Reedy
"Helge Aksdal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >* Jaime Wyant <[EMAIL PROTECTED]> [2005/07/19 21:26]: > >> It sounds really strange to connect to a server "several hundred" >> times. If I had to guess, the server monitored all of the connects >> coming from your IP ad

Re: socket programming

2005-07-19 Thread Terry Reedy
"Helge Aksdal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >* Terry Reedy <[EMAIL PROTECTED]> [2005/07/19 22:57]: > >> Ask your server administrator if you are bumping up against a hidden >> connection limit. Or if a query can ask abou

Re: is this pythonic?

2005-07-20 Thread Terry Reedy
> Wow, I didn't know about enumerate. It is listed and explained in Lib Ref Manual, Chapter 2, on builtin functions and types and their methods. Everyone should read at least that much of the Lib manual. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP on path module for standard library

2005-07-21 Thread Terry Reedy
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Most prominent change is that it doesn't inherit from str/unicode > anymore. > I found this distinction important, because as a str subclass the Path > object > has many methods that don't make sense for it. Wh

<    17   18   19   20   21   22   23   24   25   26   >