up time of repeated calls represents the actual
post-initialization burden on that program. If one want to measure the
initialization time, then the cache can easily be restarted with each
call (once one knows how): fib_iter(100,_cache=[0,1])
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ts"
Actual code and traceback may help anyone to respond.
However lots of scripts
"import serial"
and then
"ser.readline(size=None, eol=chr(13))"
This would not execute. Did you mean serial.readline...?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
Good point. If one does fib(1) and wants to dump the cache without
dumping all references to the function object, one can currently do
fib_iter.__kwdefaults__['_cache'] = [0,1]
to truly reset the cache, at least with CPython.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 3/26/2011 5:55 AM, Lie wrote:
On Mar 26, 5:10 pm, Terry Reedy wrote:
On 3/26/2011 12:17 AM, Stefan Behnel wrote:
Not "restarted" in the sense that it gets cleaned up, though. The above
simply passes an explicit value for it that will be used for the single
call.
Which satisfie
ib_iter.__kwdefaults__['_cache'] = [0,1]
The point of this might be to free a cache swollen by a one-time call
with a large n, without deleting the function itself. One could then
continue with calls using normal-sized ints.
Caching is a time-space tradeoff that might need tuning to a
vert."
Don't shoot the messenger.
And what point would that be?
That you like Python and want to see it improved even further, as do I ;-).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ting exact equality
theorems or searching for a new one, exact values are necessary.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
a discussion of the meaning of 'reasonably' in this particular
case.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ed
without causing other problems. Can 8.4 and 8.5 be installed together
without problem? Does it really matter which of these I use for the
purpose of python build? If I have TclTk 8.5 installed should I only
download the 8.5 tk-dev package?
I would start with that and then make that work.
--
Terry
28: **
29:
30:
31: *****
32: ***
33: *
34:
35:
36:
37:
38:
39:
40:
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
develop banner.py with adequate tests, you will want to restart
the test anyway, and you should not need to modify much thereafter.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
hold the previous code. "reload" solves some
problems, but bring others, especially for the newcomer.
Guido removed it in 3.x because it is badly flawed and he could see any
way to sensibly fix it.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 3/30/2011 7:58 PM, Gnarlodious wrote:
On Mar 30, 9:28 am, Peter Otten wrote:
You are trying to run your 3.x code with Python 2.x...
You're right. Exactly why this started happening I don't know.
I believe recent Mac OSX comes with some 2.x installed as the default
Python.
ns have already made it the default.
Others have and will hold back.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
n, use) or
usefulness to others. For the latter, you *might* do better to help with
an existing project, such as Cython or Dufour's ShedSkin.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
7;'
Or, if you want to do it with itertools instead of the "re" module:
>>> s = "pyyythhooonnn ---> "
>>> from itertools import groupby
>>> [c*length for c, length in ((k, len(list(g))) for k, g in
groupby(s)) if length > 1]
['yy
moved, some other change would have been the worst
in this respect, and possibly the subject of a thread like this.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
zen. Even bug fixes change a defacto interface. If
you want frozon, stick with one particular release. There are lots
available.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
happy? 2to3 could probably gain a fixer to change
.sort(cmp=f) # to
import functools import cmp_to_key
.sort(key=functools.cmp_to_key(f))
I know some would not like this because interface change is not their
real concern.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/1/2011 2:44 AM, harrismh777 wrote:
Terry Reedy wrote:
Python 3 was announced and as a mildly code breaking version at least 5
years before it came out.
I appreciate the spirit of your arguments overall, and I do not
necessarily disagree with much of what you are saying. I would like to
benefits, especially in the future,
in addition to current costs.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/1/2011 7:36 AM, Austin Bingham wrote:
Is there any way to compile python (3.1.3, in case it matters) without
ssl support? OpenSSL is on my system, and configure finds it,
Can you temporarily disguise (rename) it?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
scalars
This does not say where in the expression the problem arose. to be sure
a = float(data([:,0])
b = acod(a)
c = degrees(b)
Can anyone tell me what I am doing wrong?
Numpy questions get better answers on the numpy list where numpy experts
hang out.
--
Terry Jan Reedy
--
http://mai
down the list.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
created. Why? 1. If you want to reuse a bound methods, just bind it to a
name or something and reuse it. 2. To automatically keep it for possible
reuse, which normally is not too common, it wold have to be kept in some
hidden dict which would grow indefinitely unless pruned occasionally.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ment into the output code,
when it does that particular transformation, since most of the
time there's probably a better way to write the key function.
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
f int.__div__(a,b)). I suggested that the first version in
which the old meaning was dropped should be called 3.0 to *signify that
there would be some breakage of 2.x code*.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
;class {0}Model { public bool IsModel(){ return
true; } }"
In [2]: code.format('My')
Just double the brackets, just as one doubles '\\' to get '\' in a string.
>>> "class {0}Model {{ public bool IsModel(){{ returntrue; }}
}}".format('My')
college
CS/programming courses.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
from
>Python. In crypto code (lots of 1024 bit modular exponentials) I think
>I found gmpy to be around 4x faster than Python longs.
For specialized use, specialized gmpy is the way to go.
I am curious how gmpy compares to 3.x ints (longs) with small number
calculations like 3+5 or 3*5.
like strings and bytes have. Array comes with a few, but very few,
generic sequence methods, like .count(x) (a special-case of reduction).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/4/2011 5:34 AM, Antoon Pardon wrote:
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
I posted the question to the issue.
--
Terry Jan Reedy
--
http
On 4/4/2011 9:35 AM, Lie Ryan wrote:
On 04/04/11 19:34, Antoon Pardon wrote:
On Fri, Apr 01, 2011 at 10:21:33PM -0400, Terry Reedy wrote:
rewriting cmp_to_key in C is underway
http://bugs.python.org/issue11707
Nice to know! Any chance this wil get into 2.7.x?
Python 2.7 still have
On 4/4/2011 1:14 PM, Terry Reedy wrote:
On 4/4/2011 5:23 AM, Paul Rubin wrote:
Gregory Ewing writes:
What might help more is having bytecodes that operate on
arrays of unboxed types -- numpy acceleration in hardware.
That is an interesting idea as an array or functools module patch
On 4/4/2011 1:20 PM, geremy condra wrote:
On Mon, Apr 4, 2011 at 9:41 AM, Terry Reedy wrote:
(I believe that retaining two implementations internally was considered but
rejected. Could be wrong.)
There are two implementations, grade school multiplication and
karatsuba, which kicks in after
O
fix exactly, and there is always worry that permanance enhancements may
have unforseen side effects. I will let Raymond make the call on this.
/permanance/performance/, /unforseen/unforeseen/
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ve had the same idea, so naturally I agree ;-).
I might even work on it eventually.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
uming equal library availability, absolutely.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
he web. Write
something to fetch a page (from python.org, say) and do something with
it. Try filling out the search form at bugs.python.org and extracting
the data table from the response page. Etc.
Suppose you are even move interested in xyz. <here>>
--
Terry Jan Reedy
--
http://m
.
Yes and no. They were kept slightly modified as bytes, with all of the
string methods kept.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
b/c'.split(b'/')
[b'a', b'b', b'c']
One change in 3.x is the elimination of automatic coercions between
bytes and (unicode) strings.
'a/b/c'.split(b'/')
# TypeError: Can't convert 'bytes' object to str implicitly
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
testing against each is different:
a is None; a is not None
a == ''; a != ''
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ier and to me clearer. If you do not have a
filter function, but only an expression, and would not use it again,
then (x for x in seq if expr) is faster and to me easier and clearer
than filter(lambda x: expr, seq)
Feel free to take your pick unless part of a group with code guidelines.
--
Te
, but
Victor Stinner has added a new module to Python 3.3 that tries to catch
segfaults and other fatal signals and produce a traceback before Python
disappears.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
t the exception inside the loop, it will
break the for loop and close the generator. So the error no longer
affects a single token/expression but it kills the whole session. I
guess that's because the direction flow of control is sort of
orthogonal to the direction of flow of data.
--
Te
On 4/9/2011 9:28 PM, candide wrote:
Python is very good at introspection, so I was wondering if Python (2.7)
provides any feature to retrieve the list of its keywords (and, as,
assert, break, ...).
Yes. (Look in the manuals, or try the obvious imports ;-)
--
Terry Jan Reedy
--
http
On 4/10/2011 5:12 AM, candide wrote:
Le 10/04/2011 04:01, Terry Reedy a écrit :
Yes. (Look in the manuals,
I did : my main reference book is the Martelli's /Python in a Nutshell/
You should only use that as a supplement.
and the index doesn't refer to the keyword import
a
will be faster than 'stat = zod(x,y)',
which does the same thing but adds a function call/
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
dy tried to get
what you want, and now you just need to gussy it up in an editor.
I've never used it myself, but IIRC ipython does what you want very
nicely.
Idle will save the contents of the shell window, including opening slash
line and prompts.
--
Terry Jan Reedy
--
http://mail.py
uring machines' (PTMs, section 6.2),
except that iterators (and generators by default) operate in 'pull'
mode, while they describe PTMs as operating in 'push' mode (as with
generator.send()).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
legal brief, without possibly having to pay royalties or
violate a patent.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/12/2011 12:12 PM, Aahz wrote:
In article,
Terry Reedy wrote:
Idle will save the contents of the shell window, including opening slash
line and prompts.
The problem is that normally you *don't* want the prompts. I believe
IPython handles that.
I have already had in mind that
ollow
his advice and repost this to the python-ideas list instead.
I would not. I am 99.99% sure both the syntax (introducing '?') and the
idea will be rejected.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/12/2011 2:44 PM, Dan Stromberg wrote:
On Tue, Apr 12, 2011 at 10:32 AM, Terry Reedy wrote:
On 4/11/2011 4:36 AM, rusi wrote:
http://www.cse.uconn.edu/~dqg/papers/cie05.pdf
may be of interest (and also other papers of Peter Wegner questioning
the universality of Turing machines lambda
o go about testing changes to
code
Restart from the beginning.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
verage of 4 per day. I suspect the
average time for each is at least an hour.
When I get up to speed with hg and start contributing again, I will
spend less time here.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
as outstream:
csv.writer(outstream).writerows(d.itervalues())
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ment
while x< 10:
x = x + 1;
This is another.
I can understanding wanting to rerun initialized loops with one enter,
but you cannot. Sorry.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/16/2011 3:03 AM, Alec Taylor wrote:
IDLE loses syntax highlighting annoyingly often
Could you exlain?
When does it do that with a file labelled .py?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
aries are a lot of work.
B. Security releases are primarily for servers.
C. Security releases after bugfix is over is better than nothing (the
old policy before 2.5).
D. You are welcome to pay someone to produce one for you.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
tracker. If one is
new to Python and perhaps not sure, or should not be sure, then I prefer
that one ask here for a second opinion.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
so, please advise the appropriate group.
Right place to start. If there are Centos specific issues, you might
want to look for a Centos list.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
*not* equivalent
a = 'out'
class C:
a = 'in'
def f(x=a): print(x)
C.f()
# prints 'in'
a = 'out'
class C:
a = 'in'
def f(x=a): print(x)
C.f = f
C.f()
# prints 'out'
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
code. Otherwise, delete it.
It is 26MB for me.
11 mb on windows, which is still sizable in some contexts.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/19/2011 1:33 PM, Rob McGillivray wrote:
I am trying to install from an RPM downloaded from python.org.
That puzzles me. For *nix, I do not see .rpm, just tarballs, on
http://python.org/download/releases/3.2/
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/19/2011 11:39 PM, harrismh777 wrote:
Terry Reedy wrote:
If one is new to Python and perhaps not sure, or should not be sure,
then I prefer that one ask here for a second opinion.
Thanks Terry. I am not new to Python, but I am new to Python3, and I'm
also relatively new to IDLE. Typi
ly
impenetrable jungle for a month to arrive at the well-hidden ancient
temple. Since it was itself covered in overgrowth, he hacked away
another month to reveal it in its ancient glory." Make the appropriate
substution of code jungles and hard-won prize.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/20/2011 1:15 PM, Ron wrote:
I've written an online interactive Python tutorial atop Google App Engine:
http://www.learnpython.org.
Currently giving 500 server error. Hope something clears up.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
lly? that is ancient!).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ind-the-scenes implementation details like 'method_wrapper' and
'slot_wrapper' classes, which may be CPython specific.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
e to write
the interface in Python with ctypes.
than translating snowball to
Python, which will be dog slow to interpret.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
returning from the function, g, if local, should disappear.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 4/22/2011 4:01 AM, Thomas Rachel wrote:
Am 22.04.2011 09:01, schrieb Wolfgang Rohdewald:
On Freitag 22 April 2011, Terry Reedy wrote:
When returning from the function, g, if local, should
disappear.
yes - it disappears in the sense that it no longer
accessible, but
AFAIK python makes
sting question. It seems not to be documented, so I would not
count on anything. This is a bit of a gray area, and if you get no
answer here, try pydev list, perhaps as a request that special names be
more completely documented, even is just as implementation details
subject to change.
--
Terr
fault
value Writable"
So if the following does not work in Jython 2.5
def f(a=42) :
return a
f()
# 42
f.func_defaults = (23,)
f()
# 23
then it *does* have a bug with respect to matching the Python 2.5 spec.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
n exception if the input cannot
be type cast to int?
Converted (not cast) to int or float or complex or anything else other
than strl.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
r Unicode string literals:
u'this an example language ' + u'español'
You'll probably also need to add the appropriate source file encoding
declaration; see http://www.python.org/dev/peps/pep-0263/
Or use Python 3
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
dition commented out and about 4 when
included as above, which is about what I would expect.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
months to improve the
tests, code, and docs.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
s. I have forgotten how to find it in xp, and
no idea in w7. I would look in windows help and or control panel.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
g was once standard for Fortran programs.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
Docs web site. Only
errors from there.
Syntax error? Runtime exception? or just not look/act as you expect?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
le a bug report requesting a workaround in the 2.x version.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
m in the arena. "
"By the result of competition formed top of the game. "
This is unclear. perhaps "The best will be chosen by the result of the
competition."
I see a mailto: link at the bottom of the page, so I will report
anything else I see later.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ther than as just a linear-memory machine language. A linear memory
with bytes addressed from 0 to max-int or max-long is an explicit part
of the definition of assembly languages and C. It is no part of the
definition of Python.
Nice begin-a-thread post.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
usually and at most one recursive call per call
* binary recursion: usually and at most two recursive calls per call
Fib is the best known example.
* tail recursion: base cases return completed calculations
* body recursion: base cases return starting values, often constants
--
Terr
On 5/1/2011 12:49 PM, Alexander Lyabah wrote:
And what do you think about Score Games and competitions?
The rules of the first score game were not clear to me. I could not
figure out how to play it interactively myself so I could see how it
actually played.
--
Terry Jan Reedy
--
http
rectly'? Surely not. Using 'name' rather than the hugely overloaded
tern 'variable' automatically avoids certain misunderstandings.
A good summary might be "Python manipulates objects that are accessed
through literals, names, and expressions."
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
in the unbalanced tree generated by the
recursion.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
this gives two different answers in the two cases noted above.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 5/2/2011 9:14 AM, Hans Georg Schaathun wrote:
On Sun, 01 May 2011 18:24:30 -0400, Terry Reedy
: Python does not do this automatically because 1) it can be a semantic
: change under some circumstances; 2) one who wants the iterative version
: can just as easily write it directly;
That
(= 0 implied).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 5/3/2011 2:29 AM, Gregory Ewing wrote:
Terry Reedy wrote:
The trick is that replacing x with j and evaluating therefore causes
(in Python) all the coefficients of x (now j) to be added together
separately from all the constant terms to reduce the linear equation
to a*x+b (= 0 implied
foo import var
as rav', then perhaps you would not have been so surprised that
__main__.rav and foo.var have independent fates.
You have discovered that using from x import * is a bad idea when module
x has global names that get rebound.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
chapter only
uses the simplest form of the print statement.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ir desktop, give to friends to run in a browser, and run on their
phones.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
object's id() to
the list would also suffice.
In either case, if such a module is possible, any pointers you could
provide regarding how to implement such a module would be appreciated.
I hope the above helps. I think Python is a great learning language.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
example, I only need to
tell it:
L
u
100
u
You should be able to send this through a pipe connected to the subprocess.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
initial value; or add
(or append) these values to the key." I do not see the code doing either
of these.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
the lengths of the state names.
But an average of 5/10 false positives in 5 runs is good.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
1001 - 1100 of 8116 matches
Mail list logo