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
"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
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
p://www.scipy.org/Cookbook )
Cheers,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
r_1_1/102-2818366-5466542?ie=UTF8&s=books>
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
yield [lst[i]]+x
else:
yield lst
hth,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
test.py rely on the user having done this?
Thank you,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
My thanks to Gabriel and Josiah.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
> 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
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
> 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
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
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.
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
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
ce of certain arguments,
not proposing an implementation.
Cheers,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
> 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
> 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
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
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
"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
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
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
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
"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
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
"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
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
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
, 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
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
"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
> "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
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
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
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
unlikely.
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
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
files.
Explanation welcome!!
Cheers,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
"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
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
"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
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
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
>> 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
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
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
the scope of the
containing program.
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
[EMAIL PROTECTED] wrote:
> Hope that helps!
Yes indeed.
Thanks!
Alan
--
http://mail.python.org/mailman/listinfo/python-list
[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
>>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
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
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
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
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
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
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
> 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
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
st question: where should I have looked
to answer these questions?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
> 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
"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__
>
Forman's book is out of print.
Is there a good substitute?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
;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
"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
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
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
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
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
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
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=
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
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
False alarm.
Fresh start of interpreter and all is well.
Apologies.
Still tracking.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
> Perhaps you reassigned TypeError?
Yes, that was it.
Sheesh.
Thanks!
Alan
--
http://mail.python.org/mailman/listinfo/python-list
dependent:
http://mail.python.org/pipermail/python-list/2005-February/307550.html
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
<[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.
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
oh, that must be tuple(tuple((1,2,3))), no wait ...
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 156 matches
Mail list logo