I was looking at Simon Burton's Povray.py code (part of pypov) and saw
this line:
globals()[name] = type( name, (KWItem,), {} ) # nifty :)
where 'KWItem' was a class. It did seem nifty, but it was unclear to me
what was happening.
I went to python.org's online documentation which said that type()
Thank you - that explains everything quite nicely.
--
http://mail.python.org/mailman/listinfo/python-list
I recently ran into the issue with 'print' were, as it says on the web
page called "Python Gotchas"
(http://www.ferg.org/projects/python_gotchas.html):
The Python Language Reference Manual says, about the print statement,
A "\n" character is written at the end, unless the print statement ends
wit
I wrote this little piece of code to get a list of relative paths of
all files in or below the current directory (*NIX):
walkList = [(x[0], x[2]) for x in os.walk(".")]
filenames = []
for dir, files in walkList:
filenames.extend(["/".join([dir, f]) for f in files])
It works f
> HTH,
It does. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
I was starting to write a dictionary to map operator strings to their
equivalent special methods such as:
{
'+' : 'add',
'&' : 'and_'
}
The idea is to build a simple interactive calculator.
and was wondering if there is already something like this builtin?
Or is there a better way to do what
John Machin wrote:
>>> eval('1+2')
3
--
Yeah, that's what I decided to do.
--
http://mail.python.org/mailman/listinfo/python-list
I have run into some cases where I would like to run a class method
anytime any class method is invoked.
That is, if I write
x.foo
then it will be the same as writing
x.bar
x.foo
for any method in class x (with the possible exception of 'bar').
The first few times I wanted to print out a data st
>[EMAIL PROTECTED] wrote:
>> I have run into some cases where I would like to run a class method
>> anytime any class method is invoked.
>
>Perhaps you want __getattribute__ on a new-style class?
>--
>Michael Hoffman
Perhaps I do. The docs say that __getattribute__ is called on all
attribute refer
On some flavors of Windows you can use:
import pyTTS
tts = pyTTS.Create()
tts.Speak('This is the sound of my voice.')
On Mac OS X you can use:
import os
os.system("say 'This is the sound of my voice.'")
You could write a wrapper that takes a string and checks to see which
OS you are on and exec
Seattle Python Interest Group Meeting Thursday, Jan 11th at 7:00 PM
Bar underneath the Third Place Books in Ravenna.
http://www.ravennathirdplace.com/
NE 65th St & 20th Ave NE
--
http://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo