On Fri, Sep 19, 2008 at 9:51 PM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> Extending len() to support iterables sounds like a good idea, except that
> it's not.
>
> Here are two iterables:
>
>
> def yes(): # like the Unix yes command
>while True:
>yield "y"
>
> def rand(total):
>
On Sep 22, 5:08 am, Martin Griffith <[EMAIL PROTECTED]> wrote:
> On Sun, 21 Sep 2008 15:00:16 -0700 (PDT), in sci.electronics.design H
> >Well, that's not C isn't it, more like Snobol or RPG/2
>
> It's better to say
> "that's not C, is it"
>
> I don't know why, but that's the way it works.
I r
On Sun, Sep 21, 2008 at 11:13 AM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> According to the Python docs, once an iterator raises StopIteration, it
> should continue to raise StopIteration forever. Iterators that fail to
> behave in this fashion are deemed to be "broken":
>
> http://docs.python.
On 21Sep2008 18:36, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Roy Smith wrote:
>> There are plausible examples of collections which grow while you're
>> iterating over them. I'm thinking specifically of a queue in a
>> multi-threaded application. One thread pushes work onto the back of
>> t
yuma wrote:
>
> Milenko Kindl
> Banja Luka
> Banjaluka
> Bihac
Try facing Mecca while repeating that and your source will compile.
--
Paul Hovnanian mailto:[EMAIL PROTECTED]
--
Leap and the net will appear.
--
http://mail.pytho
Hello,
I have 2 questions. Say I have this class:
class Player(object):
def __init__(self, fname, lname, score):
self.score = score
self.fname = fname
self.lname = lname
def __cmp__(self, other):
return (-cmp(self.score, other.score) or
cmp
On Sun, 21 Sep 2008 22:26:27 -0400, "Michael A. Terrell"
<[EMAIL PROTECTED]> wrote:
>
>H Vlems wrote:
>>
>> On 21 sep, 19:48, yuma <[EMAIL PROTECTED]> wrote:
>> > Milenko Kindl
>> > Banja Luka
>> > Banjaluka
>> > Bihac
>>
>> Well, that's not C isn't it, more like Snobol or RPG/2
>
>
> Tidybow
http://www.web2py.com Web2Py - Python Framework is the newest
kid on the block for Python frameworks.
It has a lot of features that simply are not there in other
frameworks. Even Ruby!. You can design database models graphically
online.
The templating language is pure python and there are no prob
[EMAIL PROTECTED] wrote:
> Hi
>
> I would appreciate some help. I am trying to learn Python and want to
> use BeautifulSoup to pull some data from tables. I was really psyched
> earlier tonight when I discovered that I could do this
>
> from BeautifulSoup import BeautifulSoup
> bst=file(r"c:\b
H Vlems wrote:
>
> On 21 sep, 19:48, yuma <[EMAIL PROTECTED]> wrote:
> > Milenko Kindl
> > Banja Luka
> > Banjaluka
> > Bihac
>
> Well, that's not C isn't it, more like Snobol or RPG/2
Tidybowl
--
http://improve-usenet.org/index.html
aioe.org, Goggle Groups, and Web TV users must reques
Jackie> can I ask python to stop for, say, 5mins, after it go through
Jackie> loop i=0 before it starts loop i=1?
import time
for i in range(10):
time.sleep(5) # seconds
Skip
--
http://mail.python.org/mailman/listinfo/python-list
John [H2O] wrote:
I have a glob.glob search:
searchstring = os.path.join('path'+'EN*')
files = glob.glob(searchstring)
for f in files:
print f
___
This returns some files:
EN082333
EN092334
EN*
My routine cannot handle the '*' and it should'nt be returned anyway? :-/
A bug?
No, it me
Hi all,
For a loop like:
for i = range (0,10);
can I ask python to stop for, say, 5mins, after it go through loop i=0
before it starts loop i=1?
Thank you very much!
Jackie
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> I have a class which is not intended to be instantiated. Instead of
> using the class to creating an instance and then operate on it, I
> use the class directly, with classmethods. Essentially, the class is
> used as a function that keeps state from on
On Sep 21, 6:05 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> Fixing top-posting.
>
> On Mon, 22 Sep 2008 08:54:43 +1000, James Mills wrote:
> > On Mon, Sep 22, 2008 at 8:39 AM, Steven D'Aprano
> > <[EMAIL PROTECTED]> wrote:
> >> I have a class which is not intended to be inst
On Mon, Sep 22, 2008 at 9:39 AM, Calvin Spealman <[EMAIL PROTECTED]> wrote:
> I call it an obvious misuse and misunderstanding of why you'd use a class in
> the first place. Either create an instance and not make these things
> classmethods or just share the stuff in a module-level set of variables
On Sep 20, 6:37 am, "John [H2O]" <[EMAIL PROTECTED]> wrote:
> My routine cannot handle the '*' and it should'nt be returned anyway? :-/
>
> A bug?
Not at all. That's the same behaviour you'll get if you do 'ls EN*'.
In your case, you're asking to match on anything that begins with EN,
a subset of
Steven D'Aprano:
> I have a class which is not intended to be instantiated. Instead of using
> the class to creating an instance and then operate on it, I use the class
> directly, with classmethods. Essentially, the class is used as a function
> that keeps state from one call to the next.
You may
I call it an obvious misuse and misunderstanding of why you'd use a class in
the first place. Either create an instance and not make these things
classmethods or just share the stuff in a module-level set of variables. But
the instantiating is the best options. Your class attributes might not be
gl
On Mon, Sep 22, 2008 at 9:05 AM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> I'm not wedded to the idea, there are alternatives (perhaps the factory
> should instantiate the class and return that?) but I assume others have
> used this design and have a name for it.
The problem is, I don't see why
On Sep 19, 1:37 pm, "John [H2O]" <[EMAIL PROTECTED]> wrote:
> I have a glob.glob search:
>
> searchstring = os.path.join('path'+'EN*')
shouldn't that be os.path.join(path, 'EN*') ?
> ___
> This returns some files:
> EN082333
> EN092334
> EN*
Mine doesn't return that last string.
>
> My routin
Fixing top-posting.
On Mon, 22 Sep 2008 08:54:43 +1000, James Mills wrote:
> On Mon, Sep 22, 2008 at 8:39 AM, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> I have a class which is not intended to be instantiated. Instead of
>> using the class to creating an instance and then operate on it, I us
Hi,
Wouldn't a normal class called State
suffice for storing state between calls ?
And ... Creating a state instance ?
For example:
class State(object):
"""State() -> new state object
Creates a new state object that is suitable
for holding different states of an application.
Usefull
I have a glob.glob search:
searchstring = os.path.join('path'+'EN*')
files = glob.glob(searchstring)
for f in files:
print f
___
This returns some files:
EN082333
EN092334
EN*
My routine cannot handle the '*' and it should'nt be returned anyway? :-/
A bug?
--
View this message in con
Sir,
Thank you for your reply. This is as to how I developed my .pyd file. I
entered the following commands within my MS-DOS prompt within Windows XP:
C:\python25\Scripts> C:\python25\python f2py.py -c --fcompiler=gnu95
--compiler=mingw32 -m hello hello.f90
I am using the gfortran compiler
I have a class which is not intended to be instantiated. Instead of using
the class to creating an instance and then operate on it, I use the class
directly, with classmethods. Essentially, the class is used as a function
that keeps state from one call to the next.
The problem is that I don't k
satoru,
I should point out that the normal
approach is to just try whatever it
is that you're doing, and let it fail
where it fails. For example:
def processSeq(x):
for i in x:
print i
processSeq([1, 2, 3])
processSeq("foobar")
processSeq(5) <-- This will fail.
cheers
James
On Sat, Se
On Sun, Sep 21, 2008 at 19:56, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>> http://bugs.python.org/setuptools/
>
> And how do people manage to know that?
Bugtracker send emails on setuptools mailing list.
--
Seb
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 21 Sep 2008 15:00:16 -0700 (PDT), in sci.electronics.design H
Vlems <[EMAIL PROTECTED]> wrote:
>On 21 sep, 19:48, yuma <[EMAIL PROTECTED]> wrote:
>> Milenko Kindl
>> Banja Luka
>> Banjaluka
>> Bihac
>
>Well, that's not C isn't it, more like Snobol or RPG/2
It's better to say
"that's not C,
from twisted.web import client
from twisted.internet import reactor
import base64
import sys
def printPage(data):
print data
reactor.stop()
def printError(failure):
print >> sys.stderr, "Error:", failure.getErrorMessage()
reactor.stop()
if len(sys.argv) == 4:
url = sys.argv[1
On 21 sep, 19:48, yuma <[EMAIL PROTECTED]> wrote:
> Milenko Kindl
> Banja Luka
> Banjaluka
> Bihac
Well, that's not C isn't it, more like Snobol or RPG/2
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 21, 4:04 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Diez B. Roggisch wrote:
> >> I wonder why something like myThread.exit() or myThread.quit() or
> >> threading.kill(myThread) can't be implemented?
> >> Is something like that present in Python 3000?
>
> > Not that I'm aware of it (which
Steven D'Aprano wrote:
According to the Python docs, once an iterator raises StopIteration, it
should continue to raise StopIteration forever. Iterators that fail to
behave in this fashion are deemed to be "broken":
http://docs.python.org/lib/typeiter.html
I don't understand the reasoning beh
On Sep 21, 4:37 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> > I'm not the one who wrote sympy, so I guess I'm not
> > the only one who didn't notice it.
>
> > If it's a well known problem, then sorry I wasted
> > your time.
>
> Given that 2.5 explicitly warns about this speci
aditya shukla wrote:
Hello folks , i have a .nwk file.I want to parser the tree from that
file.I found this python parser for newick trees.
http://www.daimi.au.dk/~mailund/newick.html
But i don't understand the usage properly.What i wanna do is if i have a
file in the location c:\\files\\file
Hello folks , i have a .nwk file.I want to parser the tree from that file.I
found this python parser for newick trees.
http://www.daimi.au.dk/~mailund/newick.html
But i don't understand the usage properly.What i wanna do is if i have a
file in the location c:\\files\\file1.nwk , then i wanna parse
Clay Hobbs wrote:
I am making a program with wxPython that renders objects in 3D using
PyOpenGL, and I am having some problems. For one thing, I forgot how to
make a double-buffered hardware surface.
http://bazaar.launchpad.net/~mcfletch/openglcontext/trunk/annotate/1?file_id=wxcontext.py-20080
En Sun, 21 Sep 2008 06:46:54 -0300, Sebastien Douche <[EMAIL PROTECTED]>
escribió:
2008/9/20 Carl Banks <[EMAIL PROTECTED]>:
On Sep 20, 1:11 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
为爱而生 wrote:
> File
"/usr/lib/python2.5/site-packages/setuptools/command/sdist.py",
> line 98, in entr
En Sat, 20 Sep 2008 16:07:12 -0300, Blubaugh, David A.
<[EMAIL PROTECTED]> escribió:
Let me state that do have extensive experience with developing binary
files. Please note that I have followed all of the instructions to the
letter as far as developing a DLL to be imported. However, it i
On Sun, 21 Sep 2008 06:17:36 -0700 (PDT), Alex wrote:
> On 21 Set, 15:07, George Sakkis <[EMAIL PROTECTED]> wrote:
>> On Sep 21, 8:51 am, Alex <[EMAIL PROTECTED]> wrote:
[snip]
>> > I have a problem understanding the behaviour of this snippet:
[snip]
>> Because you're doing a shallow copy:
>> http:
Milenko Kindl
Banja Luka
Banjaluka
Bihac
--
http://mail.python.org/mailman/listinfo/python-list
I am making a program with wxPython that renders objects in 3D using
PyOpenGL, and I am having some problems. For one thing, I forgot how to
make a double-buffered hardware surface. For another thing,
glColor(1.0, 0.0, 0.0) just before the rendering doesn't make the object
red. Please help, I'm
On Sat, 20 Sep 2008 20:51:52 -0700 (PDT), [EMAIL PROTECTED] wrote:
[snip]
> from BeautifulSoup import BeautifulSoup
> bst=file(r"c:\bstest.htm").read()
> soup=BeautifulSoup(bst)
> rows=soup.findAll('tr')
> len(rows)
> a=len(rows[0].findAll('td'))
> b=len(rows[1].findAll('td'))
> c=len(rows[2].findA
On Sun, Sep 21, 2008 at 10:02 AM, process <[EMAIL PROTECTED]> wrote:
> In erlang you can cons like this: [1|2]. i tried this in python and it
> didnt raise an error but i dont know what the result do
In Python, like in C, the "|" operator on integers performs a bitwise-OR.
To "cons" nondestructive
On Sep 19, 6:42 pm, [EMAIL PROTECTED] wrote:
> On Sep 19, 1:24 am, Tim Roberts <[EMAIL PROTECTED]> wrote:
>
> > [EMAIL PROTECTED] wrote:
>
> > >I tried curses.setsyx(2,3) in my script and it doesn't move the curses
> > >cursor. Any alternatives/solutions?
>
> > Did you call doupdate after? setsyx
process wrote:
In erlang you can cons like this: [1|2]. i tried this in python and it
didnt raise an error but i dont know what the result do
In Python | is the logical bitwise-OR operator. Look at the binary
representation of the numbers to understand it.
Gary Herron
[1|2]
In erlang you can cons like this: [1|2]. i tried this in python and it
didnt raise an error but i dont know what the result do
>>> [1|2]
[3]
>>> [2|2]
[2]
>>> a = [2|2]
>>> a
[2]
>>> [2|3]
[3]
>>> [2|1]
[3]
>>>
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
There are plausible examples of collections which grow while you're
iterating over them. I'm thinking specifically of a queue in a
multi-threaded application. One thread pushes work onto the back of the
queue while another pops from the front. The queue could certainly go
On Sep 21, 3:47 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sat, 20 Sep 2008 16:27:41 -0700, Alex Snast wrote:
> > Another quick question please, is the List data structure just a dynamic
> > array? If so how can you use static size array, linked list, AVL trees
> > etcet
In article <[EMAIL PROTECTED]>,
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Steven D'Aprano wrote:
>
> > According to the Python docs, once an iterator raises StopIteration, it
> > should continue to raise StopIteration forever. Iterators that fail to
> > behave in this fashion are deemed to be
On Sep 19, 7:08 pm, Jason Tishler <[EMAIL PROTECTED]> wrote:
...
> There are known issues when trying to run a Windows program that
> directly accesses the console under Cygwin. For example:
>
> http://mail.python.org/pipermail/python-list/2004-June/21.html
>
> AFAICT, you will have to use
Hi guys,
Apache Axis2/Java, is a popular open source Web service engine. It
currently supports exposing services written in Java, Javascript as Web
services. This article [1] discusses the Python data Binding that enable
exposing Web services written in Python.
[1] - http://wso2.org/library/a
Steven D'Aprano wrote:
According to the Python docs, once an iterator raises StopIteration, it
should continue to raise StopIteration forever. Iterators that fail to
behave in this fashion are deemed to be "broken":
http://docs.python.org/lib/typeiter.html
I don't understand the reasoning be
According to the Python docs, once an iterator raises StopIteration, it
should continue to raise StopIteration forever. Iterators that fail to
behave in this fashion are deemed to be "broken":
http://docs.python.org/lib/typeiter.html
I don't understand the reasoning behind this. As I understand
Mr.SpOOn wrote:
how can I override the '+' symbol (and other math symbols) so that it
can have a new behavior when applied to some objects?
see "Emulating Numeric Types" in the language reference:
http://www.python.org/doc/ref/numeric-types.html
--
http://mail.python.org/mailman/listin
http://docs.python.org/ref/numeric-types.html
On Sun, Sep 21, 2008 at 8:37 PM, Mr.SpOOn <[EMAIL PROTECTED]> wrote:
> Hi,
> how can I override the '+' symbol (and other math symbols) so that it
> can have a new behavior when applied to some objects?
> --
> http://mail.python.org/mailman/listinfo/p
Hi,
how can I override the '+' symbol (and other math symbols) so that it
can have a new behavior when applied to some objects?
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
I wonder why something like myThread.exit() or myThread.quit() or
threading.kill(myThread) can't be implemented?
Is something like that present in Python 3000?
Not that I'm aware of it (which doesn't mean to much though).
However I *am* aware of the bazillions discussi
dmitrey schrieb:
I wonder why something like myThread.exit() or myThread.quit() or
threading.kill(myThread) can't be implemented?
Is something like that present in Python 3000?
Not that I'm aware of it (which doesn't mean to much though).
However I *am* aware of the bazillions discussions that
I wonder why something like myThread.exit() or myThread.quit() or
threading.kill(myThread) can't be implemented?
Is something like that present in Python 3000?
Regards, D.
--
http://mail.python.org/mailman/listinfo/python-list
On 21 Set, 15:07, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Sep 21, 8:51 am, Alex <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi all!
>
> > I have a problem understanding the behaviour of this snippet:
>
> > data_set = ({"param":"a"},{"param":"b"},{"param":"c"})
>
> > for i in range(len(data_set)):
>
On Sep 21, 10:51 pm, Alex <[EMAIL PROTECTED]> wrote:
> Why? I'm coping data_set in ds so why data_set is changed?
You're making a copy of the ds tuple, which has the -same- contents as
the original. To create copies of the contents as well, try the
deepcopy function from the copy module.
As an as
On Sep 21, 8:51 am, Alex <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I have a problem understanding the behaviour of this snippet:
>
> data_set = ({"param":"a"},{"param":"b"},{"param":"c"})
>
> for i in range(len(data_set)):
> ds = data_set[:]
> data = ds[i]
> if i == 1: data['param'] = "y
Hi all!
I have a problem understanding the behaviour of this snippet:
data_set = ({"param":"a"},{"param":"b"},{"param":"c"})
for i in range(len(data_set)):
ds = data_set[:]
data = ds[i]
if i == 1: data['param'] = "y"
if i == 2: data['param'] = "x"
print data_set
This script pr
dmitrey wrote:
BTW, it should be noticed that lots of threading module methods have
no docstrings (in my Python 2.5), for example _Thread__bootstrap,
_Thread__stop.
things named _Class__name are explicitly marked private by the
implementation (using the "__" prefix).
using them just because
On Sep 21, 3:16 pm, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote:
> Thanks Gabriel,
> I was missing the information how to create a writable buffer.
array.array objects also have the writable buffer nature:
>>> import array
>>> b = array.array('c', '\0' * 10)
>>> b
array('c', '\x00\x00\x00\x00\x00\
dmitrey schrieb:
hi all,
Is there a better way to kill threading.Thread (running) instance than
this one
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496960
(it's all I have found via google).
Nope. There might be other ways technically, but none of them falls into
a "better"-class
hi all,
Is there a better way to kill threading.Thread (running) instance than
this one
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496960
(it's all I have found via google).
BTW, it should be noticed that lots of threading module methods have
no docstrings (in my Python 2.5), for exam
2008/9/20 Carl Banks <[EMAIL PROTECTED]>:
> On Sep 20, 1:11 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>> 为爱而生 wrote:
>> > File "/usr/lib/python2.5/site-packages/setuptools/command/sdist.py",
>> > line 98, in entries_finder
>> > log.warn("unrecognized .svn/entries format in %s", dirname)
>>
Mensanator wrote:
I'm not the one who wrote sympy, so I guess I'm not
the only one who didn't notice it.
If it's a well known problem, then sorry I wasted
your time.
Given that 2.5 explicitly warns about this specific change:
>>> as = 1
:1: Warning: 'as' will become a reserved keyword in Pyt
Martin v. Löwis wrote:
I don't think he meant that Python is wrong somehow, but that the OO
babble of what happens for 2+2 is wrong. The babble said that, when the
code is executed, an __add__ message is sent to the 2 object, with
another 2 object as the parameter. That statement is incorrect:
Christian Heimes wrote:
> Kay Schluehr wrote:
>> Actually it is simply wrong in the mentioned case
[...]
>
> It's not wrong. You have found a simple optimization. Lot's of compilers
> for lots of languages optimize code by code folding.
I don't think he meant that Python is wrong somehow, but th
Bonjour !
AMHA, ceux qui ont écrit ce texte ont une mauvaise idée de ce que sont
les variables en Python.
Ils ont sans doute trop en tête les notions des variables en C ou en
Basic, et ne se sont pas penchés sur les spécificités de Python.
@-salutations
--
Michel Claveau
--
http://mail
Hi!
Everything ... are an object.
It's true ; but a language built around the objects, and OOP, are two
different concepts.
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
74 matches
Mail list logo