Re: Assigning 'nochage' to a variable.

2005-09-04 Thread Terry Reedy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Has anyone else felt a desire for a 'nochange' value No. > resembling the 'Z'-state of a electronic tri-state output? Not familiar with that. > > var1 = 17 > var1 = func1() # func1() returns 'nochange' this ti

Re: Possible improvement to slice opperations.

2005-09-04 Thread Terry Reedy
"Ron Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Slicing is one of the best features of Python in my opinion, but > when you try to use negative index's and or negative step increments > it can be tricky and lead to unexpected results. > > This topic has come up fairly oft

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Rick Wotnaz wrote: >> +1 here. As far as I'm concerned, both os and sys could be special- >> cased that way. That said, I would guess the likelihood of that >> happening is 0. >> > +1 for both. Some people might pr

Re: curious about slice behaviour

2005-09-05 Thread Terry Reedy
"Stephan Diehl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I just found out by accident, that slice indices can be larger than > the length of the object. For example 'test'[:50] > 'test' 'test'[40:50] > '' > I'd rather expected to be confronted with an IndexError. > (

Re: dual processor

2005-09-05 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > Along with fixing the GIL, I think PyPy needs to give up on this > BASIC-style reference counting and introduce real garbage collection. > Lots of work has been done on concurrent GC and the techniques for it

Re: Warning when doubly linked list is defined gloablly

2005-09-05 Thread Terry Reedy
"chand" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Please let me know how to > resolve this warning message..!! > SyntaxWarning: name 'g_opt_list' is used prior to global declaration Post the entire error traceback. Post the entire error traceback. Post the entire error traceb

Re: Possible improvement to slice opperations.

2005-09-05 Thread Terry Reedy
> Ron Adam wrote: > >> However, I would like the inverse selection of negative strides to be >> fixed if possible. If you could explain the current reason why it does >> not return the reverse order of the selected range. To repeat, the current reason is compatibility with the original design for

Re: Job Offer in Paris, France : R&D Engineer (Plone)

2005-09-06 Thread Terry Reedy
"Erik Max Francis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul Rubin wrote: > >> If you still think this, I'd be interested in chatting a little >> further. Does the email address in the pdf go to you? If not, should >> I write you directly? Can I call on the phone (you

Re: Replacement for lambda - 'def' as an expression?

2005-09-06 Thread Terry Reedy
"talin at acm dot org" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Of course, one can always create a named function. But there are a lot > of cases, such as multimethods / generics and other scenarios where > functions are treated as data, where you have a whole lot of function

Re: Replacement for lambda - 'def' as an expression?

2005-09-06 Thread Terry Reedy
"Sybren Stuvel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > talin at acm dot org enlightened us with: >> I'd be sad to see the notion of "anonymous functions" go Though it is as yet unclear as to what may come in compensation. > Same here. I think it's a beautyful concept Are

Re: Django Vs Rails

2005-09-06 Thread Terry Reedy
"bruno modulix" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >D H wrote: > > (snip) >> Go with Rails. Django is only like a month old. > > Please take time to read the project's page. Django has in fact three > years of existence and is already used on production websites, so it's

Re: assign dict by value to list

2005-09-06 Thread Terry Reedy
"Phill Atwood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def csv_it(): > db = [] # the entire database of records > rec = {} # a single rec: a dictionary of field names and data pairs Move this line > fields = [] # list of field names collected so far for curren

Re: Do int.__lt__/__gt__/etc. exist?

2005-09-06 Thread Terry Reedy
"Chris Dutton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm just curious. I've been trying to demonstrate functional thinking > in Python, but I can't find these methods for int objects. It would be > immensely helpful for something like: > > filter(4 .__lt__, range(10)) D

Re: Question about concatenation error

2005-09-07 Thread Terry Reedy
"colonel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > so can anyone tell me why "cleanlink" gets coverted to a list? > Is it during the slicing? Steve answered for you, but for next time, you could find out faster by either using the all-purpose debuging tool known as 'print'

Re: PEP-able? Expressional conditions

2005-09-07 Thread Terry Reedy
"Kay Schluehr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > No, as I explained it is not a ternary operator and it can't easily be > implemented using a Python function efficiently because Python does not > support lazy evaluation. By *carefully* using the flow-control operators

Re: bug in numarray?

2005-09-07 Thread Terry Reedy
"Xiangyi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I got the following segmentation fault. >> from numarray import * >> a = zeros((5,100), Float64) >> b = kroneckerproduct(a, identity(12)) >> segmentation fault > > If I use a = zeros((5,100)), everything is fine. Kind of weir

Re: Construct raw strings?

2005-09-07 Thread Terry Reedy
"Thomas W" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I got a stupid problem; on my WinXP-box I want to scan the filesystem > and enter a path to scan like this : > > path_to_scan = 'd:\test_images' I believe you can always use / instead of \ for Win filenames from Python. Av

Re: generator object, next method

2005-09-08 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > Duncan Booth <[EMAIL PROTECTED]> writes: >> 1) Every time you access gen.next you create a new method-wrapper >> object. > > Why is that? I thought gen.next is a callable and gen.next() actually > advances t

Re: circular import problem

2005-09-09 Thread Terry Reedy
"Learning Python" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An example in the book I didn't understood well > two modules files recursively import/from each other There are past postings available in the archives (via Google) at least, that lucided discuss circular imports.

Re: Python linear algebra module -- requesting comments on interface

