On Tue, 26 Dec 2006 22:49:30 -0500, Jan Theodore Galkowski wrote:
Hi.
One of the things I'd like to do with Python is find a way to
consistently implement Smalltalk's loose methods. This is a
capability whereby additional methods can be added dynamically to
existing classes.
You can't
Alright, I realize this is probably very basic to be posted on this
newsgroup but I cannot figure out what is causing my problem. Here is
the code I am using below:
from getpass import getpass
configfile = file('config.txt', 'w')
serverPassword = configfile.readline()
if serverPassword ==
Dear Jon Harrop,
Thanks for the informative reply.
I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.
This wikipedia excerpt from
http://en.wikipedia.org/wiki/QuickDraw_3D
summarize my sentiment:
«Most 3D toolkits
In [EMAIL PROTECTED], apriebe47
wrote:
configfile = file('config.txt', 'w')
serverPassword = configfile.readline()
Here you open a file for writing and try to read a line. This raises an
exception:
In [1]: configfile = file('test.txt', 'w')
In [2]: configfile.readline()
buffi [EMAIL PROTECTED] wrote:
Is this concidered bad coding practice since I guess persistent
variables in functions are not meant to be?
There is a problem that this trick only works for functions and not for
methods as it assumes that there is a global name through which you can
access
Xah Lee wrote:
Dear Jon Harrop,
Thanks for the informative reply.
I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.
OpenGL is low level, that's right, but it is not crap. OpenGL is
hardware independent, and
Marc 'BlackJack' Rintsch wrote:
configfile = file('config.txt', 'w')
serverPassword = configfile.readline()
Hrm. When I run the code that I posted I don't seem to get those
errors.
Please post the exact code you have trouble with. Don't retype it -- copy
and paste it.
from getpass
John Nagle [EMAIL PROTECTED] wrote:
And this came out, via prettify:
addresssnippet siteurl=http%3A//apartmentsapart.com
url=http%3A//www.apartmentsapart.com/Europe/Spain/Madrid/FAQ
param name=movie
value=/images/offersBanners/sw04.swf?binfot=We offer
fantastic rates for
Jan Theodore Galkowski [EMAIL PROTECTED] wrote:
Comments? Suggestions?
http://www.ruby-lang.org
--
Luc Heinrich
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:
Marc 'BlackJack' Rintsch wrote:
configfile = file('config.txt', 'w')
serverPassword = configfile.readline()
Hrm. When I run the code that I posted I don't seem to get those
errors.
Please post the exact code you have trouble with.
Lad wrote:
In my web application I use Apache and mod_python.
I allow users to upload huge files( via HTTP FORM , using POST method)
I would like to store the file directly on a hard disk and not to
upload the WHOLE huge file into server's memory first.
Can anyone suggest a solution?
The
John Machin [EMAIL PROTECTED] wrote:
To compare two strings, take copies, and:
Taking a copy of a string seems kind of superfluous in Python.
--
http://mail.python.org/mailman/listinfo/python-list
Dear Stani,
Very much wishing you a new and great web host for the new year. I feel and
read also from so many that you are doing a great service for Python users
an d being an example of the Free software movement. i thank you very much
and hope you will be back on the web soon. What help do
Steve Bergman [EMAIL PROTECTED] writes:
I'm looking for a module to do fuzzy comparison of strings. I have 2
item master files which are supposed to be identical, but they have
thousands of records where the item numbers don't match in various
ways. One might include a '-' or have leading
Duncan Booth wrote:
John Machin [EMAIL PROTECTED] wrote:
To compare two strings, take copies, and:
Taking a copy of a string seems kind of superfluous in Python.
You are right, I really meant don't do:
original = original.strip().replace().replace()
(a strange way of doing
There is a problem that this trick only works for functions and not for
methods as it assumes that there is a global name through which you can
access the function.
I didn't really see any issue with this since methods can store the
persistant data from the method inside the class containing
Steven D'Aprano:
You can't modify the built-in classes. I'm not sure that it is a good idea
to allow built-ins to be modified. When I see an int, I like the fact that
I know what the int can do, and I don't have to worry about whether it has
been modified by some piece of code elsewhere.
I
On Dec 13, 3:47 pm, Gal Diskin [EMAIL PROTECTED] wrote:
Hi,
I am writing a code that needs to iterate over 3 lists at the same
time, i.e something like this:
for x1 in l1:
for x2 in l2:
for x3 in l3:
print do something with, x1, x2, x3
What I need to do is go
On Wed, 27 Dec 2006 02:52:42 -0800, John Machin wrote:
Duncan Booth wrote:
John Machin [EMAIL PROTECTED] wrote:
To compare two strings, take copies, and:
Taking a copy of a string seems kind of superfluous in Python.
You are right, I really meant don't do:
original =
On Wed, 27 Dec 2006 19:03:12 +1100, Steven D'Aprano [EMAIL PROTECTED] wrote:
You can't modify the built-in classes. I'm not sure that it is a good idea
to allow built-ins to be modified. When I see an int, I like the fact that
I know what the int can do, and I don't have to worry about whether it
Xah Lee wrote:
Regarding VisualPython... i saw a demo in 2002 by a professor
friend. I think it is good. Though, why is its licensing not GPL or
otherwise Open Source? That's kinda odd since Pyhton is.
You are confusing VPython with Activestate's Visual Python IDE plugin
for Visual Studio.
I am trying to create a python version of the MS USB Missile Launcher
code for Windows.
I am basing it off one designed for linux.
I note the following about dependencies:
Requirements:
-
0. python (=2.3)
-Fine
1. libusb (=0.1.2)
-Fine, however the
I've tried this:
import MyPackage
if MyPackage.aVariable is None:
MyPackage.aVariable = True
but when I tried to access MyPackage.aVariable from another file
(ie through an other import) the value is still None.
how can I do this
thanks
yomgui
--
Maxim Sloyko wrote:
Lad wrote:
In my web application I use Apache and mod_python.
I allow users to upload huge files( via HTTP FORM , using POST method)
I would like to store the file directly on a hard disk and not to
upload the WHOLE huge file into server's memory first.
Can anyone
On Wed, 27 Dec 2006 14:50:18 GMT, yomgui [EMAIL PROTECTED] wrote:
I've tried this:
import MyPackage
if MyPackage.aVariable is None:
MyPackage.aVariable = True
but when I tried to access MyPackage.aVariable from another file
(ie through an other import) the value is still None.
how can I
I found this text about combining C-code with Pyton scripting on the
P2P networks in PDF:
Python Scripting for Computational Science
Hans Petter Langtangen
Simula Research Laboratory
and
Department of Informatics
University of Oslo
amazon and others have it in print.
software for the text is
i want to let a byte array to be xor with some value.
but code show below i wrote seems not so .. good..., any better way to
write such function? thanks.
[code]
def xor(buf):
bout=[]
for i in range(len(buf)):
x = ord(buf[i])
x ^= 123
Hello,
I was install M2Crypto-0.17beta1.win32-py2.4,and when I run it, I get
the error:
import M2Crypto
Traceback (most recent call last):
File pyshell#0, line 1, in -toplevel-
import M2Crypto
File C:\Python24\Lib\site-packages\M2Crypto\__init__.py, line 14,
in -toplevel-
import
On 27 Dec 2006 07:18:22 -0800, neoedmund [EMAIL PROTECTED] wrote:
i want to let a byte array to be xor with some value.
but code show below i wrote seems not so .. good..., any better way to
write such function? thanks.
[code]
def xor(buf):
bout=[]
for i in range(len(buf)):
hi all,
I'm investigating the possibilities to replace MatLab with Python
(+NumPy +SciPy).
I'm a very newbie, I just typed my first characters and calculated the
sum of 2 and 3 in Python.
My application is a Delphi program, for data-acquisition and real-time
data analysis. The real-time analysis
In [EMAIL PROTECTED], neoedmund wrote:
i want to let a byte array to be xor with some value.
but code show below i wrote seems not so .. good..., any better way to
write such function? thanks.
def xor(buf):
bout=[]
for i in range(len(buf)):
x = ord(buf[i])
neoedmund wrote:
i want to let a byte array to be xor with some value.
but code show below i wrote seems not so .. good..., any better way to
write such function? thanks.
[code]
def xor(buf):
bout=[]
for i in range(len(buf)):
x = ord(buf[i])
Hello,
I am trying to get python to give me the PID of a process (in this case
HUB). I have it working, except for the fact that the output includes
\012 (newline). Is there a way to ask python not to give me a newline?
Python 1.4 (Oct 14 1997) [C]
Copyright 1991-1995 Stichting Mathematisch
hi,
your sample code works, but mine doesn't.
it must be a multi-thread issue.
I am certain that I am modifying MyPackage.aVariable
before using it.
Both threads are importing MyPackage,
but the modification of MyPackage.aVariable
is not seen by the other thread. is this possible ?
is there a
On Tue, 26 Dec 2006 22:49:30 -0500, Jan Theodore Galkowski wrote:
Hi.
One of the things I'd like to do with Python is find a way to
consistently implement Smalltalk's loose methods. This is a
capability whereby additional methods can be added dynamically to
existing classes.
You can't
Jan Theodore Galkowski [EMAIL PROTECTED] wrote:
Comments? Suggestions?
http://www.ruby-lang.org
Luc, don't misunderstand: There's nothing at all wrong with Python nor
am I suggesting there is. I'm just exploring how far I can go using its
dynamic nature. There's no hope of using loose
I am trying to set off commands on Windows 2003 from python.
Specifically, I am trying to use diskpart with a script file (pointed
to with path).
cmd = [diskpart, /s, path]
p = Popen(cmd, shell=True)
The script is meant to loop through twice. It will do so if I comment
eldorado [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,
I am trying to get python to give me the PID of a process (in this case
HUB). I have it working, except for the fact that the output includes
\012 (newline). Is there a way to ask python not to give me a newline?
Carl Banks wrote:
Carl Banks wrote:
[EMAIL PROTECTED] wrote:
After some trials I found that put os.close(1) before calling the
function will depress the output. In fact, os.close(1) closed
standard output, but I don't know how to open it again after the function's
execution.
Erik Johnson ej at wellkeeper dot com wrote:
There's more than one way to do it! (Oh, sorry, that's Perl...)
The two most standard ways would be to call strip() on your string to
get one sans both leading and trialing whitespace
print h.strip()
or if you know exactly what you've
Stef Mientki [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is there a way to run the initialization code from a script(file) once,
to achieve the same effect ?
Certainly. This is what Python modules are all about. You should probably
read up on those a bit here:
On Wed, 27 Dec 2006, Erik Johnson wrote:
eldorado [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,
I am trying to get python to give me the PID of a process (in this case
HUB). I have it working, except for the fact that the output includes
\012 (newline). Is there a way
In article [EMAIL PROTECTED],
Jan Theodore Galkowski [EMAIL PROTECTED] wrote:
I think Python is very fine although, arguably, because many are
approaching it from a Java strong-typing static mindset, I bet the space
of design possibilities hasn't been explored thoroughly. We've not had
an
Thanks to all that responded. I chose a modified version of Scott's
second recommendation:
time = line[:8]
decoded_File.write( '%00.4f' % (int(time, 16) * .0001) + ', ')
'print ' added a CRLF that I didn't need, so I went with '.print' (I
need to process about 20 values from the remaining
eldorado [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
g = os.popen(ps -ef | grep HUB | grep -v grep | awk '{ print $2 }')
h = g.readlines()
g.close()
h
['87334\012']
h = h[:-1]
h
[]
Oh, sorry... h is a list here because you are using readlines().
I am used to doing
Erik Johnson ej at wellkeeper dot com (EJ) wrote:
EJ But briefly, probably what you want to do is put some code in a file, say
EJ init.py:
EJ # init.py
EJ X = 3
EJ Y = 5
EJ # A bunch of other stuff
EJ And then in your main program, execute
EJ from init import *
EJ That
actually, it is not linked to threading but to the scope.
the second attempt to access MyPackage.aVariable
is inside the __init__ of a class
and this seems to be the problem.
I believe it is a genuine python bug.
yomgui
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
John Nagle [EMAIL PROTECTED] wrote:
And this came out, via prettify:
addresssnippet siteurl=http%3A//apartmentsapart.com
url=http%3A//www.apartmentsapart.com/Europe/Spain/Madrid/FAQ
param name=movie
value=/images/offersBanners/sw04.swf?binfot=We offer
That's a matter of taste. Try replacing the try...except block with
hasattr:
def doStuff():
if hasattr(doStuff, timesUsed):
doStuff.timesUsed += 1
else:
doStuff.timesUsed = 1
do_common_code
Ok, it is a matter of taste and I prefer the try/except way, but
Hi,
I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows
Hi,
I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows
On Wed, 2006-12-27 at 18:10 +, yomgui wrote:
actually, it is not linked to threading but to the scope.
the second attempt to access MyPackage.aVariable
is inside the __init__ of a class
and this seems to be the problem.
I believe it is a genuine python bug.
Please post a minimal but
I've found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven't worked out yet how to
capture that output to a file...
Ben
Ben wrote:
Hi,
I have a python script on a unix system that runs fine. I have a python
script on a windows system
Hi,
I need to process few out of a variable number of named arguments in a
function and pass the remaining to another function that also takes
variable number of named arguments. Consider this simple example,
def fun1(**kwargs):
print kwargs.keys()
def fun2(**kwargs):
# get id param
John Nagle [EMAIL PROTECTED] wrote:
It's worse than that. Look at the last line of BeautifulSoup
output:
linkurl;=/Europe/Spain/Madrid/Apartments/Offer/2408 /
That / doesn't match anything. We're outside a tag at that point.
And it was introduced by BeautifulSoup. That's
On 2006-12-27, Ben [EMAIL PROTECTED] wrote:
I've found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven't worked out yet how to
capture that output to a file...
unexpand file1 file2
--
Grant Edwards grante
Great - that worked.Thanks!
Is that a general method in linux you can always use to redirect
standard output to a file?
Cheers,
Ben
Grant Edwards wrote:
On 2006-12-27, Ben [EMAIL PROTECTED] wrote:
I've found the unexpand command, which seems to do the trick. However,
it outputs to
On Wed, 2006-12-27 at 10:37 -0800, Ramashish Baranwal wrote:
[...]
def fun2(**kwargs):
# get id param
id = kwargs.pop('id', '')
# pass on remaining to fun1
fun1(kwargs)
When I try to call fun2 I get the following error-
TypeError: fun1() takes exactly 0 arguments (1
On 2006-12-27, Ben [EMAIL PROTECTED] wrote:
I've found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven't worked out yet how to
capture that output to a file...
unexpand file1 file2
Great - that worked.Thanks!
Is that a general method
[Followup-To: header set, but it's best not to followup at all.]
On 2006-12-27, Raff [EMAIL PROTECTED] wrote:
Xah Lee wrote:
I don't know OpenGL, but i think it is a low-level crap, and have done
^^^
the industry huge irreparable damage
Thanks, all. Yes, Levenshtein seems to be the magic word I was looking
for. (It's blazingly fast, too.)
I suspect that if I strip out all the punctuation, etc. from both the
itemnumber and description columns, as suggested, and concatenate them,
pairing the record with its closest match in the
Ben [EMAIL PROTECTED] typed
I have a python script on a windows system that runs fine. Both use
tabs to indent sections of the code.
Just a tip for you: In python you never use tabs for indentation. The
python style guide [1] recommends four spaces per indentation level.
[1]
On Wed, 27 Dec 2006, Erik Johnson wrote:
eldorado [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
g = os.popen(ps -ef | grep HUB | grep -v grep | awk '{ print $2 }')
h = g.readlines()
g.close()
h
['87334\012']
h = h[:-1]
h
[]
Oh, sorry... h is a list here because you are
other module that has done 'from init import *'.
If you want that kind of behaviour it is better to use: 'import init' and
refer to the variables as init.X and init.Y so that you can change them.
Whether that is a good idea is another matter.
There are other reasons for not using the from
Gal Diskin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Dec 13, 3:47 pm, Gal Diskin [EMAIL PROTECTED] wrote:
Hi,
I am writing a code that needs to iterate over 3 lists at the same
time, i.e something like this:
for x1 in l1:
for x2 in l2:
for x3 in l3:
eldorado [EMAIL PROTECTED] typed
Hello,
I am trying to get python to give me the PID of a process (in this
case
HUB). I have it working, except for the fact that the output includes
\012 (newline). Is there a way to ask python not to give me a
newline?
Python 1.4 (Oct 14 1997) [C]
In article [EMAIL PROTECTED],
Gal Diskin [EMAIL PROTECTED] wrote:
Hi,
I am writing a code that needs to iterate over 3 lists at the same
time, i.e something like this:
for x1 in l1:
for x2 in l2:
for x3 in l3:
print do something with, x1, x2, x3
What I need to
On Wed, 27 Dec 2006, Sebastian 'lunar' Wiesner wrote:
eldorado [EMAIL PROTECTED] typed
Hello,
I am trying to get python to give me the PID of a process (in this
case
HUB). I have it working, except for the fact that the output includes
\012 (newline). Is there a way to ask python not to
I have a program which has a GUI front-end which that runs a separate
thread to handle all the important stuff. However, if there is a
problem with the important stuff, I want the GUI to raise a MessageBox
alert to indicate this.
For exceptions, I can simply use a catch-all except statement like:
eldorado [EMAIL PROTECTED] typed
[snip]
This looks cleaner than the way I was going. I created a file
called ps.py
#!/usr/local/bin/python
import os
g = os.popen(ps -e -o pid,command)
for line in g.readlines():
if 'HUB' in line:
pid = line.strip().split('
Scott David Daniels wrote:
[EMAIL PROTECTED] wrote:
Hi,
I'm writing a program which uses an external module written in C
and calls a function provided by the module to do my job. The
function produces a lot of output to the stdout.
Is there a way to suppress the output produced
tac-tics [EMAIL PROTECTED] writes:
I have a program which has a GUI front-end which that runs a separate
thread to handle all the important stuff. However, if there is a
problem with the important stuff, I want the GUI to raise a MessageBox
alert to indicate this.
For exceptions, I can
On Wed, 27 Dec 2006, Sebastian 'lunar' Wiesner wrote:
eldorado [EMAIL PROTECTED] typed
Strange!? On my system with Python 2.4 I don't get this error. It is
likely to be a problem of your really ancient python version. Do I
guess correctly from your previous postings, that you're still using
On Wed, 2006-12-27 at 12:13 -0800, tac-tics wrote:
I have a program which has a GUI front-end which that runs a separate
thread to handle all the important stuff. However, if there is a
problem with the important stuff, I want the GUI to raise a MessageBox
alert to indicate this.
For
SKIMPY CAPTCHA ADDS AUDIO, AND A PROBLEM
[or what I did over xmas weekend at the inlaws
-- python/web/audio experts skip to the bottom
and solve my problem please.]
Skimpy Gimpy CAPTCHA now supports WAVE audio
output to help people with visual impairments
answer Skimpy challenges.
Read more,
Lad wrote:
Maxim Sloyko wrote:
Lad wrote:
In my web application I use Apache and mod_python.
I allow users to upload huge files( via HTTP FORM , using POST method)
I would like to store the file directly on a hard disk and not to
upload the WHOLE huge file into server's memory first.
Can
Guido was opposed to modifying builtin types before Java existed. It's
similar to his opposition to dynamic syntax.
Opposition or not, the language definition is there. Surely Smalltalk's
OO style can be respected. Smalltalkers have been doing OO in a dynamic
context longer than many. There
If you try to open a password protected page with urllib.urlopen(), you get
Enter username for EnterPassword at example.com:
on standard output, followed by a read for input! This seems to be an
undocumented feature, if not a bug. Definitely the documentation for
urllib should
Is the following intuitively feasible in Python:
I have an array (I come from C) of identical objects, called sections.
These sections have some feature, say a length, measured in mm, which
is calculated by a method A_length of the instantiation of the
Section's class.
Only, two elements in the
Here's their license:
http://www.vpython.org/webdoc/visual/license.txt
I read it wrong before.
Thanks for correction.
This is superb! I'll be looking into vpython!
Xah
Ravi Teja wrote:
Xah Lee wrote:
Regarding VisualPython... i saw a demo in 2002 by a professor
friend. I think it is
At Wednesday 27/12/2006 13:45, yomgui wrote:
your sample code works, but mine doesn't.
it must be a multi-thread issue.
I am certain that I am modifying MyPackage.aVariable
before using it.
Both threads are importing MyPackage,
but the modification of MyPackage.aVariable
is not seen by the
Steve Bergman wrote:
Thanks, all. Yes, Levenshtein seems to be the magic word I was looking
for. (It's blazingly fast, too.)
I suspect that if I strip out all the punctuation, etc. from both the
itemnumber and description columns, as suggested, and concatenate them,
pairing the record with
Given a Python unicode character (string of length one), how would I
find out the \u escape sequence for it? This isn't obvious from the
docs I've been looking through.
Thanks,
Ken
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle [EMAIL PROTECTED] writes:
If you try to open a password protected page with urllib.urlopen(), you
get
Enter username for EnterPassword at example.com:
on standard output, followed by a read for input! This seems to be an
undocumented feature, if not a bug.
In [EMAIL PROTECTED], Osiris wrote:
I have an array (I come from C) of identical objects, called sections.
These sections have some feature, say a length, measured in mm, which
is calculated by a method A_length of the instantiation of the
Section's class.
Only, two elements in the array (or
Kenneth McDonald wrote:
Given a Python unicode character (string of length one), how would I
find out the \u escape sequence for it? This isn't obvious from the
docs I've been looking through.
You can use the ord builtin, or the encode method with
unicode_escape:
a = u'\u1234'
a
Hello list,
I have a dbm database which needs to be accessed/writed by multiple
processes. At the moment I do something like :
@with_lock
def _save(self):
f = shelve.open(self.session_file, 'c')
try:
f[self.sid] = self.data
finally:
Osiris [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is the following intuitively feasible in Python:
I have an array (I come from C) of identical objects, called sections.
These sections have some feature, say a length, measured in mm, which
is calculated by a method A_length of
Maxim Sloyko wrote:
Lad wrote:
In my web application I use Apache and mod_python.
I allow users to upload huge files( via HTTP FORM , using POST method)
I would like to store the file directly on a hard disk and not to
upload the WHOLE huge file into server's memory first.
Can anyone
In [EMAIL PROTECTED], Jan Theodore
Galkowski wrote:
Guido was opposed to modifying builtin types before Java existed. It's
similar to his opposition to dynamic syntax.
The other is placing those builtins at the top of their own object
hierarchy. Is int, properly speaking, a descendent of
Jan Theodore Galkowski wrote:
We've not had
an excellent dynamic OO language since Smalltalk, IMO.
I would say that excellence in object oriented programming is not a
strong design goal of Python. Python tries to support OOP well, but
not to enhance OOP to the detriment of other, more
class model:pass
class view:
model()
class controller:
model()
I can instantiate clsss model from inside class view but I can't
instantiate class model from inside controller, due to the nature of
python interpreter.
I wish to circumvent this restriction by:
class model:pass
Sebastian 'lunar' Wiesner [EMAIL PROTECTED] writes:
Just a tip for you: In python you never use tabs for indentation.
For some value of you.
The python style guide [1] recommends four spaces per indentation
level.
[1] http://www.python.org/dev/peps/pep-0008/
It's not quite absolute on the
Pyenos wrote:
class model:pass
class view:
model()
class controller:
model()
I can instantiate clsss model from inside class view but I can't
instantiate class model from inside controller, due to the nature of
python interpreter.
I wish to circumvent this restriction
class Model:
Controller()
class View:
Model()
class Controller:pass
Python interpreter complains that 'Name Error: Controller()' not defined.
--
http://mail.python.org/mailman/listinfo/python-list
Edward Kozlowski [EMAIL PROTECTED] writes:
Pyenos wrote:
class model:pass
class view:
model()
class controller:
model()
I can instantiate clsss model from inside class view but I can't
instantiate class model from inside controller, due to the nature of
python
At Wednesday 27/12/2006 17:33, eldorado wrote:
Yes, I was running this on a box that had 1.4 - I just tested it on a box
that has 2.3.5 and it runs perfect. Your changes also allow it to be run
on the boxes that still have 1.4
Ouch! 1.4 is really really ancient! Even the most conservative
Pyenos [EMAIL PROTECTED] writes:
class Model:
Controller() #problem
class View:
Model()
class Controller:pass
Python interpreter complains that 'Name Error: Controller()' not defined.
Following Edward Kozlowski's advice I can suggest to myself a solution:
At Tuesday 26/12/2006 21:06, Steven D'Aprano wrote:
It just feels so ugly to use try/except to enable the variable but I've
found it useful at least once.
That's a matter of taste. Try replacing the try...except block with
hasattr:
def doStuff():
if hasattr(doStuff, timesUsed):
but it's still not quit handy
# initialization file (init1.py)
import time;
xx = 44
# main file was
print xx
x=time.time()
# main file should become
print init1.xx
x=init1.time.time()
so even for the standard functions like time I've to include the
preceeding module init1 :-(
1 - 100 of 138 matches
Mail list logo