Re: handling many default values

2006-11-11 Thread Alan Isaac
sign to isolate the parameters in a separate class? (Comment: currently several classes may rely on (parts of) the same parameter set.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: handling many default values

2006-11-11 Thread Alan Isaac
"Steven D'Aprano" wrote > (1) If there really is no alternative to a class with many arguments; > (2) and instances can vary those arguments unpredictably; > then this approach seems reasonable to me. But I really suggest you > rethink your class design. Thanks to all who replied and to George for

Re: Writing PNG with pure Python

2006-06-09 Thread Alan Isaac
actory/lib/image/png.py It's your code, so you get to license it. But if you wish to solicit patches, a more Pythonic license is IMHO more likely to prove fruitful. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric help!

2006-06-29 Thread Alan Isaac
p://www.scipy.org/Cookbook ) Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: How to refer to Python?

2006-11-29 Thread Alan Isaac
r_1_1/102-2818366-5466542?ie=UTF8&s=books> Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: permutations - fast & with low memory consumption?

2006-12-19 Thread Alan Isaac
yield [lst[i]]+x else: yield lst hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: File processing - is Python suitable?

2007-06-19 Thread Alan Isaac
nstructs that Python can use to process these files? Someone can. ;-) However if the file is structured, awk may be faster, since this sounds like the kind of report generation it was designed for. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

cannot have test scripts in packages?

2007-06-21 Thread Alan Isaac
ser to take the step of inserting the package location into sys.path and have test.py rely on the user having done this? What is the recommended handling of demo or test scripts for a package? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python plain-text database or library that supports joins?

2007-06-22 Thread Alan Isaac
Not Python, but maybe relevant: http://www.scriptaworks.com/cgi-bin/wiki.sh/NoSQL/HomePage Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

relative import question: packaging scripts

2007-06-23 Thread Alan Isaac
test.py rely on the user having done this? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

guidance needed: best practice for script packaging

2007-06-26 Thread Alan Isaac
uestion in an unhelpful way. If my question is still unclear, I would appreciate any leads on how to clarify it. Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: guidance needed: best practice for script packaging

