Gabriel Genellina [EMAIL PROTECTED] wrote:
En Sun, 04 May 2008 12:58:25 -0300, Duncan Booth
[EMAIL PROTECTED] escribió:
Szabolcs Horvát [EMAIL PROTECTED] wrote:
I thought that it would be very nice if the built-in sum() function
used this algorithm by default. Has this been brought up
Szabolcs [EMAIL PROTECTED] wrote:
On May 5, 9:37 am, Szabolcs Horvát [EMAIL PROTECTED] wrote:
Gabriel Genellina wrote:
Python doesn't require __add__ to be associative, so this should
not be
used as a general sum replacement.
It does not _require_ this, but using an __add__ that is not
Szabolcs Horvát [EMAIL PROTECTED] wrote:
I thought that it would be very nice if the built-in sum() function used
this algorithm by default. Has this been brought up before? Would this
have any disadvantages (apart from a slight performance impact, but
Python is a high-level language
dave [EMAIL PROTECTED] wrote:
Hello,
here is a piece of code I wrote to check the frequency of values and
switch them around to keys in a new dictionary. Just to measure how
many times a certain key occurs:
def invert(d):
inv = {}
for key in d:
val = d[key]
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Thu, 01 May 2008 15:33:09 -0700, Gary Herron wrote:
Of course it's not thread safe. For the same reason and more basic,
even the expression i++ is not thread safe in C++.
Any such calculation, on modern processors, requires three
Yves Dorfsman [EMAIL PROTECTED] wrote:
On UNIX, some people use
#!/usr/bin/env python
While other use
#!/usr/bin/python
Why is one preferred over the other one ?
I don't think the answers so far have communicated what I believe to be the
important point: it isn't that one is always
chrisber [EMAIL PROTECTED] wrote:
I've poked around to see if I could delete the options my earlier code
consumed from the commandline buffer, before invoking unittest, but
that seems klugy. Instead, I hardwired in a testing config file name,
that always has to be local. That works pretty
Christian Heimes [EMAIL PROTECTED] wrote:
res = create_resource()
try:
use_resource()
finally:
res.close() # Must free resource, but the object can still be
alive...
You can replace the try/finally code with a with resource:
do_something() block if the object supporst the
George Sakkis [EMAIL PROTECTED] wrote:
On Apr 30, 5:06 am, Torsten Bronger [EMAIL PROTECTED]
wrote:
Hallöchen!
SL writes:
Gabriel Genellina [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
En Wed, 30 Apr 2008 04:19:22 -0300, SL [EMAIL PROTECTED] escribió:
And
that's a
thinkofwhy [EMAIL PROTECTED] wrote:
Try a dictionary:
def funcA(blah, blah)
def funcB(blah, blah)
def funcC(blah, blah)
functions = {'A': funcA, 'B': funcB, 'C':
funcC}
user_func = 'A'
functions[user_func] #execute function
Python has a neat concept for making
AlFire [EMAIL PROTECTED] wrote:
But I still can not believe that +=1 is not a thread safe operation.
Any clue?
The statement:
x+=1
is equivalent to:
x = x.__iadd__(1)
i.e. a function call followed by an assignment.
If the object is mutable then this *may* be safe so long
Torsten Bronger [EMAIL PROTECTED] wrote:
The biggest ugliness though is ,.join(). No idea why this should
be better than join(list, separator= ). Besides, ,.join(ux)
yields an unicode object. This is confusing (but will probably go
away with Python 3).
It is only ugly because you aren't
Torsten Bronger [EMAIL PROTECTED] wrote:
However, join() is really bizarre. The list rather than the
separator should be the leading actor.
Do you mean the list, or do you mean the list/the tuple/the dict/the
generator/the file and anything else which just happens to be an iterable
sequence
George Sakkis [EMAIL PROTECTED] wrote:
On Apr 28, 10:10 pm, [EMAIL PROTECTED] wrote:
George,
Is there an elegant way to unget a line when reading from a
file/stream
iterator/generator?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502304
That's exactly what I was looking
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote:
(FWIW, in 2.x, x=4?, it's None numbers anything else;
numbers are ordered by value, everything else is ordered
by type name, then by address, unless comparison functions
are implemented).
Quite apart from Jon pointing out
blaine [EMAIL PROTECTED] wrote:
On Apr 29, 5:32 am, Duncan Booth [EMAIL PROTECTED] wrote:
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED]
wrote:
(FWIW, in 2.x, x=4?, it's None numbers anything else;
numbers are ordered by value, everything else is ordered
by type name
Steve Holden [EMAIL PROTECTED] wrote:
Filip Gruszczyski wrote:
Just declaring, that they exist. Saying, that in certain function
there would appear only specified variables. Like in smalltalk, if I
remember correctly.
Icon has (had?) the same feature: if the local statement appeared
then
Steve Holden [EMAIL PROTECTED] wrote:
Assignment to a list *element* rebinds the single element to the
assigned value. Assignment to a list *slice* has to be of a list, and it
replaces the elements in the slice by assigned elements.
Assignment to a list *slice* just has use an iterable, it
Wilbert Berendsen [EMAIL PROTECTED] wrote:
Hi, is it possible to manipulate class attributes from within a
decorator while the class is being defined?
I want to register methods with some additional values in a class
attribute. But I can't get a decorator to change a class attribute
while
Chris [EMAIL PROTECTED] wrote:
even is closer to even.75 than even+1.25. Why should it be rounded
up ?
Because the OP wants to round values to the nearest integer. Only values of
the form 'x.5' which have two nearest values use 'nearest even' to
disambiguate the result.
See
Doran, Harold [EMAIL PROTECTED] wrote:
If these files followed a naming convention such as 1.txt and 2.txt I
can easily see how these could be parsed consecutively in a loop.
However, they are not and so is it possible to modify this code such
that I can tell python to parse all .txt files in
Janto Dreijer [EMAIL PROTECTED] wrote:
It seems eval is modifying the passed in locals/globals. This is
behaviour I did not expect and is really messing up my web.py app.
Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Jason Scheirer [EMAIL PROTECTED] wrote:
On Apr 8, 7:50 pm, John Nagle [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
Google have announced a new service called 'Google App Engine'
which may be of interest to some of the people here
OK, now we need a compatibility layer so you can move
Torsten Bronger [EMAIL PROTECTED] wrote:
So, the last question is: Under which circumstances does this
happen? It happens when you import a module which imports (directly
or indictly) the current module and which comes before the current
module in the import order while the program runs.
Berco Beute [EMAIL PROTECTED] wrote:
On Apr 9, 7:54 am, Paddy [EMAIL PROTECTED] wrote:
What else could we do to make c.l.p. of more use to the newbie whp may
also be new to usenet whilst keeping c.l.p a usefull place for all?
- Paddy.
Maybe create a usenet/google group for newbies? A
Duncan Booth [EMAIL PROTECTED] wrote:
If you use authentication then again you are tied to Google accounts (or
Google Apps accounts). For a public application that would also block
attempts to move to another platform.
Correcting myself: according to
http://code.google.com/p
goldtech [EMAIL PROTECTED] wrote:
Question1: The replace method - If a string does not have the target
replacement newstring, then newline equals oldstring? Ie. oldstring
is not changed in any way? Seems to be what I observe but just want to
confirm this.
Yes.
Question2: I'm using
Gabriel Rossetti [EMAIL PROTECTED] wrote:
we are writing an application that needs some cleanup to be done if
the application is quit, normally (normal termination) or by a signal
like SIGINT or SIGTERM. I know that the __del__ method exists, but
unless I'm mistaken there is no guarantee as
Google have announced a new service called 'Google App Engine' which may
be of interest to some of the people here (although if you want to sign
up you'll have to join the queue behind me):
From the introduction:
What Is Google App Engine?
Google App Engine lets you run your web
William Dode [EMAIL PROTECTED] wrote:
On 08-04-2008, Duncan Booth wrote:
Google have announced a new service called 'Google App Engine' which
may be of interest to some of the people here (although if you want
to sign up you'll have to join the queue behind me):
From the introduction
Steve Holden [EMAIL PROTECTED] wrote:
For a moment I thought that maybe list comprehension has its own
scope, but it doesn't seem to be so:
print [[y for y in range(8)] for y in range(8)]
print y
Does anybody understand it?
This isn't _a_ list comprehension, it's *two* list
Carl Banks [EMAIL PROTECTED] wrote:
Perhaps the advent of with blocks will help reduce this error in the
future.
Indeed, and to encourage its use I think this thread ought to include the
'with statement' form of the function:
from __future__ import with_statement
from contextlib import
[EMAIL PROTECTED] wrote:
Hi,
I found the following code on the net -
http://mail-archives.apache.org/mod_mbox/httpd-python-cvs/200509.mbox/%
[EMAIL PROTECTED]
def count(self):
-db = sqlite.connect(self.filename,
isolation_level=ISOLATION_LEVEL)
-try:
-
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Surely an A isn't equal to every other object which just happens to
have the same attributes 'a' and 'b'?
And why not ?-)
I would have thoughts the tests want to be
something like:
class A:
def __eq__(self,other):
return
Gary Herron [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
Paul Rubin http://[EMAIL PROTECTED] wrote:
Daniel Fetchinson [EMAIL PROTECTED] writes:
[ ] - Xah Lee
[ ] - castironpi
I've lost track but has it been established that they are not the
same person?
Has
Paul Boddie [EMAIL PROTECTED] wrote:
Note that the Python Cookbook says this about licensing: Except where
otherwise noted, recipes in the Python Cookbook are published under
the Python license. The link is incorrect, but I presume they mean
this licence:
http://www.python.org/psf/license/
[EMAIL PROTECTED] wrote:
Factory:
**
*
def factory(type, *p):
if type == common.databaseEntryTypes[0]:
return module1.Class1(*p);
elif type == common.databaseEntryTypes[1]:
return
xkenneth [EMAIL PROTECTED] wrote:
Now obviously, if I test an instance of either class equal to each
other, an attribute error will be thrown, how do I handle this? I
could rewrite every __eq__ function and catch attribute errors, but
that's tedious, and seemingly unpythonic. Also, I don't
Paul Rubin http://[EMAIL PROTECTED] wrote:
Daniel Fetchinson [EMAIL PROTECTED] writes:
[ ] - Xah Lee
[ ] - castironpi
I've lost track but has it been established that they are not the same
person?
Has it actually been established that castironpi is actually a person? I
thought it was
aiwarrior [EMAIL PROTECTED] wrote:
When i execute this the database doesn't get filled with anything and
the program stays running in memory for ever.
That's odd, when I execute the code you posted I just get NameError:
global name 'sqlite3' is not defined. You should always try to post the
Lie [EMAIL PROTECTED] wrote:
You're forcing your argument too much, both != and are NOT standard
mathematics operators -- the standard not-equal operator is -- and
I can assure you that both != and won't be comprehensible to non-
programmers.
My maths may be a bit rusty, but I always
[EMAIL PROTECTED] wrote:
On Mar 28, 1:57ÿam, raj [EMAIL PROTECTED] wrote:
To ankit:
Well, sort() doesn't return the sorted list. It returns None. Why not
this straightforward way?
dvals = dict.values()
dvals.sort()
print dvals
Why not sorted( dict.values() ).
If you are going to do
[EMAIL PROTECTED] wrote:
Is there a conceptual difference between
best =test[:]
and
best = [x for x in test] ?
test is a list of real numbers. Had to use the second form to avoid a
nasty bug
in a program I am writing. I have to add too that I was using psyco
in Python 2.5.1.
The
Steven D'Aprano [EMAIL PROTECTED] wrote:
I think you're confused. Or possibly I'm confused. Or both.
I think it is you, but then I could be wrong.
It seems to me that you're assuming that the OP has opened the file
for reading first, and *then* another process comes along and wants to
open
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Wed, 19 Mar 2008 12:34:34 +, Duncan Booth wrote:
By default Python on Windows allows you to open a file for reading
unless you specify a sharing mode which prevents it:
But the OP is talking about another process having opened the file
Sean DiZazzo [EMAIL PROTECTED] wrote:
In this case, there will be so few people touching the system, that I
think I can get away with having the copy be done from Unix, but it
would be nice to have a general way of knowing this on Windows.
Doesn't the CreateFile call I posted earlier do
benhoyt [EMAIL PROTECTED] wrote:
But adding each message class manually to the
dict at the end feels like repeating myself, and is error-prone. It'd
be nice if I could just create the dict automatically, something like
so:
nmap = {}
for name in dir(__thismodule__):
attr =
[EMAIL PROTECTED] wrote:
I am puzzled by the failure on 'a in a' for a=[a]. a== [a] also
fails. Can we assume/surmise/deduce/infer it's intentional?
It may be less confusing if instead of an assignment following by a test
you just consider doing the test at the same time as the assignment
Steven D'Aprano [EMAIL PROTECTED] wrote:
This whole approach
assumes that Windows does the sensible thing of returning a unique
error
code when you try to open a file for reading that is already open for
writing.
So how would you use a file to share data then?
By default Python on
David C. Ullrich [EMAIL PROTECTED] wrote:
os.system('say hello')
says 'hello'.
Is there something similar in Windows and/or Linux?
(If it's there in Linux presumably it only works if there
happens to be a speech engine available...)
Perhaps http://www.mindtrove.info/articles/pytts.html
Changes by Duncan Booth [EMAIL PROTECTED]:
--
nosy: +duncanb
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2417
__
___
Python-bugs-list mailing list
Unsubscribe
Stargaming [EMAIL PROTECTED] wrote:
On Mon, 17 Mar 2008 16:03:19 +, Duncan Booth wrote:
For the answer I actually want each asterisk substitutes for exactly one
character.
Played around a bit and found that one:
Python 3.0a3+ (py3k:61352, Mar 12 2008, 12:58:20)
[GCC 4.2.3 20080114
Sean DiZazzo [EMAIL PROTECTED] wrote:
On windows, this returns the size of the file as it _will be_, not the
size that it currently is. Is this a feature? What is the proper way
to get the current size of the file? I noticed
win32File.GetFileSize() Does that behave the way I expect?
[EMAIL PROTECTED] wrote:
On Mar 17, 1:31 pm, Duncan Booth [EMAIL PROTECTED]
wrote:
A common explanation for this is that lists are for homogenous
collections, tuples are for when you have heterogenous
collections i.e. related but different things.
I interpret this as meaning
Tom Stambaugh [EMAIL PROTECTED] wrote:
For example, the new (!) simplejson (v1.7.4) doesn't compile correctly
(on my WinXP system, at least) with either any current MS or MinGW
compiler. Oh, I know I can make it work if I spend enough time on it
-- but the binary egg I eventually found seems
Diez B. Roggisch [EMAIL PROTECTED] wrote:
Which is exactly what happens - the actual implementation chose to cache
some values based on heuristics or common sense - but no guarantees are
made in either way.
Here's a puzzle for those who think they know Python:
Given that I masked out part of
[EMAIL PROTECTED] wrote:
a = 1
b = 1
a is b
True
id(a)
10901000
id(b)
10901000
Isn't this because integers up to a certain range are held in a single
memory location, thus why they are the same?
Yes, in *some* implementations of Python this is exactly what happens. The
exact
[EMAIL PROTECTED] wrote:
What are the considerations in choosing between:
return [a, b, c]
and
return (a, b, c) # or return a, b, c
A common explanation for this is that lists are for homogenous
collections, tuples are for when you have heterogenous collections i.e.
related
Ninereeds [EMAIL PROTECTED] wrote:
On Mar 17, 1:31 pm, Duncan Booth [EMAIL PROTECTED] wrote:
A common explanation for this is that lists are for homogenous
collections, tuples are for when you have heterogenous collections i.e.
related but different things.
I interpret this as meaning
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Mon, 17 Mar 2008 10:40:43 +, Duncan Booth wrote:
Here's a puzzle for those who think they know Python:
Given that I masked out part of the input, which version(s) of Python
might give the following output, and what might I have replaced
Stargaming [EMAIL PROTECTED] wrote:
On Mon, 17 Mar 2008 10:40:43 +, Duncan Booth wrote:
Here's a puzzle for those who think they know Python:
Given that I masked out part of the input, which version(s) of Python
might give the following output, and what might I have replaced
Stargaming [EMAIL PROTECTED] wrote:
On Mon, 17 Mar 2008 16:03:19 +, Duncan Booth wrote:
For the answer I actually want each asterisk substitutes for exactly one
character.
Played around a bit and found that one:
Python 3.0a3+ (py3k:61352, Mar 12 2008, 12:58:20)
[GCC 4.2.3 20080114
Matthew Woodcraft [EMAIL PROTECTED] wrote:
In article [EMAIL PROTECTED],
Duncan Booth [EMAIL PROTECTED] wrote:
I don't have a copy of 1.4 to check so I'll believe you, but you can
certainly get the output I asked for with much more recent versions.
For the answer I actually want each
santhosh kumar [EMAIL PROTECTED] wrote:
I have text like ,
STRINGTABLE
BEGIN
ID_NEXT_PANECambiar a la siguiente sección de laventana
\nSiguiente sección
ID_PREV_PANERegresar a la sección anterior de
laventana\nSección anterior
END
STRINGTABLE
BEGIN
Paul Rubin http://[EMAIL PROTECTED] wrote:
Terry Reedy [EMAIL PROTECTED] writes:
| I don't see what's so inefficient about it necessarily.
The key function is called once per list item, for n calls total.
The comparision function is called once per comparision. There are
at least n-1
Mensanator [EMAIL PROTECTED] wrote:
On Mar 10, 10:44¨«pm, Nathan Pinno [EMAIL PROTECTED] wrote:
Why does my compiler say invalid syntax and then highlight the
quotation marks in the following code:
# This program is to find primes.
Needs work.
Be fair. The OP hadn't managed to figure
Neil Crighton [EMAIL PROTECTED] wrote:
I'm using the zipfile library to read a zip file in Windows, and it
seems to be adding too many newlines to extracted files. I've found
that for extracted text-encoded files, removing all instances of '\r'
in the extracted file seems to fix the problem,
[EMAIL PROTECTED] wrote:
Hello!
We are thinking about writing a project for several customers in
Python. This project would include (among others) wxPython, a C/C++
module. But what happens if this application generates a segmentation
fault on a customers PC. What changes do we have to
Stefan Behnel [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
I would start by ensuring that any DLLs you write are written using
Pyrex or Cython: almost always problems with C libraries called from
Python are due to faulty reference counting but if you keep all of
your Python related code
Malcolm Greene [EMAIL PROTECTED] wrote:
New to Python and looking for a template library that allows Python
expressions embedded in strings to be evaluated in place. In other
words
something more powerful than the basic %(variable)s or $variable
(Template) capabilities.
I know that some
Jules Stevenson [EMAIL PROTECTED] wrote:
Hello,
Apologies if the terminology in this email is a little incorrect, I'm
still finding my feet.
I'm using python to generate some script for another language (MEL, in
maya, specifically expressions). Maya runs python too, but
unfortunately
Michael Torrie [EMAIL PROTECTED] wrote:
poof65 wrote:
An idea, i don't know if it will work in your case.
for x in xrange(10):
funcs.append(lambda p,z=x: testfunc(z+2,p))
Good idea. I will try it. I also figured out a way to architecture my
program differently to avoid this problem.
Peter Otten [EMAIL PROTECTED] wrote:
Peter Otten wrote:
Both Python 2.4 and 2.5 don't clean up properly here. Why is this?
Aren't classes supposed to be garbage-collected?
The reference keeping the classes alive is probably
object.__subclasses__():
class A(object): pass
...
sum(1
[EMAIL PROTECTED] wrote:
My parser has found an expression of the form CONSTANT_INTEGER
OPERATOR CONSTANT_INTEGER. I want to fold this into a single
CONSTANT_INTEGER.
The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc.
In C I'd put functions Add, Subtract, ... into an
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Sun, 24 Feb 2008 21:13:08 -0500, Terry Reedy wrote:
| I even use named anonymous functions *cough* by assigning lambda
|
functions to names:
|
| foo = lambda x: x+1
Even though I consider the above to be clearly inferior to
def foo(x):
Steven D'Aprano [EMAIL PROTECTED] wrote:
but if
you pass functions/lambdas around a lot it can be frustrating when you
get an error such as:
TypeError: lambda() takes exactly 2 arguments (1 given)
and the traceback only tells you which line generated the TypeError, not
which lambda
Jeff Schwab [EMAIL PROTECTED] wrote:
a += b
Whether a refers to the same object before and after that statement
depends on what type of object it referred to before the statement.
Yes but the rule followed by the builtin types is pretty simple: if 'a' can
still refer to the same object
Carl Banks [EMAIL PROTECTED] wrote:
Some Pythonistas will swear to their grave and back that should be
done by factoring out the tests into a list and iterating over it, and
NO OTHER WAY WHATSOEVER, but I don't buy it. That's a lot of
boilerplate--the very thing Python is normally so good at
Stef Mientki [EMAIL PROTECTED] wrote:
hello,
I wonder if anyone has (good ;-) experiences with Python on a PDA ?
And if so,
- what OS
- what GUI
thanks,
Stef Mientki
I haven't done much programming yet on my Nokia n810, but a lot of the
community software for it is written in
James Newton [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
you can create additional module instances (by calling new.module)
Hi Duncan,
Could you provide a scenario where this would be useful (and the best
practice)?
Not really as such cases are few and far between. Try grepping
[EMAIL PROTECTED] wrote:
I had a global variable holding a count. One source Google found
suggested that I wouldn't need the global if I used an object. So I
created a Singleton class that now holds the former global as an
instance attribute. Bye, bye, global.
But later I thought about it.
James Newton [EMAIL PROTECTED] wrote:
Perhaps my real question is about how to visualize a module: what makes
an imported module different from an instance?
On one level: nothing. An imported module is an instance of the module
type. Modules don't have to be associated with python code: you
Jorge Vargas [EMAIL PROTECTED] wrote:
I was thinking having a base class like Bunch
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308 and on
top of that keeping a list of the keys and pop/push to the list when
adding/deleting items. I don't like this idea because I'll have to
Steven D'Aprano [EMAIL PROTECTED] wrote:
# Untested
def flattendict(d):
def gen(L):
return (x for M in exp(L) for x in rec(M))
def exp(L):
return (L+list(kv) for kv in L.pop().iteritems())
def rec(M):
return gen(M) if isinstance(M[-1],dict) else [M]
Jarek Zgoda [EMAIL PROTECTED] wrote:
Is that true assumption that __del__ has the same purpose (and same
limitations, i.e. the are not guaranteed to be fired) as Java finalizer
methods?
One other point I should have mentioned about __del__: if you are running
under Windows and the user hits
Jarek Zgoda [EMAIL PROTECTED] wrote:
Ken napisa³(a):
The good news is that you almost never have to do anything to clean up.
My guess is that you might not even need to overload __del__ at all.
People from a C++ background often mistakenly think that they have to
write destructors when
Berwyn [EMAIL PROTECTED] wrote:
Is it just me that thinks __init__ is rather ugly? Not to mention
if __name__ == '__main__': ...?
That ugliness has long been my biggest bugbear with python, too. The
__name__ == '__main__' thing is something I always have to look up,
every time I use it,
Jarek Zgoda [EMAIL PROTECTED] wrote:
Duncan Booth napisa³(a):
Pretty much. If you have a __del__ method on an object then in the
worst case the only thing that can be guaranteed is that it will be
called zero, one or more than one times. (Admittedly the last of
these only happens if you
Nick Craig-Wood [EMAIL PROTECTED] wrote:
[__main__.Y object at 0xb7d9fc8c, __main__.Y object at 0xb7d9fcac,
__main__.Y object at 0xb7d9fc2c] [__main__.Y object at 0xb7d9fc8c]
(It behaves slightly differently in the interactive interpreter for
reasons I don't understand - so save it to a
Adam W. [EMAIL PROTECTED] wrote:
I am trying to handle a Unicode error but its acting like the except
clause is not even there. Here is the offending code:
def characters(self, string):
if self.initem:
try:
Paul Rubin http://[EMAIL PROTECTED] wrote:
Brett Cannon [EMAIL PROTECTED] writes:
The Python Software Foundation's infrastructure committee is looking
for volunteers to help maintain the Roundup issue tracker installed
for http://bugs.python.org. Responsibilities revolve around
maintaining
Boris Borcic [EMAIL PROTECTED] wrote:
Arnaud Delobelle wrote:
Whereas when 3.0*1.0 is 3.0 is evaluated, *two* different float
objects are put on the stack and compared (LOAD_CONST 3 / LOAD_CONST
1 / COMPARE_OP 8). Therefore the result is False.
Looks good, but doesn't pass the sanity check
7stud [EMAIL PROTECTED] wrote:
On Feb 18, 4:53 am, 7stud [EMAIL PROTECTED] wrote:
On Feb 18, 3:20 am, William Heymann [EMAIL PROTECTED] wrote:
How do I decode a string back to useful unicode that has xml
numeric cha
racter
references in it?
Things like #21344; #which is: _#21344_;
Tobiah [EMAIL PROTECTED] wrote:
Subject: Seemingly odd 'is' comparison.
Please put your question into the body of the message, not just the
headers.
print float(3.0) is float(3.0)
True
print float(3.0 * 1.0) is float(3.0)
False
Thanks,
Tobiah
Your values are already all
Boris Borcic [EMAIL PROTECTED] wrote:
It is more elementary in the mathematician's sense, and therefore
preferable all other things being equal, imo. I've tried to split
'gen' but I can't say the result is so much better.
def flattendict(d) :
gen = lambda L : (x for M in exp(L) for
Bruno Desthuilliers [EMAIL PROTECTED]
wrote:
I Must have miss something...
Perhaps you missed the part where Christian said The tp_print slot is not
available from Python code?
--
http://mail.python.org/mailman/listinfo/python-list
Christian Heimes [EMAIL PROTECTED] wrote:
Bruno Desthuilliers wrote:
I Must have miss something...
Yeah, You have missed the beginning of the third sentence: The
tp_print
slot is not available from Python code. The tp_print slot is only
available in C code and is part of the C definition
Jeff Schwab [EMAIL PROTECTED] wrote:
Christian Heimes wrote:
Dennis Lee Bieber wrote:
What's wrong with just
str(0.3)
that's what print invokes, whereas the interpreter prompt is using
repr(0.3)
No, print invokes the tp_print slot of the float type. Some core types
thebjorn [EMAIL PROTECTED] wrote:
I'm not sure which Python is default for Ubuntu 6.06, but assuming you
can access a recent one (2.4), the list.sort() function takes a key
argument (that seems to be rather sparsely documented in the tutorial
and the docstring...). E.g.:
lst =
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Mon, 04 Feb 2008 13:57:39 +0100, AMD wrote:
The problem I have under windows is that as soon as I get to 500 files I
get the Too many open files message. I tried the same thing in Delphi
and I can get to 3000 files. How can I increase the number
601 - 700 of 1755 matches
Mail list logo