Re: dot products

2004-12-20 Thread Alan G Isaac
[Rahul]. > I want to compute dot product of two vectors stored as lists a and b.a > and b are of the same length from scipy import dot ans=dot(a,b) This times faster than the alternatives I have seen mentioned so far, given scipy. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/

Re: dot products

2004-12-20 Thread Alan G Isaac
"Alan G Isaac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This times faster than the alternatives I have seen mentioned so far, > given scipy. Actually, since I am new to 'timeit', I probably should check that I am not overlooking something. Es

Re: Is this a good use for lambda

2004-12-20 Thread Alan G Isaac
I need a clarification of the argument. Are the opponents saying that I should not be able to: def compose(list_of_functions): return reduce(lambda f, g: lambda x: f(g(x)), list_of_functions) In a nutshell: why? And may I see the proposed "better" replacement for function composition. Thanks, Al

Re: Is this a good use for lambda

2004-12-21 Thread Alan G Isaac
So as I understand it, so far the "best" proposal for a replacement of my function-composition function uses a (compatibility reducing) Python 2.4 feature that Nick suggests will end up on "Gotcha" lists. Hmmm: lambda is looking pretty good, I'd say. The readability issue is valid, of course. Bu

handling many default values

2006-11-10 Thread Alan G Isaac
My class MyClass reuses many default parameters with a small number of changes in each instance. For various reasons I decided to put all the parameters in a separate Params class, instances of which reset the default values based on keyword arguments, like this: class Params: def __init__(se

Re: Fredrik Lundh [was "Re: explicit self revisited"]

2006-11-12 Thread Alan G Isaac
On Sun, 12 Nov 2006 02:14:32 -0500, Doug <[EMAIL PROTECTED]> wrote: > I was going to link to > a definition of FUD to show I really meant to use that term. Oooh. If you had just mentioned your dyslogia, it would have saved us all some time. Thanks! Alan -- http://mail.python.org/mailman/listinfo/

Re: bool behavior in Python 3000?

2007-07-10 Thread Alan G Isaac
Peter Otten wrote: > The last I have seen is > http://mail.python.org/pipermail/python-3000/2007-January/005284.html OK. Thanks. > Do you care to explain what is broken? I suppose one either finds coercion of arithmetic operations to int to be odd/broken or does not. But that's all I meant

comparison with None

2007-04-18 Thread Alan G Isaac
>>> None >= 0 False >>> None <= 0 True Explanation appreciated. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
Diez B. Roggisch wrote: > Not really, but that depends on what you know about the concept of sets and > maps as collections of course. > > The contract for sets and dicts doesn't imply any order whatsoever. Which is > essentially the reason why > > set(xrange(10))[0] > > doesn't exist, and quite

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
Robert Kern wrote: > http://docs.python.org/lib/typesmapping.html > """ > Keys and values are listed in an arbitrary order which is non-random, varies > across Python implementations, and depends on the dictionary's history of > insertions and deletions. > """ Even this does not tell me that if I

vocab question

2007-04-13 Thread Alan G Isaac
Pardon the vocab question; I'm not a computer science type. According to the Reference Manual, a class defintion has the structure:: classdef ::= "class" classname [inheritance] ":" suite What is the entire part before the suite called? (Just pointing to a reference is fine & helpful,

Re: vocab question

2007-04-13 Thread Alan G Isaac
Steven Bethard wrote: > As far as I > know, there's no official term for the first four elements of a class > statement. I'd probably call it the class statement header. That will have to do for now. Thanks! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: pairs from a list

2008-01-23 Thread Alan G Isaac
Steven D'Aprano wrote: > In fact, "fastest" isn't even a meaningful attribute. Does it mean: > > * the worst-case is fastest > * the best-case is fastest > * the average-case is fastest > * fastest on typical data > * all of the above I confess that it did not occur to me that there might be an

Re: Python printing!

2008-01-23 Thread Alan G Isaac
SMALLp wrote: > Hy. How to use printer in python. http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Formatting arrays using myarrayy.tolist()

2008-02-06 Thread Alan G Isaac
http://www.scipy.org/Cookbook/InputOutput> hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac >>> x = range(20) >>> s = slice(None,None,2) >>> x[s] Traceback (most recent call last): File "", line 1, in TypeError: sequence index must be integer, not 'slice' -- http://mail.python.org/mailman/li

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the old range). Alan Isaac -- h

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
It is documented: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range -- http://mail.python.org/mailman/listinfo/python-list

tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph "Most sequence types support the following operations." it seems appropriate to have one stating "Most sequence types support the

Re: tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
Alan G Isaac wrote: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph "Most sequence types support the following operations." it seems appropriate to have one sta

Re: tuple methods: documentation missing

2009-01-17 Thread Alan G Isaac
On 1/16/2009 6:44 PM Terry Reedy apparently wrote: http://bugs.python.org/issue4966 Is this another lacuna or am I overlooking it? I cannot find the 3.0 documentation of string formatting with the ``%`` operator. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
In Python 3, you can no longer ``exec(open(filename))``. I guess the reason is that in 3.0 ``open`` returns a stream, instead of open file, and exec wants "a string, bytes, or code object" and not a "TextIOWrapper". So it returns an error. Is it intentional that ``exec`` cannot handle a TextIOWr

Re: Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
Alan G Isaac wrote: Is it intentional that ``exec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? On 1/17/2009 4:20 PM Terry Reedy apparently wrote: Yes. Yes. OK. Why? Alan Isaac -- http

Re: Python 3: exec arg 1

2009-01-18 Thread Alan G Isaac
Alan G Isaac wrote: Is it intentional that ``exec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? On 1/17/2009 4:20 PM Terry Reedy apparently wrote: Yes. Yes. Alan G Isaac wrote: OK. Why

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/17/2009 3:59 PM Ned Deily apparently wrote: Ah, so the rumors are true: we are supposed to prefer '{0:>10}'.format('wtf?') to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: we are supposed to prefer '{0:>10}'.format('wtf?') to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?' % 'w

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/19/2009 3:03 PM John Machin apparently wrote: It is not deprecated YET; see this: http://docs.python.org/3.0/whatsnew/3.0.html#changes-already-present-in-python-2-6 PEP 3101: Advanced String Formatting. Note: the 2.6 description mentions the format() method for both 8-bit and Unicode strin

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/19/2009 5:03 PM Terry Reedy apparently wrote: I have not seen 3.0 emit a % deprecation warning. Point taken. But the vocabulary of PEP 4 suggests that "obsolete" and "deprecated" are synonyms, and PEP 4 lists obsolete modules without deprecation warnings. Alan Isaac -- http://mail.pytho

Re: Python 3: exec arg 1

2009-01-20 Thread Alan G Isaac
On 1/18/2009 9:36 AM Alan G Isaac apparently wrote: I do not much care about the disappearance of ``execfile``. I was asking, why is it a **good thing** that ``exec`` does not accept a TextIOWrapper? Or is it just not implemented yet? What is the gain from this particular backwards

Re: Python 3: exec arg 1

2009-01-22 Thread Alan G Isaac
On 1/20/2009 3:53 PM Rob Williscroft apparently wrote: http://bugs.python.org/issue1762972 (*) Useful. Thanks. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Alan G Isaac
On 1/16/2009 3:13 PM Alan G Isaac apparently wrote: > It is documented: > http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range But then again, the opposite is also documented, since `range` is a sequence type. Quoting: Sequence

Re: print formating for matrix/table

2009-01-27 Thread Alan G Isaac
You could try SimpleTable: http://code.google.com/p/econpy/source/browse/trunk/utilities/text.py fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

slicings: 3 questions

2009-01-29 Thread Alan G Isaac
1. I seem not to understand something obvious at http://docs.python.org/3.0/reference/expressions.html#slicings (I assume I'm just not reading this right.) What is an example of a slicing using a "slice_list"? 2. It seems that slice objects and range objects are awfully similar in many ways. Is

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
On Thu, Jan 29, 2009 at 10:01 AM, Alan G Isaac wrote: 1. I seem not to understand something obvious at http://docs.python.org/3.0/reference/expressions.html#slicings (I assume I'm just not reading this right.) What is an example of a slicing using a "slice_list"? On 1/29/200

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
On Thu, Jan 29, 2009 at 10:01 AM, Alan G Isaac wrote: 2. It seems that slice objects and range objects are awfully similar in many ways. Is this "appearance only", or was there any discussion of unifying them? Curious for insight... On 1/29/2009 1:37 PM Chris Rebert appare

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
On 1/29/2009 4:41 PM Robert Kern apparently wrote: It allows (ab)uses like numpy.mgrid: >>> mgrid[0:10:11j] array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.]) Ah of course. Obvious now, but I had presumed some deeper magic in that syntax, not recognizing that a legitim

naming and binding (subtle Python 3 change)

2009-01-29 Thread Alan G Isaac
The example give at http://docs.python.org/reference/executionmodel.html#naming-and-binding remains unchanged at http://docs.python.org/3.0/reference/executionmodel.html#naming-and-binding but the change to Python 3 list comprehensions now means the example will fail even with list comprehension s

Re: naming and binding (subtle Python 3 change)

2009-01-30 Thread Alan G Isaac
On 1/29/2009 10:50 PM Terry Reedy apparently wrote: http://bugs.python.org/issue5106 Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: what IDE is the best to write python?

2009-02-03 Thread Alan G Isaac
On 2/1/2009 2:42 AM mcheun...@hotmail.com apparently wrote: Hi all what IDE is the best to write python? http://blog.sontek.net/2008/05/11/python-with-a-modular-ide-vim/ Alan Isaac PS Also maybe see: http://vim.sourceforge.net/scripts/script.php?script_id=30 http://www.builderau.com.au/

Re: Creating custom formatter function

2009-02-16 Thread Alan G Isaac
On 2/16/2009 6:50 AM Garrett Cooper apparently wrote: I was wondering what the proper means was for formatting strings. http://docs.python.org/library/string.html#string-formatting http://docs.python.org/library/string.html#template-strings http://docs.python.org/library/stdtypes.html#string-

get descriptor from instance

2009-02-18 Thread Alan G Isaac
What is a reliable way to get the the property object for an instance attribute? (Or more generally, to get the descriptor controlling an attribute?) If class ``A`` defines the property ``x`` and ``a`` in an instance of ``A``, then you can just use ``type(a).__dict__['x']`` to get the property ob

Re: block dynamic attribute creation (was: get descriptor from instance)