2005-09-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The module will be public domain. Various lawyers have suggested that either you cannot do that (is US) or that you should not do that. (You know the joke -- ask two lawyers and you get three opinions -- but all depends on your cou

Re: Question about consistency in python language

2005-09-09 Thread Terry Reedy
"Kay Schluehr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On the other hand there exists no sorted() method for tuples or lists > like join() for strings but it is implemented as a function in Python24 > that returns a new sorted container. I consider this as an > inconsistency

Re: Yielding a chain of values

2005-09-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>>unless you are going many levels deep > (and that's usually a design smell of some kind) > > No, its not a bug. its a feature! See the discussion in the recursive > generator thread below: http://groups.google.com/group/comp.lang.pyth

Re: nested tuples

2005-09-10 Thread Terry Reedy
"Luis P. Mendes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > | Why? What is it about the list of tuples that you don't like? > | Philosophically, it's more in line with Guido's separation of list and > | tuple. > I'm not saying that I don't like, I was just curious to know if t

Re: Python compiled?

2005-09-10 Thread Terry Reedy
"Tim Roberts" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "billiejoex" <[EMAIL PROTECTED]> wrote: >> >>Hi all. I'm sorry for a noob question like this but I'll try to ask it >>anyway. >>One of the greatest problem that may discourage a new user to choose >>Python >>language is

Re: Python compiled?

2005-09-10 Thread Terry Reedy
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> Nor has 386 'machine language' suffered from being interpreted, at a >> deeper >> level, by microcode. > > I think both you and Paul may be mi

Re: How to handle very large MIME Messages with the email package?

2005-09-10 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Looking at the email package, it seems all the MIMExxx classes takes > string but not file object as the payload. I need to handle very large > MIME messages say up to 100M. And possibly many of them. Is email > package sufficient. If

Re: Python versus Perl

2005-09-10 Thread Terry Reedy
"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dieter Vanderelst <[EMAIL PROTECTED]> wrote: >> 1 - How does the speed of execution of Perl compares to that of Python? > To a first-order approximation, Perl and Python run at the same speed. 'Speed of execution' is a fe

Re: Python versus Perl

2005-09-11 Thread Terry Reedy
"Michael Sparks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > That said, if you do describe it that way, it'd be more accurate to > describe > the python binary as a compiler/runtime rather than interpreter since > it'd > be more accurate. If Java calls its runtime bytecode in

Re: Question about consistency in python language

2005-09-11 Thread Terry Reedy
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In many, many fonts 'l' and '1' look close enough to be easily mistaken > for one another In the default font used by Outlook Express, displayed on my 1078x786 screen, the only difference I can see, using a magnifying g

Re: which is more 'pythonic' / 'better' ?

2005-09-12 Thread Terry Reedy
"Will McGugan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You may be right. I always use plural nouns for collections. ditto > To me 'line' would suggest there was just one of them, > so I assumed it was string. I did too. for line in file('skljflask.txt',r): # or similar i

Re: which is more 'pythonic' / 'better' ?

2005-09-13 Thread Terry Reedy
"gabor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i'm sorry ;) it was a list of strings... > > the code was something like: > > for line in open('x.y'): > line = line.split('\t') > > a better naming would be better it seems :) Like 'fields', for a list of fields ;-? Or your

Re: Windows Python 2.4: Unbuffered flag causes SyntaxError oninteractive sessions?

2005-09-13 Thread Terry Reedy
"Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Weird. Did you build Python yourself? The 2.4.1 release on python.org > is from March 30. > I just tried ActiveState's 2.4.1... the same thing happens. Please report this on the SourceForge bug list, including t

Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The bset() and bdict() classes improve upon the builtin set and > dictionary types by maintaining the elements in sorted order. > > Generally, the b* classes are a factor of O(log(N)) slower[2] than the > corresponding builtin classes,

Re: Magic Optimisation

2005-09-14 Thread Terry Reedy
"ABO" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There are other "optimisations" that could be applied that make this > code faster but uglier. For example, putting another "while True: loop > inside the try block to avoid the try block setup each iteration. In CPython, 'setti

Re: Software bugs aren't inevitable

2005-09-14 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Which works wonderfully as an academic exercise, but doesn't tend to work > so terribly well in the real world where the performance and > resource-requirement differences between iteration and recursion can be > sign

Re: Find day of week from month and year

2005-09-14 Thread Terry Reedy
> Laguna wrote: >> I want to find the expiration date of stock options (3rd Friday of the >> month) for an any give month and year. >From year and month (and day=1) get the day of the week (n in [0,6]) of the first of the month using some version of the the standard formula (see below) and look

Re: List of integers & L.I.S. (SPOILER)

2005-09-14 Thread Terry Reedy
"n00m" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Who is Raymond Hettinger? The Python developer who, in the last few years, has perhaps been the most active in coding or recoding library modules, such as itertools and sets, in C. He also partipates in development discussio

Re: Magic Optimisation

2005-09-14 Thread Terry Reedy
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry - > > If setting up a try-block is as fast (or "takes as long") as one > iteration loop, then wont putting a try-block inside a loop double the > execution time? It will double (more or less) the loop overhead. T

Re: Software bugs aren't inevitable

2005-09-14 Thread Terry Reedy
"Rocco Moretti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The algorithm one uses sometimes depends quite heavily on which mindset > you're using. Some algorithms require much more mental effort to > understand when in their recursive form versus the iterative form, and > vice

Re: Writing at the beginning of a file

2005-09-14 Thread Terry Reedy
"Thierry Lam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to write something of variable length at the top > of the file? ... > The other way to do what I want is to write the whole thing to a new > file, but I want to skip that method if there's an alternat

Re: Software bugs aren't inevitable

2005-09-14 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 14 Sep 2005 11:28:02 -0400, Terry Reedy wrote: > But in the context of my response, I was replying to a paraphrased quote > from somebody who apparently believes that recur

Re: Software bugs aren't inevitable

2005-09-14 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 14 Sep 2005 14:32:17 +0200, Jerzy Karczmarczuk wrote: >> Here you are a recursive version linear in n; it >> returns the two last Fibonacci numbers of the sequence The minor problem is that for n = 0, there a

Re: Software bugs aren't inevitable

2005-09-15 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are you saying that the recursion done by "serious" languages is a fake? > That it is actually implemented behind the scenes by iteration? Although easy to confuse, we should separate expressive syntax, whether recu

Re: 2.3 -> 2.4: long int too large to convert to int

2005-09-15 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I give up, how do I make this not fail under 2.4? > > > fcntl.ioctl(self.dev.fileno(),0xc0047a80,struct.pack("HBB",0x1c,0x00,0x00)) > > I get an OverflowError: long int too large to convert to int > > ioctl() is expecti

Re: Software bugs aren't inevitable

2005-09-15 Thread Terry Reedy
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] (Aahz) writes: >> While that's true, one of the reasons Guido has historically rejected >> this optimization is because there are plenty of recursive algorithms >> not amenable to tail-call optimization.

Re: 2.3 -> 2.4: long int too large to convert to int

2005-09-16 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > One of the nasty bits in a pure-python approach is that there's > no way to write a literal with a fixed length. For example, > instead of writing 0xf7 to get an 8-bit value and 0x12345789 to > get a 32-bit value, you

Re: Possible bug in "metaclass resolution order" ?

2005-09-17 Thread Terry Reedy
"Pedro Werneck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I still think this is a bug, not a documentation issue. As an sometimes bug report reviewer, I appreciate your posting this issue here to get a wider and quicker variety of responses than you might have on SF. If, a

Re: Software bugs aren't inevitable

2005-09-17 Thread Terry Reedy
"Aahz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Note that I said "one reason". The primary reason is that tail-call > optimization destroys the call stack, which means that exception > semantics would have to change. If tail-call optimization were more > useful, he might be

Re: End or Identify (EOI) character ?

2005-09-17 Thread Terry Reedy
"Madhusudan Singh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > I was wondering how does one detect the above character. It is returned > by > an instrument I am controlling via GPIB. EOI = chr(n) # where n is ASCII number of the character. # then whenever later if gpid_

Re: C#3.0 and lambdas

2005-09-19 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > I'm +1 for keeping them in the language and +1000 on keeping them > in Python 2.5. Removing them would break existing code and therefore > should not be done until Python 3.0 if at all. I believe the idea of

Re: slicing functionality for strings / Python suitability forbioinformatics

2005-09-19 Thread Terry Reedy
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > rs='AUGCUAGACGUGGAGUAG' > rs[12:15]='GAG' >> Traceback (most recent call last): >> File "", line 1, in ? >> rs[12:15]='GAG' >> TypeError: object doesn't support slice assig

Re: vendor-packages directory

2005-09-20 Thread Terry Reedy
"Rich Burridge" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I work in the Accessibility Program Office at Sun Microsystems. I'm > part of a team that is using Python to create a screen reader called > Orca, that'll help blind people (and people with low vision) have > access to

Re: Question About Logic In Python

2005-09-21 Thread Terry Reedy
> On Wed, 21 Sep 2005 09:03:00 +1000, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >>In practice, how often do you really care that your truth values have the >>specific values 0 and 1 rather than anything false and anything true? In >>what circumstances? Another example: you have an exam with N

Re: Question About Logic In Python

2005-09-22 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Which is yet another reason why it makes absolutely no sense to apply > arithmetic operations to Boolean values. Except for counting the number of true values. This and other legitimate uses of False/True as 0/1 (inde

Re: Word for a non-iterator iterable?

2005-02-06 Thread Terry Reedy
"vincent wehren" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Leif K-Brooks wrote: >> Is there a word for an iterable object which isn't also an iterator, and >> therefor can be iterated over multiple times without being exhausted? The 'therefor' above is a non sequitor. A non

Re: declarations summary

2005-02-07 Thread Terry Reedy
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael Tobis wrote: >> Also there's the question of typo-driven bugs, where an attempted >> rebinding of "epsilon" instead cerated a reference called "epselon". /cerated/created/ >> (The epselon bug) This is the bane

Re: Word for a non-iterator iterable?

2005-02-07 Thread Terry Reedy
"Oren Tirosh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > But when iter() returns the same object - well, that's a > sign that the object is definitely not reiterable. Unless, of course, __iter__ resets the iteration variable to its starting value. But it would definitely not

Re: variable declaration

2005-02-07 Thread Terry Reedy
"Brian van den Broek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is the right way to understand it in this vicinity: In the vicinity, but not quite exact >At compile time (by which I mean when the Python bytecode is built) Compile time is when the def statement is executed

Re: Vectors in Visual Python

2005-02-09 Thread Terry Reedy
"Arthur" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > is that VPython "vectors" are in effect flat 3 element Numeric arrays, > and Numeric ararys can be constructed with Float64 specified as the > datatype. (wonder if that speciufication is a "declaration", and if > so whether t

Re: Testing conditions.

2005-02-09 Thread Terry Reedy
"Ray Gibbon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > e.g. 1 > |while new_data = get_more_data(source): > |process_data(new_data) > > is obviously the sort of thing I'm missing, but it is not a general > solution > because :- > > e.g. 2 > |while new_data, env

Re: frozenset() without arguments should return a singleton

2005-02-12 Thread Terry Reedy
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi! > > frozenset() doesn't behave as the other immutable empty data types in > 2.4: > > .>>> '' is '' > True > .>>> () is () > True I believe the reference manual describes this sort of behavior for immutables as an

Re: Iterator / Iteratable confusion

2005-02-13 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An ""iteratable"" class is a class supporting the __iter__ method which > should > return an ""iterator"" instance, that is, an instance of a class > supporting > the "next" method. Not quite right, see below. > An

Re: Problem with nested lists as arrays

2005-02-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 'Having trouble' is too vague to figure out. However, I would delete this: >def getEmptySlot(self): >i = 0 >j = 0 >while i <= self.dim-1: >while j <= self.dim-1: >if self.eleme

Re: nested lists as arrays

2005-02-14 Thread Terry Reedy
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message > >And use xrange instead of range. For small dimensions like 3,4,5, xrange is way overkill and perhaps takes both more space and time. Since dim is a constant for a given puzzle, I would set self._range = range(dim) in __init__() and us

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Terry Reedy
"Martin MOKREJ©" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] int(somestring) without a radix argument requires that somestring be an decimal integer literal and nothing more and nothing else. >>> int('1') 1 >>> int('1.0') Traceback (most recent call last): File "", line 1, in

Re: newbie question - identifying name of method

2005-02-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does Python provide some sort of mechanism for answering the question: > what method am I in? I believe that Python, the language defined in the Ref Manual, does not. The CPython implementation adds enough introspection into its work

Re: nested lists as arrays

2005-02-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >def setRandomState(self): > # container for the elements to pick from > container = [1,2,3,4,5,6,7,8,-1] > > # create elements of puzzle randomly > i = 0 > j = 0 > while i <= self.dim-1: >

Re: Iterator / Iteratable confusion

2005-02-14 Thread Terry Reedy
vrier 2005 23:58, Terry Reedy a écrit : >> Iterators are a subgroup of iterables. Being able to say iter(it) >> without >> having to worry about whether 'it' is just an iterable or already an >> iterator is one of the nice features of the new iteration design.

Re: Iterator / Iteratable confusion

2005-02-14 Thread Terry Reedy
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> iter(iterator) is iterator is part of the iterater protocol > But, notwithstanding the docs, it is not essential that > iter(iterator) is iterator If a program

Re: ValueError: invalid literal for int(): 1.0000000000e+00

2005-02-14 Thread Terry Reedy
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> int(somestring) without a radix argument requires that somestring be an >> decimal integer literal and nothing more and nothing else. > > but specifyin

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Terry Reedy
In his 15 post on this thread within 5 hours, "Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message > Please explain the word "prolific". -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling a function from module question.

2005-02-15 Thread Terry Reedy
"Sean" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > import module_name.py leave off the .py Irmen answered your main question. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing Objects Based On Their ID

2005-02-15 Thread Terry Reedy
"Tim Daneliuk" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Given the ID of an object, is there a way to access it? You got the right short answer already. Another long answer 'yes' is to keep a dictionary mapping ids to objects, but as Diez pointed out, you need a real reason t

Re: Iterator / Iteratable confusion

2005-02-15 Thread Terry Reedy
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry, thanks for responding in depth. We are both interested in the murky edges at and beyond conventional usage. > Terry wrote >> 2. "It is not essential to not do something wasteful as long as it is >> >> other

Re: adding new functionality to a function non-intrusively!

2005-02-16 Thread Terry Reedy
"peter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > so my problem in fact is: > BEFORE: > def myfunction(a,b): > return (a+b) > AFTER: > def myfunction(a,b, op="add"): > if (op == "add"): > # some function which calls the old code for myfunction Is this

Re: [EVALUATION] - E02 - ULTIMATE RECIPE TO RESOLVE ALL ISSUES

2005-02-16 Thread Terry Reedy
"Peter Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > http://nobelprize.org/medicine/educational/pavlov/ > > and then do something useful :) Thanks. I showed this to my daughter, who enjoyed the game, and explained your point re Pavlov posting, and about Pavlov advertising

Re: adding new functionality to a function non-intrusively!

2005-02-16 Thread Terry Reedy
"peter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > indeed it does, so basically everything works except my original > solution: > > def myfunction(a,b): >return a+b > > def _myfunction(a,b): > return myfunction(a,b) > myfunction = _myfunction > > oh well, it was enou

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Terry Reedy
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This seems to be the last relevant message in the thread: > http://mail.python.org/pipermail/python-dev/2004-August/048516.html > So it was tried, but we found too many weird corner cases we weren't > quite sure > what

Re: difference between class methods and instance methods

2005-02-17 Thread Terry Reedy
"John M. Gabriele" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > And if anyone's *really* daring: > Where do the so-called "static methods" fit into all this? > By the name of them, it sounds like the same thing as class > methods... No, not at all. So called 'static methods' ar

Re: Test for structure

2005-02-21 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I don't like this idea much because it depends on str and unicode _not_ > having a particular function. I haven't seen any guarantee anywhere that > str or unicode won't ever grow an __iter__ method. So this code s

Re: Don't understand global variables between modules

2005-02-21 Thread Terry Reedy
"Bart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I don't understand globals between multiple modules in a python program. Because there are not any. All names are bound to objects in a module global namespace, a function local namespace, or an object attribute namespace.

Re: python2.4 generator expression > python2.3 list expression

2005-02-21 Thread Terry Reedy
"Christos TZOTZIOY Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 21 Feb 2005 06:48:19 -0500, rumours say that Dan Sommers > <[EMAIL PROTECTED]> >>for c in range( 128 ): >>even_odd = 0 >>print '%3d' % c, >>while c: >>c &= c - 1 >>even_odd =

Re: Python Online Programming Contest

2005-02-24 Thread Terry Reedy
"Varun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Friends, > Department of Information Technology, Madras Institute of Technology, > Anna University, India > is conducting a technical symposium, Samhita. As a part of samhita, an > Online Programming Contest is scheduled on

Re: accessor/mutator functions

2005-02-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When I look at how classes are set up in other languages (e.g. C++), I > often observe the following patterns: > 1) for each data member, the class will have an accessor member > function (a Get function) > 2) for each data member, the

Re: strange SyntaxError

2005-02-25 Thread Terry Reedy
"Attila Szabo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I wrote this sample piece of code: > > def main(): >lambda x: 'ABC%s' % str(x) >for k in range(2): exec('print %s' % k) > > main() > > With the lambda line, I get this: > SyntaxError: unqualified

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-26 Thread Terry Reedy
"Just" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Does SciPy do what you want? Specifically Scientific.Functions.FindRoot >> [1] & >> Scientific.Functions.Polynomial [2] >> http://starship.python.net/~hinsen/ScientificPython/ScientificPythonManual/Sci >> entific_9.html >> [2]

Re: Problem When Unit Testing with PMock

2005-02-26 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Anyone was using pmock for unit testing with python? I met a problem > and hope someone to help me. For short, the pmock seems can not mock a > iterator object. Why bother? def mockit(): raise StopIteration now pass mockit() > Fo

Re: Watermark on images

2005-02-26 Thread Terry Reedy
"Michele Simionato" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 Googling "Python image watermark" and first hit is !!! ASPN : Python Cookbook : Watermark with PIL ... Description: Apply a watermark to an image usi

Re: string methods (warning, newbie)

2005-02-26 Thread Terry Reedy
"anthonyberet" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a string mething to return only the alpha characters of a > string? > eg 'The Beatles - help - 03 - Ticket to ride', would be > 'TheBeatlesTickettoride' I believe you can do this with string.translate (string

Re: lambda strangeness??

2005-02-27 Thread Terry Reedy
"Alan Gauld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] adds = [lambda y: (y + n) for n in range(10)] To bind the definition-time value of n to the function, [lambda y,n=n:(y+n) for n in range(10)] Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem When Unit Testing with PMock

2005-02-27 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> def mockit(): raise StopIteration This was meant to be a generator function. Peter corrected my error in leaving out a never reached yield to make it so. My apologies. Putting if False: yield None as the first line in the functi

Re: Python - what is the fastest database ?

2005-02-28 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> How is it possible that google (super big database) is super fast? > What type database do they use / software ? On the hardware side, Google's secret is massively parallel cluster computing, coupled with proprietary software for sp

Re: Newbie question

2005-02-28 Thread Terry Reedy
For future reference, an informative subject line like > How do I display an image in Python? is more likely to grab the attention of someone with the information sought. tjr -- http://mail.python.org/mailman/listinfo/python-list

Re: yield_all needed in Python

2005-02-28 Thread Terry Reedy
"Douglas Alan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We can shorten the code--and make it run in O(N) time--by adding a > new > keyword to replace the "for v in ...: yield v" pattern: Maybe. Until you define the semantics of yield_all and at least outline an im

Re: Problem in Dictionaries

2005-03-02 Thread Terry Reedy
"Glauco Silva" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I would like to know if the dictionary can sort with a function that i >give to then! No. You have to either make a list of key,value items and sort that, possibly with a cmp or key parameter items = d.items() items.

Re: yield_all needed in Python

2005-03-02 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Douglas Alan wrote: >> In this case, that is great, since I'd much prefer >> >>yield *gen1(arg) >> >> than >> >>yield_all gen1(arg) > > I'm guessing the * syntax is pretty unlikely to win Guido's approval. > T

Re: Need some simple coding help

2005-03-02 Thread Terry Reedy
"mx2k" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Now you enter a value by which the initiative should be increased, > then adding reaction time to that value and then adding the result to > reaction time. Now soring again by lowest,next,'n'th, etc. and then > again showing th

Re: Identify and perform actions to data within stated limits

2005-03-02 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I found the len(*) obscurely mentioned on someones webpage. *All* the built functions are prominently listed and described in Library Reference 2.1Built-in Functions. I urge you and any beginner to at least read the whole of chapte

Re: [Numeric] column vector faster than row vector in mat multiply?

2005-03-04 Thread Terry Reedy
"Zhang Le" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I did a small benchmark of matrix-vector multiply operation using > Numeric module. I'm a bit suprised to find matrix*col-vector is much > faster than row-vector*matrix. I wonder whether other people have > observed t

Re: Iterate using tuple as index

2005-03-10 Thread Terry Reedy
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Its not obvious to me how to do this. I would like to iterate using a > tuple as > an index. Say I have two equivalently sized arrays, what I do now seems > inelegant: Sounds like you want zip(firstlist, secondlist).

<    19   20   21   22   23   24   25   26   27   28   >