2007-06-28 Thread Alan Isaac
My thanks to Gabriel and Josiah. Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: equality & comparison by default (was Re: Too many 'self' in python.That's a big flaw in this language.)

2007-06-28 Thread Alan Isaac
once told me. Then your math teacher misspoke. You have two different cars in the set, just as expected. Use `is`. http://docs.python.org/ref/comparisons.html This is good behavior. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: equality & comparison by default (was Re: Too many 'self' in python.That's a big flaw in this language.)

2007-07-01 Thread Alan Isaac
lly not identical in this sense. Of course you can make them so if you wish, but it is odd. So *nothing* is wrong here, imo. Btw: >>> a = 12 >>> b = 12 >>> a == b True >>> a is b True Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

allow scripts to use .pth files?

2007-07-03 Thread Alan Isaac
assuming there is not one. (?) How about allowing a `scripts.pth` file in such a `scripts` directory, to work like a path configuration file? (But to be used only when __name__=="__main__".) Drawbacks? Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: allow scripts to use .pth files?

2007-07-04 Thread Alan Isaac
> On Jul 3, 7:35 am, Alan Isaac <[EMAIL PROTECTED]> wrote: >>Suppose I have a directory `scripts`. >>I'd like the scripts to have access to a package >>that is not "installed", i.e., it is not on sys.path. >>On this list, various people have describe

disappearing documentation of `coerce`

2007-07-04 Thread Alan Isaac
Once upon a time, `coerce` was documented with the other built-ins. http://pydoc.org/1.5.2/__builtin__.html Now it is not. http://docs.python.org/lib/built-in-funcs.html Reason? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: disappearing documentation of `coerce`

2007-07-05 Thread Alan Isaac
> On 2007-07-05, Alan Isaac <[EMAIL PROTECTED]> wrote: >>Once upon a time, `coerce` was documented >>with the other built-ins. Neil Cerutti wrote: > It's now documented in Library Reference 2.2 Non-essential > Built-in Functions. > Apparently it is no longer

bool behavior in Python 3000?

2007-07-10 Thread Alan Isaac
Is there any discussion of having real booleans in Python 3000? Say something along the line of the numpy implementation for arrays of type 'bool'? Hoping the bool type will be fixed will be fixed, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: allow scripts to use .pth files?

2007-07-10 Thread Alan Isaac
s the script > that wanted to import it. Right. > I'm curious whether you think that the OP's use of ".pth" was a typo, > and whether you have read this: > http://docs.python.org/lib/module-site.html You seem to understand what I'm getting at.

Re: bool behavior in Python 3000?

2007-07-10 Thread Alan Isaac
Stargaming wrote: > I think Bjoern just wanted to point out that all those binary > boolean operators already work *perfectly*. >>> bool(False-True) True But reread Steven. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-10 Thread Alan Isaac
Bjoern Schliessmann wrote: > Is there any type named "bool" in standard Python? >>> type(True) Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Alan Isaac
ce of certain arguments, not proposing an implementation. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Alan Isaac
arithmetic. I mentioned Python 3000 since that is an opportunity for an ideal world. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Alan Isaac
> On Jul 13, 9:54 am, Matimus <[EMAIL PROTECTED]> wrote: >>num = 255 >>numlist = [num >> i & 1 for i in range(8)] Godzilla wrote: > Thanks matimus! I will look into it... Watch out for the order, which might or might not match your intent. Cheers, Ala

Re: bool behavior in Python 3000?

2007-07-12 Thread Alan Isaac
> Alan Isaac skrev: >>http://www.python.org/dev/peps/pep-0285/ Nis Jørgensen wrote: > You forgot to quote this bit: [4)] Actually not. That is a different point. Ben seems bothered by this, but not me. I do not mind that True+1 is 2. I won't do it, but I do not object to it b

Re: comparison with None

2007-04-18 Thread Alan Isaac
so be true if None always compared greater than any object, and the current behavior does not seem to be guaranteed. Is that about right? Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-18 Thread Alan Isaac
so be true if None always compared greater than any object, and the current behavior does not seem to be guaranteed. Is that about right? Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-19 Thread Alan Isaac
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Steven Howe wrote: > > Alan Isaac wrote: [type comparison stuff] > > I love scripting languages ... but sometimes an explicit evaluation that > > one would find in > > a comp

Re: comparison with None

2007-04-19 Thread Alan Isaac
an error to compare > incomparable objects. Indeed, that was the basis of my original question. I wondered why no exception was raised. Thanks, Alan Isaac PS Note that the change you mention will conflict with currently documented behavior: "objects of different types always compare

gotcha or bug? random state reset on irrelevant import

2007-04-24 Thread Alan Isaac
Running test.py will print False. Is this expected/desirable? Thanks, Alan Isaac %%% test.py %%% from random import seed, getstate seed(217) x = getstate() from test2 import Trivial y = getstate() print x == y % test2.py % from random import seed seed(314) class

Re: gotcha or bug? random state reset on irrelevant import

2007-04-24 Thread Alan Isaac
ion is: is it a good design to only be able to use seed to set a global state? (See for contrast numpy.random, for which my appreciation has just increased yet again.) Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: gotcha or bug? random state reset on irrelevant import

2007-04-24 Thread Alan Isaac
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if __name__ == "__main__": >seed(314) Thanks for this suggestion. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: gotcha or bug? random state reset on irrelevant import

2007-04-25 Thread Alan Isaac
Alex Martelli said: > What do you mean? Just instantiate the random.Random class and you can > call .seed on it as well as anything else, and no other module will > infringe on "your" module's Random instance. The "global functions" of > module random exist for those who *SPECIFICALLY* want globa

Re: Preferred Random Library

2007-04-26 Thread Alan Isaac
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > numpy.random does not implement jumpahead(). Which may be removed from the random API: http://www.python.org/dev/peps/pep-3100/#standard-library Cheers, Alan Isaac -- http://mail.python.org/mail

relative import problem

2007-04-27 Thread Alan Isaac
I'm new to relative imports and having a problem. (ValueError: Attempted relative import in non-package) I noticed this: http://www.thescripts.com/forum/thread549516.html Is this behavior intentional? I'm seeing it in Python 2.5.1. Thanks, Alan Isaac -- http://mail.python.org/mailma

relative import broken?

2007-04-28 Thread Alan Isaac
output:: Traceback (most recent call last): File "F:\temp\test1.py", line 1, in from . import test2 ValueError: Attempted relative import in non-package Why? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: relative import broken?

2007-04-29 Thread Alan Isaac
, any module that I wish to make available for execution as a script (in the usual way, with a main function) cannot have any relative imports. Is this right? What is the reason for this restriction? (And where is it documented?) Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: relative import broken?

2007-04-30 Thread Alan Isaac
ss the package modules. That is, suppose I have directory ``mypackage`` with subdirectory ``scripts``. What is the pretty way for the scripts to access ``mypackage`` without assuming ``mypackage`` is in ``sys.path``? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: relative import broken?

2007-05-01 Thread Alan Isaac
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I don't know of any "pretty" way -- I'd do it by path manipulation > (finding mypackage from os.path.abspath(__file__) and inserting its > _parent_ directory in sys.path). Yes, that seems to be the standard solution. I

Re: relative import broken?

2007-05-01 Thread Alan Isaac
> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I don't know of any "pretty" way -- I'd do it by path manipulation > > (finding mypackage from os.path.abspath(__file__) and inserting its > > _paren

Re: relative import broken?

2007-05-02 Thread Alan Isaac
a script when executed could not do imports relative to __file__. This seems like natural behavior to me. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: relative import broken?

2007-05-03 Thread Alan Isaac
t; """ To change my question somewhat, can you give me an example where this behavior (when __name__ is '__main__') would be useful for a script? (I.e., more useful than importing relative to the directory holding the script, as indicated by __file__.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

change of random state when pyc created??

2007-05-04 Thread Alan Isaac
he shell. I get result1. I execute it again; I get result2. >From then on I get result2, unless I delete module.pyc again, in which case I once again get result1. Can someone explain this to me? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-05 Thread Alan Isaac
unlikely. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-05 Thread Alan Isaac
The files are not appropriate for posting. I do not yet have a "minimum" case. But surely I am not the first to notice this! Alan Isaac PS I'll send you the files off list. -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-05 Thread Alan Isaac
ully-pure module as a > script") I'm not going to call this a bad practice, since it has clear virtues. I will say that it does not seem to be a common practice, although that may be my lack of exposure to other's code. And it still does not address the common need of playing with a "package in progress" or a "package under consideration" without installing it. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-07 Thread Alan Isaac
files. Explanation welcome!! Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-08 Thread Alan Isaac
outcome (result2) - the two outcomes are different (result1 != result2) Do you see something different than this if you run the test as I suggested? If not, how can in not involve the .pyc file (in some sense)? Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alan Isaac wrote: > There is nothing wrong with the random module -- you get the same numbers on > every run. When there is no pyc-file Python uses some RAM to create it and > therefore y

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
an ordinary users. Did this thread not demonstrate that even sophisticated users do not see into this "implication" immediately? Replicability of results is a huge deal in some circles. I think the docs for sets and dicts should include a red flag: do not use these as iterators if you w

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Actually, the root cause of Peter's specific example is the fact that the > default implementation of __hash__() and __eq__() rely on identity comparisons. > Two separate invocations of the same script give different objec

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
trary > order." If this wording is not present for sets, something to this > effect should be added. Even Robert did not claim that *that* phrase was adequate. I note that you cut off "which is non-random"! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
set.html: append a new sentence to 2nd paragraph Iteration over a set returns elements in an arbitrary order, which may depend on the memory location of the elements. fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-10 Thread Alan Isaac
>> Alan Isaac requested: >> http://docs.python.org/lib/typesmapping.html: to footnote (3), add phrase >> http://docs.python.org/lib/types-set.html: append a new sentence to 2nd paragraph "Hamilton, William " <[EMAIL PROTECTED]> wrote in message news:[EMAIL

Re: change of random state when pyc created??

2007-05-11 Thread Alan Isaac
d par. Iteration over a set returns elements in an indeterminate order, which generally depends on factors outside the scope of the containing program. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

docs patch: dicts and sets

2007-05-11 Thread Alan Isaac
python.org/lib/types-set.html: append a new sentence to 2nd par. Iteration over a set returns elements in an indeterminate order,which generally depends on factors outside the scope of the containing program. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

docs patch: dicts and sets

2007-05-15 Thread Alan Isaac
the scope of the containing program. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: docs patch: dicts and sets

2007-05-19 Thread Alan Isaac
I submitted the language based on Bill and Carsten's proposals: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1721372&group_id=5470 That language has been rejected. You many want to read the discussion and see if acceptible language still seems discoverable. Alan

Re: docs patch: dicts and sets

2007-05-20 Thread Alan Isaac
s surprised as I was. As I said, I am not attached to any language, and in fact I just used the proposals of others. I just wanted there to be some clue for users who read the docs. If you prefer to leave such users baffled, so be it. My effort is exhausted. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

create Powerpoint via com

2007-08-30 Thread Alan Isaac
Can someone point me to a simple example or better yet tutorial for creating a Powerpoint using Python. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: create Powerpoint via com

2007-08-30 Thread Alan Isaac
[EMAIL PROTECTED] wrote: > Hope that helps! Yes indeed. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: create Powerpoint via com

2007-08-30 Thread Alan Isaac
[EMAIL PROTECTED] wrote: > OK, creating bulleted lists, or tables, or adding pictures is all straightforward. How about chart creation (in Ppt 2003)? I do not see how to do this with Python. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: create Powerpoint via com

2007-08-31 Thread Alan Isaac
>>How about chart creation (in Ppt 2003)? >>I do not see how to do this with Python. [EMAIL PROTECTED] wrote: > You probably need to browse the COM object using PythonWin, which is a > part of the ActiveState distro. You can also use Python's builtin > function, dir, to find out various methods of

Re: create Powerpoint via com

2007-09-02 Thread Alan Isaac
Well, my needs were very limited so the result is too, but in case someone else just needs to get started: http://econpy.googlecode.com/svn/trunk/utilities/mso.py Comments, suggestions, additions welcom. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Any syntactic cleanup likely for Py3? And what about doc standards?

2007-09-05 Thread Alan Isaac
t pass a "self" > parameter to them. http://www.kylev.com/2004/10/13/fun-with-python-properties/ fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

announcement: OpenOpt and GenericOpt

2007-09-10 Thread Alan Isaac
OpenOpt and GenericOpt == Introducing two new optimization packages. OpenOpt and GenericOpt are 100% Python with a single dependency: NumPy. For more detail see below and also https://projects.scipy.org/scipy/scikits/wiki/Optimization> OpenOpt --- OpenOpt is new open sour

arenable in Python

2007-03-06 Thread Alan Isaac
Is the functionality of arenable http://sourceforge.net/projects/arenable/ available as a Python project? (It enables commenting features in Reader.) I am assuming the legitimacy of the arenable project. Correct me if I am wrong. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo

pylint: don't warn about tabs

2007-03-08 Thread Alan Isaac
I am brand new to pylint. As a tab user, I want the tabs warning turned off. How? Larger question: where is the config file format documented? Thanks, Alan Isaac PS This is a wonderful tool. -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
entation. I have never seen this violated. Users of spaces cannot even count on shared code being 4 rather than 8 spaces. Even though tabs when on this score, face it, in the end it is pure preference. There is no "right" answer (even for emacs users). ;-) And my actual question r

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
> Alan Isaac wrote: > > I am brand new to pylint. > > As a tab user, I want the tabs warning turned off. "Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > doc/features.txt > examples/pylintrc The example is very helpful. Thanks! Alan

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
On Fri, 9 Mar 2007, [EMAIL PROTECTED] apparently wrote: > Finally, note this from PEP 666: > The problem is that there is no polite way to say > 'Stop wasting your valuable time and mine.' > That's as politely as I can put it. I really think you should reread the PEP, which is making th

__init__ in subclass of tuple

2007-03-09 Thread Alan Isaac
st question: where should I have looked to answer these questions? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint: don't warn about tabs

2007-03-10 Thread Alan Isaac
is argument next starts up again, we can say 'Guido isn't changing things to suit the tab-haters or the only-tabbers, so this conversation is a waste of time.' Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint: don't warn about tabs

2007-03-10 Thread Alan Isaac
> Alan: >> my actual question remains unanswered... Bjoern: > --indent-string or changing a config file doesn't work for you? Works great. (I read Robert's message subsequent to that complaint.) And pylint is wonderful. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ in subclass of tuple

2007-03-10 Thread Alan Isaac
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The signature is like you said, but it's not a tuple method, it's an > object method instead: > py> tuple.__init__ > > The only important thing is that it says: of 'object' objects, not: of > 'tuple' objects. Compare with: > py> tuple.__len__ >

Putting Metaclasses to Work

2007-03-11 Thread Alan Isaac
Forman's book is out of print. Is there a good substitute? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

design question: generator object with other attributes

2007-03-22 Thread Alan Isaac
the value the object get by calling the wrapped generator. A reasonable approach? Thanks, Alan Isaac PS Here is a useless class to illustrate the basic idea that you could have both attribute access and a generator-connected ``next`` method. class Start2Stop: def __init(start,stop

Re: tuples, index method, Python's design

2007-04-07 Thread Alan Isaac
e, where the fixed set p of players have a fixed order. A tuple is natural. Now for a player you want to construct the opponents. If I had the index i it wd be p[:i]+p[i+1:], but how to get the index? Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-12 Thread Alan Isaac
at kind of a response is that?? This sounds to me like "I do not really see the point of immutability", which is no response at all. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-12 Thread Alan Isaac
;necessary"? The question is just whether we will be allowed to treat sequences that are naturally immutable as immutable or will be forced for no real reason (I believe the "code maintenance" issue has been dealt with) to treat them differently. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-12 Thread Alan Isaac
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The main point of immutability is hashability by value (rather than by id). You are treating an effect as a cause. This is the main point *because* of an artifical constraint on tuples. Cheers, Al

Re: Several images onto one 2D-plot in matplotlib?

2007-04-12 Thread Alan Isaac
http://matplotlib.sourceforge.net/screenshots.html esp http://matplotlib.sourceforge.net/screenshots/axes_demo.py hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

unpickle from URL problem

2007-10-09 Thread Alan Isaac
change the filetype to unix. I upload again. I try to unpickle from the URL. Now it works. Try it: x1, x2 = pickle.load(urllib.urlopen('http://www.american.edu/econ/notes/hw/example2')) Why the difference? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
Marc 'BlackJack' Rintsch wrote: > Pickles are *binary* files, not text files Actually not: http://docs.python.org/lib/node316.html These were created with protocol 0. But my question is about the different outcomes I observed. Thank you, Alan Isaac -- http://mail.python.org/mai

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
ects for an exercise, and I need not to worry about their directory structure.) Can you explain the differences I see? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: unpickle from URL problem

2007-10-10 Thread Alan Isaac
is also unpickles just fine on my machine, but in addition the urllib download of this file unpickles just fine. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Combinatorics

2007-10-25 Thread Alan Isaac
none wrote: > Is there some package to calculate combinatorical stuff like (n over > k), i.e., n!/(k!(n - k!) ? Yes, in SciPy. Alan Isaac >>> from scipy.misc.common import comb >>> help(comb) Help on function comb in module scipy.misc.common: comb(N, k, exact=

simple try/except question

2007-10-29 Thread Alan Isaac
Is the behavior below expected? If so, why is the exception not caught? Thanks, Alan Isaac >>> x,y='','' >>> try: x/y ... except TypeError: print 'oops' ... Traceback (most recent call last): File "", line 1, in TypeError: u

Re: simple try/except question

2007-10-29 Thread Alan Isaac
Tim Chase wrote: > It works for me(tm)... > Python 2.4.3 Sorry to have left out that detail. Yes, it works for me in Python 2.4, but not in 2.5.1. The code I posted was copyied from the interpreter. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: simple try/except question

2007-10-29 Thread Alan Isaac
False alarm. Fresh start of interpreter and all is well. Apologies. Still tracking. Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: simple try/except question

2007-10-29 Thread Alan Isaac
Gabriel Genellina wrote: > Perhaps you reassigned TypeError? Yes, that was it. Sheesh. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: generate tuples from sequence

2007-01-17 Thread Alan Isaac
dependent: http://mail.python.org/pipermail/python-list/2005-February/307550.html Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

stop script w/o exiting interpreter

2007-01-25 Thread Alan Isaac
point - comment out the last half I do not like these and assume that I have overlooked the obvious. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: stop script w/o exiting interpreter

2007-01-27 Thread Alan Isaac
my very simple goal Note that I can just put the undefined name ``stop`` on any line I want, and the script will stop execucting at that line and will return to the interactive interpreter, as I wish. It is just that it returns with an error message, and I'd like to avoid that. Than

randomly generate n of each of two types

2007-02-11 Thread Alan Isaac
else: next_type = type1 ct1 += 1 yield next_type Does this seem a good way to go? Comments welcome. Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: randomly generate n of each of two types

2007-02-11 Thread Alan Isaac
the possible shuffles of a large list, but I doubt this is easily evaded.) So as far as I can tell, this is the same approach as the original (first) solution. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: randomly generate n of each of two types

2007-02-12 Thread Alan Isaac
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>> r = [x for x in test.random_types(10)] > >>> r > [False, False, False, False, False, False, False, False, False, False, > True, True, True, True, True, True, True, True, True, True] > > I think it needs a cast to a float: Mea culpa.

PLY for standard library

2007-02-20 Thread Alan Isaac
Is PLY destined for the standard library? If not, what module providing substantially similar functionality is? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin set literal

2007-02-20 Thread Alan Isaac
oh, that must be tuple(tuple((1,2,3))), no wait ... Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >