[EMAIL PROTECTED] wrote:
Sorry Fredrik but I don't understand. Just comment out the assert and
you have different results depending on whether an unrelated sort
function is defined.
This seems weird to me !
Perhaps you don't understand what's going on. The test
obj in excluded
is
If you google a bit on the newsgroup, you should find a message
from me asking about the ability to subclass FunctionType, and
a reply from Tim Peters saying that the only reason why this
was not done is lack of developer time and the fact that this was
not considered an important priority.
You just said let's
introduce something like any. I showed you existing implementations of
such a concept that have problems.
But as far as I can see that is a problem of the implementation
not necessarily of the concept.
Without any concept, sure there can't be problems with that
I understand this, Steve.
I thought the _cmp_ method was a helper for sorting purposes. Why is it
that a membership test needs to call the __cmp__ method?
If this isn't a bug, it is at least unexpected in my eyes.
Maybe a candidate for inclusion in the FAQ?
Thank you for answering
Alain
--
Joshua Ginsberg wrote:
Try this one:
d = {}
for x in [1,2,3]:
... d[x] = lambda *args: args[0]*x
...
d[1](3)
try it with:
d[x] = (lambda x=x: (lambda *args: args[0]*x))()
the outer lambda fixes the value of x and produces the inner lambda
with the fixed x value
--eric
--
[EMAIL PROTECTED] wrote:
Sorry Fredrik but I don't understand. Just comment out the assert and
you have different results depending on whether an unrelated sort
function is defined.
This seems weird to me !
not if you look at what it prints.
(if it seems weird to you that 0 equals 0, it's
sqlite worked perfectly, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards [EMAIL PROTECTED]
wrote:
For example: In British English one uses a plural verb when the
subject consists of more than one person. Sports teams,
government departments, states, corporations etc. are grammatically
On 2005-10-07, DaveM [EMAIL PROTECTED] wrote:
For example: In British English one uses a plural verb when the
subject consists of more than one person. Sports teams,
government departments, states, corporations etc. are
grammatically plural. In American, the verb agrees with the
word that is
Your __cmp__ method will always return 0, so all objects will be equal
when you add the method, as Simon and Steve pointed out. The result is
all objects will pass the test of being a member of excluded.
If you do not add a __cmp__ method objects will be compared on identy -
call the id() function
Your __cmp__ method will always return 0, so all objects will be equal
when you add the method, as Simon and Steve pointed out. The result is
all objects will pass the test of being a member of excluded.
If you do not add a __cmp__ method objects will be compared on identy -
call the id() function
Christophe wrote:
I mean, why not ? Why does the compiler let me do that when you know
perfectly that that code is incorrect :
def f():
return a + 5
probably because the following set is rather small:
bugs caused by invalid operations involving only literals, that are not
Mike Meyer [EMAIL PROTECTED] writes:
When you want local variable in lisp you do :
(let ((a 3)) (+ a 1))
Excep that's not a decleration, that's a binding. That's identical to
the Python fragment:
a = 3
return a + 1
except for the creation of the new scope. Not a
On 2005-10-07, Steve Holden [EMAIL PROTECTED] wrote:
In sports (thats sport for you Brits):
OK, so how do you account for the execresence That will give you a
savings of 20%, which usage is common in America?
Dunno. Like much else in English (both American and British)
that's just the way
Michele Simionato [EMAIL PROTECTED] writes:
If you google a bit on the newsgroup, you should find a message
from me asking about the ability to subclass FunctionType, and
a reply from Tim Peters saying that the only reason why this
was not done is lack of developer time and the fact that this
How about Lisp? It seems to do some good there, without getting in
the way.
I don't know much about lisp. But the thing is that one of the most
important data structures in python (and basically the only one in
LISP), lists, are a big problem to type-checking if they aren't
homogenous. So I
Lasse Vågsæther Karlsen [EMAIL PROTECTED] wrote:
Thanks, that looks like Mike's solution except that it uses the
built-in heapq module.
This make a big difference for the algorithmic complexity; replacing an item in
a heap is much more
efficient than sorting the whole list.
While this one
On 2005-10-07, Roel Schroeven [EMAIL PROTECTED] wrote:
... It is unknown how many pythons are competing with the thousands of
alligators in the Everglades, but at least 150 have been captured in
the past two years ...
When I read the title 'Python vs. Alligator' on Slashdot, I
thought it
[EMAIL PROTECTED] wrote:
Why is it that a membership test needs to call the __cmp__ method?
because the membership test has to check if the tested item is a member
of the sequence. if it doesn't do that, it's hardly qualifies as a membership
test. from the reference manual:
For the list
In fact, i want to sort the list based on the 'allocated attribute' and
at the same time, test membership based on the id attribute.
__cmp__ logically implies an ordering test, not an identity test. These
two notions seems to be confounded in python which is unfortunate. Two
objects could have the
I am using SWIG to wrap a C application for use in Python.
C code
==
// returns a pointer to an array of long values in the string, input
// MY_DIGIT is a typedef such as, typedef unsigned long MY_DIGIT;
MY_DIGIT *Split(char *input) { ... }
..I build a DLL named, _MyApp.dll
SWIG interface
For this, you can also define the __eq__ method, which will be
preferred to __cmp__ for equallity tests while still using __cmp__ for
searching / comparisons.
--
http://mail.python.org/mailman/listinfo/python-list
sqlite worked perfectly, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Friday 07 October 2005 08:56, Eric Nieuwland wrote:
Ever cared to check what committees can do to a language ;-)
*has nasty visions of Java*
Hey! Stop that!
- Michael
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2005-10-07 at 10:33, [EMAIL PROTECTED] wrote:
In fact, i want to sort the list based on the 'allocated attribute' and
at the same time, test membership based on the id attribute.
__cmp__ logically implies an ordering test, not an identity test. These
two notions seems to be confounded
On 07/10/05, Eric Nieuwland [EMAIL PROTECTED] wrote:
Ever cared to check what committees can do to a language ;-)
+1 QOTW.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
In fact, i want to sort the list based on the 'allocated attribute' and
at the same time, test membership based on the id attribute.
__cmp__ logically implies an ordering test, not an identity test. These
two notions seems to be confounded in python which is
Test for the existence of one or more matches of the wildcard
expression.
For example:
Are there any files that begin with 2005?
This doesn't work (wish it did):
os.access('2005*',os.F_OK)
However, these work arounds do the job:
glob.glob('2005*')==[]
as does this bash command:
[EMAIL PROTECTED] wrote:
Sorry Fredrik but I don't understand. Just comment out the assert and
you have different results depending on whether an unrelated sort
function is defined.
This seems weird to me !
code snippet:
from random import choice
class OBJ:
def
[EMAIL PROTECTED] wrote:
In fact, i want to sort the list based on the 'allocated attribute' and
at the same time, test membership based on the id attribute.
__cmp__ logically implies an ordering test
really?
http://dictionary.reference.com/search?q=compare
com·pare
v. com·pared,
Test for the existence of one or more matches of the wildcard
expression.
For example:
Are there any files that begin with 2005?
This doesn't work (wish it did):
os.access('2005*',os.F_OK)
However, these work arounds do the job:
glob.glob('2005*')==[]
as does this bash command:
I am having a hard time in finding out how to retrieve information
about
the *size* of files I want to download from an FTP site. Should I
send a QUOTE SIZE command to the ftp server or is there an easier way?
TIA,
Michele Simionato
--
I have written a python socketServer program and I have a few questions
that I hope the group can answer... here is a simple version of the
server:
class tr_handler(SocketServer.StreamRequestHandler):
def handle(self):
data = self.rfile.readline(300)
data =
How about doing an 'ls -la' once you have connected to the server? That
returns a listing of the files with the size in bytes.
-Original Message-
From: Michele Simionato
I am having a hard time in finding out how to retrieve information about the
*size* of files I want to download from
No doubt you're right but common sense dictates that membership testing
would test identity not equality.
This is one of the rare occasions where Python defeats my common sense
;-(
Alain
--
http://mail.python.org/mailman/listinfo/python-list
mike wrote:
Test for the existence of one or more matches of the wildcard
expression.
why are you reposting variations of your question (in duplicates)
instead of reading the replies? that's not a good way to pass the
turing test.
/F
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
No doubt you're right but common sense dictates that membership testing
would test identity not equality.
This is one of the rare occasions where Python defeats my common sense
But object identity is almost always a fairly ill-defined concept.
Consider this (Python
Terry Hancock wrote:
GvR's syntax has the advantage of making grammatical sense in English (i.e.
reading it as written pretty much makes sense).
as a native Python speaker, I find that argument being remarkably weak. things
I write in Python should make sense in Python, not in some other
Grant Edwards wrote:
On 2005-10-07, Steve Holden [EMAIL PROTECTED] wrote:
[...]
Then again, what can you expect from a country whose leader
pronounces nuclear as though it were spelled nucular?
Don't get me started on _that_ one. I found it particularly
horrifying that Jimmy Carter
Michele Simionato wrote:
I am having a hard time in finding out how to retrieve information
about the *size* of files I want to download from an FTP site. Should I
send a QUOTE SIZE command to the ftp server or is there an easier way?
SIZE isn't a standard FTP command, so that only works for
dude, you are the sap that wrote it's not clear. get a life.
--
http://mail.python.org/mailman/listinfo/python-list
Hm, you didn't include a link and my google did not find the final
results.
The results are fluctuating very much. This suggests a small number of
votes. Linux Journal may be a big magazine, but i don't think language
opinions change that fast.
The vote is all done by email this year, which is
What are you developing for?
You could write another small python scripts, which calls your script.
os.system(python yours.py --param Ünicöde)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
No doubt you're right but common sense dictates that membership testing
would test identity not equality.
what does common sense have to say about this case:
L = (aa, bb, cc, dd)
S = a + a
L
('aa', 'bb', 'cc', 'dd')
S
'aa'
S in L
# True or False ?
/F
--
rbt [EMAIL PROTECTED] writes:
1. Do I need to use threads to handle requests, if so, how would I
incorporate them? The clients are light and fast never sending more
than 270 bytes of data and never connecting for more than 10 seconds
at a time. There are currently 500 clients and potentially
mike wrote:
dude, you are the sap that wrote it's not clear.
followed by three possible solutions to the stated problem, one
of which was marked as most likely.
get a life.
oh, sorry for wasting my time. can I *plonk* you now?
/F
--
http://mail.python.org/mailman/listinfo/python-list
I'm not sure how to do this, or where to start looking for the right
information, so any advice would be appreciated.
I want to implement a class with two (or more) different ways of looking
at its attributes.
One example of this might be complex numbers, which can be written in
Cartesian form
Steven D'Aprano wrote:
It is important that there are no privileged attributes, e.g. in the
above example, I can set any of x, y, z, r, theta or phi and all the
others will automatically reflect the changes.
http://users.rcn.com/python/download/Descriptor.htm#properties
/F
--
Lasse Vågsæther Karlsen wrote:
Ok, that one looks more sleak than what I came up with.
Couple of things I learn from your solution, please correct me if I
misunderstood something:
1. list containing other lists will sort itself based on first element
on lists inside ?
Correct, comparison is
I'm trying to run a Python program on Unix and I'm encountering some
behavior I don't understand. I'm a Unix newbie, and I'm wondering if
someone can help.
I have a simple program:
#! /home/fergs/python/bin/python
import sys, os
import cx_Oracle
Alex Willmer wrote:
I'm trying to track down the name of a file format and python module,
that was featured in the Daily Python URL some time in the last month or
two.
http://www.netpromi.com/kirbybase.html ?
/F
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano [EMAIL PROTECTED] writes:
Anyone have any good ideas for how I should implement this?
These days you can use properties. Before, you'd have had to do it
manually with __setattr__ / __getattr__ methods. Here's how I'd do it
with properties, if I have the math right. You're
dear all,
i'm an astronomer working with 2d images -- 2d numarrays. i have a
script which basically does some operations on some images, and one of
the first steps is to find a galaxy on an image (at, say, a known x,y
coord), and create a sub-image by slicing out part of the larger array
to
Steve wrote:
I'm trying to run a Python program on Unix and I'm encountering some
behavior I don't understand. I'm a Unix newbie, and I'm wondering if
someone can help.
I have a simple program:
#! /home/fergs/python/bin/python
import sys, os
On Oct 07, Steve wrote:
I have a simple program:
#! /home/fergs/python/bin/python
import sys, os
import cx_Oracle
If I run it through the Python interpreter, this way:
python test.py
it
Steve wrote:
I'm trying to run a Python program on Unix and I'm encountering some
behavior I don't understand. I'm a Unix newbie, and I'm wondering if
someone can help.
If I run it through the Python interpreter, this way:
python test.py
it runs fine.
But if I try to run it as an
Eric Nieuwland wrote:
Ever cared to check what committees can do to a language ;-)
well there goes democracy :(
-the happy slaves eat and are contented-ly yrs-
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list
Hi!!
I am working on a school project and I decided to use PythonCard and
wxPython for my GUI development. I need a password window that will
block unwanted users from the system. I got the pop-up password
question to work...
def on_openBackground(self, event):
result =
No need to apologize for continuing to waste your
time, self.plonk. Get a life, though, and you'll be happier.
As to your question, well, not before you apologize for
thread crapping.
As for your possible solutions, if you consider any
of yours to be readable, then i have no interest in
coding
Hi,
I've looked at a lot of pages on the net and still can't seem to nail
this. Would someone more knowledgeable in regular expressions please
provide some help to point out what I'm doing wrong?
I am trying to see if a web page contains the exact text:
You have found 0 matches
But instead I
Perhaps it would be nice if they could include in the python documents
a link to download a sample code, the one that they were building in
the whole program, or at least a page that puts it all together? I get
a much better idea of how thing work when they are all put together
personally, and
mike [EMAIL PROTECTED] writes:
Test for the existence of one or more matches of the wildcard
expression.
For example:
Are there any files that begin with 2005?
This doesn't work (wish it did):
os.access('2005*',os.F_OK)
I would considering it suprising if it worked. os.access
On 7 Oct 2005 10:35:22 -0700, GregM [EMAIL PROTECTED] wrote:
Hi,
I've looked at a lot of pages on the net and still can't seem to nail
this. Would someone more knowledgeable in regular expressions please
provide some help to point out what I'm doing wrong?
I am trying to see if a web page
GregM wrote:
I am trying to see if a web page contains the exact text:
You have found 0 matches
It is unclear to me why you're using a regex at all. If you want to
find the *exact* text You have found 0 matches perhaps you should do
something like this:
if You have found 0 matches in
GregM [EMAIL PROTECTED] writes:
I've looked at a lot of pages on the net and still can't seem to nail
this. Would someone more knowledgeable in regular expressions please
provide some help to point out what I'm doing wrong?
I am trying to see if a web page contains the exact text:
You have
Nicholas,
Have you looked at Octave? It is not Python, but I believe it can talk
to Python.
Octave is comparable to Matlab for many things, including having ODE
solvers. I have successfully used it to model and simulate simple
systems. Complex system would be easy to model as well, provided that
I did which python and the two paths were different. Once I fixed
the path in the script, it worked fine.
Thanks Frederik and Micah!
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
rbt [EMAIL PROTECTED] writes:
1. Do I need to use threads to handle requests, if so, how would I
incorporate them? The clients are light and fast never sending more
than 270 bytes of data and never connecting for more than 10 seconds
at a time. There are currently 500 clients
On Fri, 07 Oct 2005 14:24:42 -, Grant Edwards [EMAIL PROTECTED]
wrote:
On 2005-10-07, Steve Holden [EMAIL PROTECTED] wrote:
[...]
Some village in Texas are missing their idiot
At least that one is consistent, though it sounds wrong to US
ears.
The Germans have a word for it (sounds
Paul Rubin wrote:
Steven D'Aprano [EMAIL PROTECTED] writes:
class Parrot(object):
x = property(getx, setx)
y = property(gety, sety)
def getx(self):
return self.a + self.b
def setx(self, x):
y = self.y # calls gety
self.a, self.b = 2*x - y, y-x
def
jeg wrote:
dear all,
i'm an astronomer working with 2d images -- 2d numarrays. i have a
script which basically does some operations on some images, and one of
the first steps is to find a galaxy on an image (at, say, a known x,y
coord), and create a sub-image by slicing out part of the
It is available as PDF from the editor ... Manning. In my recollection
for 25 USD
projecktzero wrote:
striker wrote:
Does anyone who has this book willing to sell it. Please e-mail me the
condition and any other details if you are interested.
Thanks,
Kevin
half.com has a couple of
Do you have a simple program that demonstrates the problem?
I have an x86 machine with Python 2.3, and an x86_64 machine with Python 2.4
available. I wrote a simple test program which performs a slice operation,
but it behaves the same on both platforms.
Here's the program:
This may be a simple question to answer, but is there any module that
will let you authenticate against a SMB server? An equivalent
package in perl would be the Authen::SMB. That is the realms of
what I am looking for, but in Python.
-Derek Perriero-- Perriero, Derek[EMAIL PROTECTED]
--
Steve Holden wrote:
Consider:
a = {1:'one'}
b = {2:'two'}
c = {1:'one'}
a is c
False
a in [b, c]
True
What would you have Python do differently in these circumstances?
You mean: What i would do i if i was the benevolent dictator ?
I would make a distinction between mutables and
Yeah, that's what I meant. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
After exploring the bug database I discovered that this bug has been
reported since March, and appears to derive from a bug in Python
itself.
http://bugs.activestate.com/show_bug.cgi?id=38052
It apparently only happens when the code generated by Makepy is really
big (which it is for Word or
Hi
thanks to all of you. Mike I like your committee idea. where can I
join? lol
Greg.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I want to have two loggers that logs to two different files. Here is
what I have:
import logging
import logging.handlers
project1Handler = logging.handlers.RotatingFileHandler( 'project1.log',
maxBytes=1024)
project1Handler.setLevel(logging.INFO)
formatter1 = logging.Formatter('%(name)-12s:
I just threw this together because I find myself needing it now and
then. Requires PIL and optionally ImageMagick to convert to png, since
I think PIL is not able yet to convert a bmp to a png. You can of
course use the os.path module instead of the path module. I keep it in
my windows start menu
I need to write an extension for a C function so that I can call it
from python.
C code (myapp.c)
==
typedef unsigned long MY_LONG;
char *DoStuff(char *input, MY_LONG *x) { ... }
so you pass in a string and an array of MY_LONGS...such as
MY_LONGS vals[10] = {};
char *input = this is my
[EMAIL PROTECTED] wrote:
I just threw this together because I find myself needing it now and
then. Requires PIL and optionally ImageMagick to convert to png, since
I think PIL is not able yet to convert a bmp to a png.
well, not in one step, but it can load BMP images and save PNG
images.
[EMAIL PROTECTED] wrote:
Steve Holden wrote:
Consider:
a = {1:'one'}
b = {2:'two'}
c = {1:'one'}
a is c
False
a in [b, c]
True
What would you have Python do differently in these circumstances?
You mean: What i would do i if i was the benevolent dictator ?
I would
Lasse Vågsæther Karlsen wrote:
I need to merge several sources of values into one stream of values. All
of the sources are sorted already and I need to retrieve the values from
snip
Ok, after working through the various sources and solutions, here's what
I finally ended up with:
def
Just replace
logging.basicConfig(level=logging.DEBUG)
with
logging.getLogger().setLevel(logging.DEBUG)
and you will no longer get messages written to the console. The
basicConfig() method is meant for really basic use of logging - it
allows one call to set level, and to add either a console
Thanks -- works as advertised.
Stephen
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have png file with mode I, 16 bit,
And I tried to open it with im=Image.open(output.png), im.show()
I got all white image.
Don't why?
Can Image only support 'RGB' or 'RGBA' png files?
Thanks
James
--
http://mail.python.org/mailman/listinfo/python-list
On Friday 07 October 2005 03:01 am, Steve Holden wrote:
OK, so how do you account for the execresence That will give you a
savings of 20%, which usage is common in America?
In America, anyway, savings is a collective abstract noun
(like physics or mechanics), there's no such
noun as saving
Terry Hancock wrote:
By the way, dict.org doesn't think execresence is a word,
although I interpret the neologism as meaning something like
execrable utterance:
dict.org said:
No definitions found for 'execresence'!
however, 'excrescence' appears to be a perfectly cromulent word:
Rocco Moretti wrote:
Steve Holden wrote:
On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards [EMAIL PROTECTED]
wrote:
For example: In British English one uses a plural verb when the
subject consists of more than one person. Sports teams,
government departments, states, corporations etc.
I am using Python 2.3.3 on an Mac OS9 system. I am looking for a build
of Python 2.3.3+ with a built in GUI, since Tk is missing. One day I
hope to upgrade to a new Mac with OSX on it, so a GUI that is available
on OS9 and OSX is preferable. I don't want to write my GUI code from
scratch if I
thanks, i ran it -- the only difference i got was the numarray version:
1.1.1 on the 686, and 1.3.3 on the 64bit... but i wouldn't have thought
that would make too much difference.
--
http://mail.python.org/mailman/listinfo/python-list
On Friday 07 October 2005 06:24 am, Steven D'Aprano wrote:
[snip]
Some village in Texas is missing their idiot.
I personally found it odd (and essentially
non-grammatical) not because either the singular or plural forms should
be mandated but because this one manages to mix them
Hello Phil,
Yes I have considered Octave. In fact I'm already using Matlab and
decided to 'reject' it for Python + Numeric/numarray + SciPy because I
think you could do more in Python and in more simple ways.
Problem is that neither Octave, Matlab and Python offer today a
framework to build
On Thu, 06 Oct 2005 22:30:00 -0700, Robert Kern [EMAIL PROTECTED]
wrote :
Dennis Lee Bieber wrote:
On Fri, 7 Oct 2005 01:12:22 +0200, Nicolas Pernetty
[EMAIL PROTECTED] declaimed the following in
comp.lang.python:
I'm aware of SimPy for discrete event simulation, but I haven't
Thanks, but what is really difficult is not to understand how to design
the program which solve a specific problem but to design a generic
framework for solving all these kinds of problem. And in a simple enough
way for basic programmers (but good scientists !) to handle it.
*** REPLY
On Fri, 2005-10-07 at 09:17 -0700, Paul Rubinhttp: wrote:
3. How do I keep people from tampering with the server? The clients
send strings of data to the server. All the strings start with x and
end with y and have z in the middle. Is requiring x at the front and
y at the back and z
I am trying to modify some of the tools to automate telugu wikipedia
maintainence tasks and I have realised that i cannot used cmd.exe as it
wont display unicode(atleast telugu). I will try the above and see if
it works. can I use the above command in IDLE??
Thanks for the prompt reply
Ravi
--
Terry Hancock [EMAIL PROTECTED] writes:
On Friday 30 September 2005 04:37 pm, John J. Lee wrote:
Tor Erik Sønvisen [EMAIL PROTECTED] writes:
Thanks for the answers... And yes, I have searched google!
How odd -- the most useful link (the viewcvs page for this source
file) is the very
On Friday 07 October 2005 10:52 am, Fredrik Lundh wrote:
Terry Hancock wrote:
GvR's syntax has the advantage of making grammatical sense in English (i.e.
reading it as written pretty much makes sense).
as a native Python speaker, I find that argument being remarkably weak.
things
I
101 - 200 of 268 matches
Mail list logo