John Lenton added the comment:
This is the same as the previous patch, but I added the versionadded
notation in the rst, and the info in refcounts.dat to get the return
value info in the docs.
Added file: http://bugs.python.org/file9461/1945-2.diff
__
Tracker
John Lenton added the comment:
Ran the regression test with this patch, all ok (on Ubuntu Gutsy).
Attached diff is the same, with the addition of the NEWS entry.
--
nosy: +Chipaca
Added file: http://bugs.python.org/file9443/mmap3.diff
__
Tracker [EMAIL
John Lenton added the comment:
Copied documentation from the py3k branch for the functions mentioned in
the .h's (those were: PyLong_FromSsize_t, PyLong_FromSize_t,
PyLong_AsSsize_t, PyUnicode_FromStringAndSize, PyUnicode_FromString,
PyUnicode_FromFormat, and PyUnicode_FromFormatV). Tested
John Lenton added the comment:
This was fixed in r57389 by georg.brandl by changing the replacement
string '' to ' ' (turning the option into a non-option).
Steps to reproduce this on Ubuntu Feisty, before that revision, were:
$ mkdir banana
$ sudo mv /usr/include/sqlite3.h banana/
$ make clean
John Lenton added the comment:
Attached patch adds two things: an 'end' argument to find, and an
'rfind' method. This includes minimal tests for rfind, but as I actually
refactored find and rfind into a single method, tests covering find also
cover most of rfind :). I added 'end' first because
John Lenton added the comment:
New patch, with small change after being reviewed by amk. Still against
revision 60082.
Added file: http://bugs.python.org/file9223/mmap.rfind.patch
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue976880
Once again I'm working on code that has several 'providers' of
different features, and I thought I'd ask the list what better
solutions it has to this other than what I've come up with.
Currently, the cleanest way I can find is to say
import foo
foo.config(bar='baz')
# from this point on,
there is a dnotify program which is easy enough
to use, both from python or directly.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Knghtbrd 2fort5 sucks enough to have its own gravity ...
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
information doesn't fit nicely into a --verbose or
| logger -- either too little or too much information at different
| points.
dd and pppd (and probably others) solve this problem by registering
a signal handler that either toggles debug or prints status
information to stderr.
- --
John Lenton
mostly on Linux there is a bias
towards lockf given its extra capabilities there.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
¡¡ QQuuiittaa eell LLooccaall EEcchhoo,, MMaannoolloo !!
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python
))
word = lists[position]
Hi, try this:
import random
mydict={1: one, 2: two}
print mydict[random.choice(mydict.keys())]
if you're going to do that, why don't you do
print random.choice(mydict.values())
?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Quien da parte de sus
don't *think* there's
a better-than-O(n) algorithm for this.
Note that the Python version assumes that the pairs' elements are
hashable; your example used numbers, so I thought it was pretty safe
assumption. The Perl version has no such restriction.
--
John Lenton ([EMAIL PROTECTED]) -- Random
it is useful even though most times
it's a stupid way to do things (yes, Oracle, *especially* you).
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
A pencil with no point needs no eraser.
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
saw in class.
Now I'm even more worried about your dismissal of this as magic and
horrible.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Why don't you fix your little problem... and light this candle?
-- Alan Shepherd, the first man into space, Gemini program
]
# add it to list of partitions
res.append(new)
# update reverse mapping
rev[first] = rev[second] = new
# remove empty partitions
return filter(None, res)
hrmph, I should hit the sack. Sorry if this is still ugly, I'm too
tired to tell.
--
John Lenton
On Wed, Feb 16, 2005 at 10:43:42PM -0800, Michele Simionato wrote:
snip simple example with flock
What happens if for any reason the application crashes?
Locked files will stay locked or not? And if yes, how do I
unlock them?
the operating system cleans up the lock.
--
John Lenton ([EMAIL
))
?
I'd usually put big fat warnings around this code, and explain exaclty
why I need to do things this way...
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
To vacillate or not to vacillate, that is the question ... or is it?
signature.asc
Description: Digital signature
--
http
time, and delete everything.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
If our behavior is strict, we do not need fun!
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Feb 17, 2005 at 06:49:38PM +, Stephen Kellett wrote:
Next you'll be telling me the world is flat and held up by an infinite
array of tortoises.
no, of course not! It's an iterator.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Test-tube babies shouldn't throw stones
. Whats the best way of handling this? If I put it in a common
location in my Python path, should I call it willsutil.py?
local.util
is probably a convention worth starting :)
or you could go with
WilMcGugan.util
but ThatGetsOldFast.
--
John Lenton ([EMAIL PROTECTED]) -- Random
On Thu, Feb 17, 2005 at 12:42:55AM -0800, Michele Simionato wrote:
John Lenton:
the operating system cleans up the lock.
So, are you effectively saying than a custom made solution based on
flock can be quite reliable and it could be a reasonable choice to
use shelve+flock for small
On Thu, Feb 17, 2005 at 09:02:37PM -0800, Michele Simionato wrote:
John Lenton:
Also, if you use something where the process doesn't terminate between
calls (such as mod_python, I guess), you have to be sure to write the
try/finallys around your locking code, because the OS only cleans up
probably overlooking something, because it really can't
be this easy, can it?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
BOFH excuse #44:
bank holiday - system operating credits not recharged
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo
particular reason? readline
should be fine on OSX and Win32
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
sugar daddy, n.:
A man who can afford to raise cain.
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
)
stripped.append(i)
of course this won't work if you have other, non-ascii but
non-composite, chars in your strings.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
El que está en la aceña, muele; que el otro va y viene.
signature.asc
Description: Digital signature
--
http://mail.python.org
computers gives you more processing power than
buying less, multi-processor computers. So the best thing you can do
is learn to leverage some distributed computing scheme. Take a look at
Pyro, and its Event server.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
When the cup is full, carry
that if you're writing anything to do with xmms, you
stick to plain ol' gtk1?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Hemos hallado al enemigo, y somos nosotros.
-- Walt Kelly.
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python
something that uses a plugin, Eolas
sues you. Don't have to mind about trolltech
not if you live in a sane country.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Preserve wildlife -- pickle a squirrel today!
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman
method D.__new__
of course, __new__ is special-cased (*some*body should've read import
this, especially the part explicit is better than implicit).
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Al freír será el reír.
signature.asc
Description: Digital signature
--
http://mail.python.org
) wart, in fact it feels like premature
optimization (how many __new__s do you write, that you can't stick a
@staticmethod in front of them?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Fun Facts, #14:
In table tennis, whoever gets 21 points first wins. That's how
it once
exactly what you
want (and you have to go through hoops to do it otherwise). It also
can be the fastest way to do something. For example, the fastest way
to get the factorial of a (small enough) number in pure python is
factorial = lambda n: reduce(operator.mul, range(1, n+1))
--
John Lenton
On Mon, Feb 07, 2005 at 09:39:11PM +0100, Peter Otten wrote:
John Lenton wrote:
For example, the fastest way
to get the factorial of a (small enough) number in pure python is
factorial = lambda n: reduce(operator.mul, range(1, n+1))
I see
):
__metaclass__ = C
instances of D have a type that behaves as if it didn't have a
__mro__. This isn't exactly what you asked for, but it might be
enough.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
El tiempo cura los dolores y las querellas porque cambiamos. Ya no somos la
misma persona
should add a __coerce__ method to your class.
General description of __coerce__:
http://docs.python.org/ref/numeric-types.html#l2h-303
details on coercion rules:
http://docs.python.org/ref/coercion-rules.html
enjoy.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
BOFH excuse #309
On Mon, Jan 31, 2005 at 04:52:24PM +0100, Olivier Noblanc ATOUSOFT wrote:
Hello,
In the botom of this post you will see my source code.
The problem is when i launch main.py that doesn't make anything why
?
I'm guessing you don't have an __init__.py in inc/
--
John Lenton ([EMAIL
than to go around flapping your mouth
like that.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Comer se ha de hacer en silencio, como los frailes en sus conventos.
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
-in-a-file,
but is pretty straightforward. The documentation mostly refers you to
the C API, but fortunately it (the C API) is clear and well written.
HTH
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Today is National Existential Ennui Awareness Day.
signature.asc
Description: Digital
file objects don't have
methods suck as lock, stat and mmap where those calls are available
through other mechanisms...
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Yo mando a mi gato y mi gato manda a su rabo.
signature.asc
Description: Digital signature
--
http://mail.python.org
On Mon, Jan 17, 2005 at 03:20:01PM +, Antoon Pardon wrote:
Op 2005-01-17, John Lenton schreef [EMAIL PROTECTED]:
knowledgeable and experienced users know when to ignore the rules.
Then why seems there to be so few acknowledgement that these rules
may indeed be broken by users. My
the pro and cons of a mutable key solution against
an immutable key solution.
knowledgeable and experienced users know when to ignore the rules.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Una buena gran parte del arte del bien hablar consiste en saber mentir con
gracia
it be elided?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Are Linux users lemmings collectively jumping off of the cliff of
reliable, well-engineered commercial software?
-- Matt Welsh
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
If the aborigine drafted an IQ test, all of Western civilization would
presumably flunk it.
-- Stanley Garn
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
Quite frequently, I find the need to iterate over two sequences at
the
same time, and I have a bit of a hard time finding a way to do this
in a
pythonic fashion. One example is a dot product. The straight-ahead
C-like way of doing it would be:
def dotproduct(a, b):
psum = 0
for i in
Downloading, installing, and getting to know numerical modules for
Python is mext on my list :). However, I was under the impression
that
Numarray is preferred to Numeric -- is that correct? Are these two
competing packages? (Hopefully this is not flame war bait...)
Numeric's dot uses, if the
If you could help me figure out how to code a solution
that won't be a resource whore, I'd be _very_ grateful. (I'd prefer
to
keep it in Python only, even though I know interaction with a
relational database would provide the fastest method--the group I'm
trying to write this for does not
On Tue, Jan 11, 2005 at 12:33:42AM +0200, Simo Melenius wrote:
John Lenton [EMAIL PROTECTED] writes:
you probably want to look into building set-like objects ontop of
tries, given the homogeneity of your language. You should see
imrpovements both in size and speed.
Ternary search trees
: param = None) =
Class.__method__[0].__params__
import inspect
help(inspect)
HTH
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
In Greene, New York, it is illegal to eat peanuts and walk backwards on
the sidewalks when a concert is on.
signature.asc
Description: Digital signature
part of ISO 8859-1, so you can't get it that way. You can do
one of
u'\u0153'
or, if you must,
unicode(\305\223, utf-8)
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Lisp, Lisp, Lisp Machine,
Lisp Machine is Fun.
Lisp, Lisp, Lisp Machine,
Fun for everyone.
signature.asc
Description
you probably want to look into building set-like objects ontop of
tries, given the homogeneity of your language. You should see
imrpovements both in size and speed.
--
http://mail.python.org/mailman/listinfo/python-list
OpenBSD kernel.
Anyone already did something similar and/or have any recomendations?
svgalib should do what you want; I don't know if there are python
bindings for it, but they should be pretty easy to make if not.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Support wildlife
in the code that follows, instances of E haven't been through D's
rigorous initiation process
.class C(object):
.def __init__(self):
.print C
.
.class D(object):
.def __init__(self):
.print D
.super(D, self).__init__()
.
.class E(C,
51 matches
Mail list logo