2009-02-18 Thread Alan G Isaac
On 2/18/2009 6:15 PM Gabriel Genellina apparently wrote: type(a).x OK, that's good. I'd like to sometimes lock attribute creation on instances of a class but still allow properties to function correctly. Will something like below be satisfactory? Thanks, Alan def __setattr__(self, attr, v

Re: block dynamic attribute creation

2009-02-19 Thread Alan G Isaac
if hasattr(self, attr): #update val self.__dict__[attr] = val On 2/19/2009 3:54 AM Gabriel Genellina apparently wrote: In particular, your code prevents using class attributes as a default value for instance attributes Doesn't the above allow that? Thanks, Alan -- http://mai

Re: block dynamic attribute creation

2009-02-19 Thread Alan G Isaac
On 2/19/2009 3:47 AM Bruno Desthuilliers apparently wrote: if not hasattr(self, attr) and getattr(self, '_attrlock', False): raise AttributeError(yadda yadda) # NB: assume newstyle class super(YourClass, self).__setattr__(attr, val) Thanks. Alan PS Thanks also to all

Re: end of print = lower productivity ?

2008-12-01 Thread Alan G Isaac
I actually trust that the developers had good reasons for this change, but I think it is silly to argue that it is costless. The question is, what is the cost-benefit trade-off? One obvious cost is that working at the interpreter prompt is now slightly less convenient. Just because the cost is

Re: ANN: New Book: Programming in Python 3

2008-12-04 Thread Alan G Isaac
Mark Summerfield wrote: "Programming in Python 3: A Complete Introduction to the Python Language" ISBN 0137129297 http://www.qtrac.eu/py3book.html OMG, you really wrote it in Lout? I wish you would add to http://www.qtrac.eu/lout.html a comment on what you get out of that (compared to using e.

Re: simplest way to strip a comment from the end of a line?

2008-12-04 Thread Alan G Isaac
[EMAIL PROTECTED] wrote: >>> from shlex import split >>> split("this is a test #with a comment") ['this', 'is', 'a', 'test', '#with', 'a', 'comment'] >>> split("this is a test #with a comment", comments=True) ['this', 'is', 'a', 'test'] >>> split("this is a '#gnarlier' tes

Re: "as" keyword woes

2008-12-04 Thread Alan G Isaac
Warren DeLano wrote: what I can't understand is the decision to break 2.6 instead of 3.0. 2.x was supposed to remain backwards compatible, with the thinking that 2.x would be maintained in parallel for quite some time. 3.x was supposed to be the compatibility break. I do not understand why a

Re: OOP books?

2008-10-15 Thread Alan G Isaac
Mike Driscoll wrote: I have yet to read a Python book that only focuses on the OOP part, http://www.amazon.com/Scripting-Objects-Comparative-Presentation-Object-Oriented/dp/047039725X fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

read zipfile sequentially?

2008-10-15 Thread Alan G Isaac
I have a large ASCII data set that is zipped to a reasonable size. Can I access the data without decompressing the whole file first? I would like to run through the data to produce a much smaller extract and some summary statistics, but without unzipping it (if that is even possible). Thanks, Alan

Re: read zipfile sequentially?

2008-10-15 Thread Alan G Isaac
On 10/15/2008 3:13 PM Tim Chase apparently wrote: http://mail.python.org/pipermail/python-list/2007-December/469320.html Ask and ye shall receive... Thank you! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP books?

2008-10-15 Thread Alan G Isaac
On 10/15/2008 4:07 PM Mike Driscoll apparently wrote: Wow! That's a pricey book! Have you read it? Is it good? Per page the price is right: it runs nearly 1300 pages! I have not read it, but I have read a chunk of his previous http://www.amazon.com/Programming-Objects-Comparative-Presentation-O

iter with stepsize

2008-10-15 Thread Alan G Isaac
If I have a sequence, I can get every other or every fifth element by slicing. Is there an equivalent for iterators? More specifically, I want every fifth line of a big file. What is the most efficient way to get them? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: iter with stepsize

2008-10-15 Thread Alan G Isaac
Alan G Isaac <[EMAIL PROTECTED]> writes: If I have a sequence, I can get every other or every fifth element by slicing. Is there an equivalent for iterators? On 10/15/2008 11:12 PM Paul Rubin apparently wrote: itertools.islice Oh, of course. I'm a bit embarrassed not to have

bibtex parsing

2008-10-17 Thread Alan G Isaac
Can anyone recommend a pure Python parser of BibTeX files? Ideally MIT or BSD licensed? Online search some possibilities: http://svn.plone.org/svn/collective/bibliograph.parsing/trunk/bibliograph/parsing/parsers/bibtex.py http://www.geocities.com/fiolj/bibtexparse.html http://www.cis.udel.edu/~sp

Re: bibtex parsing

2008-10-17 Thread Alan G Isaac
On 10/17/2008 6:14 PM Paul McGuire apparently wrote: Visit the pyparsing wiki for all sorts of applications. Here is a BibTeX parser submitted by pyparsing wiki user ero-sennin: http://pyparsing.wikispaces.com/WhosUsingPyparsing#pybtex I don't know what the license is. GPL unfortunately. Thank

Re: [SciPy-user] ANN: Python programs for epidemic modelling

2008-10-25 Thread Alan G Isaac
On 10/25/2008 4:14 PM I. Soumpasis apparently wrote: http://blog.deductivethinking.com/?p=29 This is cool. But I do not see a license. May I hope this is released under the new BSD license, like the packages it depends on? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-l

Re: [Numpy-discussion] [SciPy-user] ANN: Python programs for epidemic modelling

2008-10-25 Thread Alan G Isaac
On 10/25/2008 6:07 PM I. Soumpasis wrote: The programs are GPL licensed. More info on the section of copyrights > http://wiki.deductivethinking.com/wiki/Deductive_Thinking:Copyrights. I hope it is ok, Well, that depends what you mean by "ok". Obviously, the author picks the license s/he pref

Re: Replacing cmp with key for sorting

2008-11-03 Thread Alan G Isaac
George Sakkis wrote: s.sort(cmp=lambda x,y: 0 if x==y else -1 if x.startswith(y) else +1 if y.startswith(x) else cmp(x,y)) Probably not what you had in mind ... >>> s ['a', 'b

Re: Free Python Training: Washington, DC (3/3-5)

2009-02-25 Thread Alan G Isaac
Great idea, but if you do it again, a bit more lead time would be helpful. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Chandler, Python, speed

2009-03-03 Thread Alan G Isaac
On Mar 2, 1:11 am, Paul Rubin wrote: Mitch Kapor (of Lotus 1-2-3 fame) spent a lot of money hiring very sharp Python programmers to write an email client called Chandler, but from what I understand, progress so far has been disappointing, at least in part for performance reasons. Paul McGui

Re: Python parser

2009-03-03 Thread Alan G Isaac
This reminds me: the SimpleParse developers ran into some troubles porting to Python 2.6. It would be great if someone could give them a hand. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python parser

2009-03-04 Thread Alan G Isaac
Gabriel Genellina wrote: Do you mean the simpleparser project in Sourceforge? http://simpleparse.sourceforge.net/ I thought this to be one of the most famous and useful Python parsers, because of its combination of simplicity and speed. Anyway, it is *very* good, and not having a version for

Re: Python alternatives to Text::SimpleTable?

2009-03-09 Thread Alan G Isaac
http://code.google.com/p/econpy/source/browse/trunk/utilities/text.py -- http://mail.python.org/mailman/listinfo/python-list

Re: Set & Frozenset?

2009-03-09 Thread Alan G Isaac
Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value, use iter(the_set).next() I recall a claim that for result in myset: break is the mos

Re: Using python 3 for scripting?

2009-03-23 Thread Alan G Isaac
On 3/22/2009 12:41 PM Chris Rebert apparently wrote: 2.6.1, the latest non-3.x release is probably best. Most libraries haven't been ported to 3.x yet, so Python 3 has yet to become widespread. This seems slightly optimistic to me. Until a week ago, there was not a NumPy release for 2.6. There

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread Alan G Isaac
On 3/21/2009 9:26 AM Esmail apparently wrote: I also write out some gnuplot scripts that later get executed to generate .jpg images. See Gnuplot.py Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between generating a value and returning a value?

2009-03-23 Thread Alan G Isaac
On 3/23/2009 6:12 PM grocery_stocker apparently wrote: http://openbookproject.net/thinkCSpy/ch05.xhtml#index15 "The built-in functions we have used, such as abs, pow, and max, have produced results. Calling each of these functions generates a value, which we usually assign to a variable or use

tkinter questions: behavior of StringVar, etc

2009-03-28 Thread Alan G Isaac
I'm a complete newbie to GUI. I have a couple questions about tkinter. 1. Where is the list of changes in Python 3's tkinter? 2. What exactly is the role of the root object, traditionally created as ``root=tk.Tk()``? What is an example where one should create this before creating a F

Re: tkinter questions: behavior of StringVar, etc

2009-03-28 Thread Alan G Isaac
On Mar 28, 2:15 pm, Alan G Isaac wrote: I'm a complete newbie to GUI. I have a couple questions about tkinter. 1. Where is the list of changes in Python 3's tkinter? 2. What exactly is the role of the root object, traditionally created as ``root=tk.Tk()``? What is

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On 3/29/2009 3:43 AM Scott David Daniels apparently wrote: OK, that was plain rude. a couple of questions is not six questions. A reply telling you how to get to some of what you are looking for is assistance. If you want exact answers to an array of questions, pay someone to fetch you the answ

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On 3/29/2009 7:29 AM Francesco Bochicchio apparently wrote: 1. Tkinter is only a thin wrapper over Tk, a GUI library initially developed for Tcl language, so many of the answer to the design choices you question (e.g. what is the master) cannot between answered within the python documentation b

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
Alan asked: - Why does a Variable need a master? - If s is a StringVar instance, why is str(s) its name rather than its value? On 3/29/2009 2:46 PM Scott David Daniels apparently wrote: The answer to that, grasshopper, lies in the answer to the question, "What are StringVars designed to do?

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On 3/29/2009 2:46 PM Scott David Daniels apparently wrote: You ask, "What exactly is the role of ...", rather than saying something like, "I don't understand the role of ...", and continue to ask why the code is not architected the way you first expected it to be architected, calling those thi

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On 3/29/2009 6:50 PM Rhodri James apparently wrote: In this case, your choice of wording (the nearest thing we have in print to "tone of voice") did not inspire me to go digging around in source that you have just as easy access to, in order to answer questions that I'm not particularly intereste

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On 3/29/2009 6:49 PM Scott David Daniels apparently wrote: Right. Tkinter could have been built to make a root at the first instantiation of a StringVar or IntVar, but it wasn't. Answering your why is a bit like answering the "Why did Picasso choose primarily blue in his Blue Period, rather

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Alan G Isaac
On Mon, 30 Mar 2009 00:13:46 +0100, Alan G Isaac wrote: Since you did not address my question about the nuance of "magic", I'm inclined to treat you as a "no" vote. On 3/29/2009 7:19 PM Rhodri James apparently wrote: And you'd be wrong. So seriously, you&#

Re: email from windows

2009-03-29 Thread Alan G Isaac
2009/3/29 prakash jp : In windows environment, how to send email from one gmail address to another gmail (or another mail) addrress On 3/29/2009 10:20 PM Chris Rebert apparently wrote: Use the `smtplib` and `email` standard libraries (which, as a bonus, are cross-platform): http://docs.python

Re: tkinter questions: behavior of StringVar, etc

2009-03-30 Thread Alan G Isaac
On 3/30/2009 3:37 AM Eric Brunel apparently wrote: The object traditionally called root is in fact an instance of the tcl interpreter that will get the commands generated by the Tkinter module. Due to tk architecture, creating this interpreter will also create a window, which is inteneded to be y

Re: tkinter questions: behavior of StringVar, etc

2009-03-30 Thread Alan G Isaac
On 3/30/2009 3:37 AM Eric Brunel apparently wrote: The string representation of Tkinter objects seems to be a design principle in this module: it'll always evaluate to the representation this object has at tcl level. Since a XxxVar is represented by an actual variable at tcl level, its string rep

tkFileDialog -> ImportError: No module named shell

2009-04-13 Thread Alan G Isaac
Why do I get the ImportError below? What is the right way to do this? Thanks, Alan Isaac Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Tkinter as tk >>> root=tk.Tk() >>> im

Re: tkFileDialog -> ImportError: No module named shell

2009-04-13 Thread Alan G Isaac
On Apr 13, 11:26 am, Alan G Isaac wrote: Why do I get the ImportError below? What is the right way to do this? Thanks, Alan Isaac Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or

Re: possible pairings in a set

2009-04-13 Thread Alan G Isaac
I cannot access this thread right now so my answer my be rednundant, but anyway: http://docs.python.org/library/itertools.html#itertools.combinations >>> from itertools import combinations >>> print(list(combinations(range(4),2))) [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)] hth,

Re: DVCSs wreck tkFileDialog

2009-04-14 Thread Alan G Isaac
More info: http://sourceforge.net/mailarchive/forum.php?thread_name=A46CBF978138744AAC019E6FF055EAB70F30AE%40apatlelsmail08.elsys.gtri.org&forum_name=tortoisehg-develop> Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python after a few years of Ruby

2009-04-14 Thread Alan G Isaac
On 4/14/2009 3:01 AM blahemailb...@gmail.com apparently wrote: 1) Rake - is there an equivalent of Rake? I've seen a bit about SCons, and it looks really nice, but it seems geared towards being a Make replacement for C/C++ rather than something that's used to work with Python itself. Is there any

color propagation in tkinter

2009-04-20 Thread Alan G Isaac
I'm a tkinter novice. If I want to propagate changes to a font, I can just use a named font. What if I want to propagate color changes? (E.g., a change in background color for a number of widgets.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: color propagation in tkinter

2009-04-20 Thread Alan G Isaac
On Apr 20, 12:35 pm, Alan G Isaac wrote: If I want to propagate changes to a font, I can just use a named font. What if I want to propagate color changes? (E.g., a change in background color for a number of widgets.) On 4/20/2009 1:59 PM Mike Driscoll apparently wrote: One way would be to

rectangles, or cavases, or ... ?

2009-04-20 Thread Alan G Isaac
I need to display many (e.e., 2000) small squares whose colors are udpated each time a computation is complete. One approach is to put rectangles on a single canvas. Another approach is to put many canvases in a single frame. Another approach is to create an image each iteration, which is placed

Re: rectangles, or cavases, or ... ?

2009-04-20 Thread Alan G Isaac
On 4/20/2009 5:59 PM Scott David Daniels apparently wrote: You should have said, but I'll guess you are using Tkinter. Yes, I should have, sorry. You are right, I'm using Tkinter. I'd put the rectangles on a canvas, myself. That's my current choice, but I'm not seeing into what the trade-

Re: rectangles, or cavases, or ... ?

2009-04-20 Thread Alan G Isaac
On 4/20/2009 7:43 PM John McMonagle apparently wrote: Approach 1: put many rectangles on a single canvas This is the most flexible approach. It allows you to take advantage of Tkinter canvas tag bindings to interact with individual or groups of canvas items. It also allows you to use some pre

Re: rectangles, or cavases, or ... ? under Tkinter

2009-04-20 Thread Alan G Isaac
On Apr 20, 5:29 pm, Alan G Isaac wrote: I need to display many (e.e., 2000) small squares whose colors are udpated each time a computation is complete. One approach is to put rectangles on a single canvas. Another approach is to put many canvases in a single frame. Another approach is to

Re: 2d barcode library?

2009-05-20 Thread Alan G Isaac
Christian Heimes wrote: https://cybernetics.hudora.biz/projects/wiki/huBarcode Cool. I have to mention a pure PostScript writer as well: http://www.terryburton.co.uk/barcodewriter/ Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: LaTeXing python programs

2009-05-20 Thread Alan G Isaac
On Wednesday 20 May 2009 18:43:21 Edward Grefenstette wrote: is there a LaTeX package out there that works well for presenting python code? José Matos wrote: Use the listings package. It has a python as one of defined languages and has lots of other options. http://www.ctan.org/tex-archive/

Re: reseting an iterator

2009-05-20 Thread Alan G Isaac
Jan wrote: Wouldn't it be easy for Python to implement generating functions so that the iterators they return are equipped with a __reset__() method? Use ``send``: http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features Remember, there may be no underlying sequence object for a

define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
I believe the glossary http://wiki.python.org/moin/PythonGlossary is missing the definition for 'generator' and has used instead the definition for 'generator function', which term is missing from the glossary. Standard usage as I understand it is found here: http://docs.python.org/3.0/reference/

Re: define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
On Fri, 22 May 2009 16:38:40 GMT, Alan G Isaac wrote: I believe the glossary http://wiki.python.org/moin/PythonGlossary is missing the definition for 'generator' and has used instead the definition for 'generator function', which term is missing from the glossary.

Re: define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
On 5/22/2009 1:44 PM s...@pobox.com apparently wrote: Note that the glossary page is on the wiki. Feel free to make corrections. Well, ok, I've done so: http://wiki.python.org/moin/PythonGlossary But I'm just a user. Someone should check it. Thanks, Alan Isaac -- http://mail.python.org/mai

Re: should I put old or new style classes in my book?

2008-05-30 Thread Alan G Isaac
Alan Isaac <[EMAIL PROTECTED]> writes: I take it from this thread that in Python 3 the following are equivalent: class Test: pass class Test(object): pass Arnaud Delobelle wrote: I don't know where it is stated, but how could they *not* be equivalent? The most obvious wa

sys.stderr.write returns string length in Python 3

2008-07-22 Thread Alan G Isaac
Is this new behavior intentional? :: >>> sys.stderr.write("thisisatest\n") thisisatest 12 Here is the reason for it: >>> help(sys.stderr.write) Help on method write in module io: write(self, s: str) method of io.TextIOWrapper instance Thank you,

Re: sys.stderr.write returns string length in Python 3

2008-07-22 Thread Alan G Isaac
Benjamin wrote: http://www.python.org/dev/peps/pep-3116/. Thanks. Can you give me an example of using the returned value? Alan -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >