This is a neat trick. But can't this also be done with a static
method
that accesses a static data attribute the same way?
I don't think so because the static mehod can only see
the attributes of Shape not of Line. It doesn't have
access to the cls value in Kent's code below...
Curses comes as standard on linux...
More seriously, I seem to recall that on the contrary, the
Windows Python distribution does not include the curses module
That's correct.
have to use msvcrt[?] instead). I wonder why, because I'm pretty
sure
I saw (C) curses-based applications
What I *am* looking for, if you have it or know of anyone who does,
is
*simple* source code files (preferrably the entire game's code is in
one .py file),
Thats unlikely to happen because its very bad practice and
Python tries to make it easy NOT to do that. Breaking code
into modules makes it
Alan G wrote:
This is a neat trick. But can't this also be done with a static
method
that accesses a static data attribute the same way?
I don't think so because the static mehod can only see
the attributes of Shape not of Line.
Well, it can *see* Point._count and Line._count, it just
Ron Phillips wrote:
I believe I've tried every setting known to man, in every script in
every little scrap of documentation available. XMLRPC requests using
SimpleXMLRPCRequestHandler -- no problem. But try to run them as a CGI
script, and I get system lock ups and that's all. No error
D. Hartley denise.hartley at gmail.com writes:
code, but it's made up of 46 different .py files, none of which seem
to be the main game (lots of little modules, like an input box, a
high score list, etc). It's a lot harder for someone new to
programming to read.
Identify the main file (the
Well, I've managed to get an image into a postgre database, but now I'm having
trouble getting it out.
#! /usr/bin/env python
from pyPgSQL import PgSQL
def main():
connectdb = PgSQL.connect('server:port:database:username:password')
cur = connectdb.cursor()
sqlStatement = SELECT
-Original Message-
Hey there,
Hi,
i have used the cgi module and dig it.
heres the deal,
my employer wants me to build a dynamic website that will
access a
database and display customer
information on web. ok, easy enough.
Looks like some others have pointed
Hello, everyone!
I am trying to go to a website, collect any and all cookies I receive
by going to that website, and then look at the cookies/print them.
So I did the following, from the cookie examples in the documentation:
import cookielib, urllib2
myjar = cookielib.CookieJar()
opener =
Smith, Jeff wrote:
Consider a class with a lt of properties. I would like a member
function which generates a dictionary where the keys are the property
names and the values are the property values?
Is this clear?
How might I go about this?
Jeff
___
D. Hartley wrote:
My problem is, when I plug this url into my sample code above, I get
an error (HTTP Error 401: Authorization Required), because normally
when you go to this url it makes you enter in a username and a
password.
(Also, there is lots of documentation on the cookie modules,
-Original Message-
Consider a class with a lt of properties. I would like a member
function which generates a dictionary where the keys are the property
names and the values are the property values?
Is this clear?
I think so :-)
How might I go about this?
I think you could
I can see I wasn't clear :-)
Here's the basic framework of what I'm looking for. Needless to say,
this is just an example and not the real problem which is quite
complicated and includes multiple classes.
What I'm looking for is the actual implementation of get_props_as_dict
which I've written
Smith, Jeff wrote:
I can see I wasn't clear :-)
Here's the basic framework of what I'm looking for. Needless to say,
this is just an example and not the real problem which is quite
complicated and includes multiple classes.
What I'm looking for is the actual implementation of
Here would be the usage:
myinst = MyClass()
print myinst.getprops_as_dict()
would print
{'var1': 1, 'var2': 2, 'var3': 3}
Needless to say I want the instance values which might be different for
each instance. I know that I could code it brute force, but I want to
be able to add properties
-Original Message-
Christian,
Try subclassing urllib.FancyURLopener and overriding the
prompt_user_passwd() method. That should get you what you need :-)
Well, I used urllib.FancyURLopener, and can open and look at
the url, like this:
import urllib
opener2 =
Smith, Jeff wrote:
Here would be the usage:
myinst = MyClass()
print myinst.getprops_as_dict()
would print
{'var1': 1, 'var2': 2, 'var3': 3}
Needless to say I want the instance values which might be different for
each instance. I know that I could code it brute force, but I want to
Consider a class with a lt of properties. I would like a member
function which generates a dictionary where the keys are the
property
names and the values are the property values?
Use the force... :-)
Since Python uses dictionaries to store all those things
already there must be a suitable
That's what I was looking for. Although I couldn't get the below to
work, I went with a different mod of the original you gave:
def get_props_as_dict(self):
d = dict()
for entry in dir(self.__class__):
if isinstance(getattr(self.__class__, entry), property):
From Christian:
Try subclassing urllib.FancyURLopener and overriding the
prompt_user_passwd() method. That should get you what you need :-)
Well, I used urllib.FancyURLopener, and can open and look at the url, like this:
import urllib
opener2 = urllib.FancyURLopener({})
f =
Hello,
I've been using lists within lists for several
functions, but have been unable, in loop form, to extract data from
them or, in loop for, apply data to them.
Basically, when extracting data, it only runs 1 loop. Likewise, when initially assigning the data, it only runs 1 loop.
In the
On Thu, 23 Jun 2005, Phillip Hart wrote:
I've been using lists within lists for several functions, but have been
unable, in loop form, to extract data from them or, in loop for, apply data
to them.
[cut]
Hi Phillip,
Can you try checking for indentation? Your code came out indented all on
Smith, Jeff wrote:
That's what I was looking for. Although I couldn't get the below to
work, I went with a different mod of the original you gave:
def get_props_as_dict(self):
d = dict()
for entry in dir(self.__class__):
if
23 matches
Mail list logo