Thanks again for your thoughts Javier.
You've certainly given me a mouthful to chew on :~) I was thinking
more in terms of "OOP is about code reuse" and trying to equate the
function approach to such with the class methods approach in a
similar way. Obviously I have got my mind wrapped aro
Lee Cullens wrote:
> I was thinking of extending the learning exercise by re-factoring it
> as an OO approach, since it would contain a minimum altered method.
> Being new to OOP also though, I'm confusing myself with how that
> would be best accomplished. My thinking is that class/subclass
In my original post I noted my recent exposure to Python and put up a
little utility to my iDisk asking for a Pythonese/Efficiency/
Generalese critique.
Javier, Kent and Liam were gracious enough to offer comments, which
were greatly appreciated. To follow through with the learning
exercis
On Tue, 7 Jun 2005, The Johnsons wrote:
> how can i get my email address removed, I'm receiving way too many
> emails
Hi Raywood1,
You have a few options. You may want to see if just turning the Tutor
mailing list setting to "Digest Mode" might help. You can do this
through:
http://mail
how can i get my email address removed, I'm
receiving way too many emails
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Well, to make a long story short, this is because I use Python through
another software, Softimage|XSI, and by design a string is required to
pass logic to on-the-fly GUIs. Since XSI implements 3 other languages
(ActivePerl, VBScript and JScript), I suppose this was designed that way
with JScri
Quoting Alan G <[EMAIL PROTECTED]>:
> The other waybthat you can use repr() is by using the backtick
> notation
>
> >>> print `s`
> 'hello'
> >>>
It's worth noting that backticks are going out of fashion --- I think they are
queued for deletion in Py3000. Better to get in the habit of just call
On Tue, 7 Jun 2005, D. Hartley wrote:
> OK. I tried them out and I do see the diffence. (btw, testit1 gave me
> the following error:
>
> Traceback (most recent call last):
> File "", line 1, in ?
> testit1()
> File "", line 3, in testit1
> del fromlist[0]
> IndexError: list assignmen
> The real question is, then, is there a way I can print the code of a
> function as a string? Something like
>
> 'def myFunction: print "hello"'
There is a module for doing black magic like that. I think it may
be the one with the disassembler in it?
Curious as to why you would ever want t
> Possibly I am missing something, but how do you use the repr()
function?
THere are several ways of using repr, the most common is at the >>>
prompt.
>>> x = 5
>>> x
5
>>>
when I typed x at the >>> prompt Python called repr(x) to display the
result. This can be slightly different to using print
Sorry, Terry, forgot to reply to the whole list. Here it is:
-- Forwarded message --
From: D. Hartley <[EMAIL PROTECTED]>
Date: Jun 7, 2005 2:49 PM
Subject: Re: [Tutor] More image manipulation
To: Terry Carroll <[EMAIL PROTECTED]>
Terry,
OK. I tried them out and I do see the dif
> > look to see if stdin is a tty. Unix is usually very careful about
who has a
> > "controlling tty" and who does not. In Python, file objects have
an isatty()
> > method that will return True or False.
> >
> > import sys
> > isinteractive = sys.stdin.isatty()
> > if isinteractive:
> > ...
> > els
On Tue, 7 Jun 2005, Bernard Lebel wrote:
> The real question is, then, is there a way I can print the code of a
> function as a string? Something like
>
> 'def myFunction: print "hello"'
Hi Bernard,
Ah, ok. You can use 'inspect':
http://www.python.org/doc/lib/inspect-source.html
Fo
On Tue, 7 Jun 2005, Terry Carroll wrote:
> On Tue, 7 Jun 2005, D. Hartley wrote:
>
> > def findlist():
> > newlist = []
> > for i in range(480):
> > line = fromlist[:640]
> > del fromlist[:640]
> > x = line.index(195)
> > y = x + 5
> > z = line[x:y]
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Terry Carroll
> Sent: Monday, June 06, 2005 8:20 PM
> To: tutor@python.org
> Subject: [Tutor] Trying Ruby...
>
> This message is not as off-topic as it at first appears.
>
> I'm a user of Activestate'
Ok thanks a lot.
The real question is, then, is there a way I can print the code of a
function as a string? Something like
'def myFunction: print "hello"'
Thanks
Bernard
On 6/7/05, Max Noel <[EMAIL PROTECTED]> wrote:
>
> On Jun 7, 2005, at 20:42, Bernard Lebel wrote:
>
> > repr( myFunc
On Tue, 7 Jun 2005, Bernard Lebel wrote:
> repr( myFunc )
> ''
>
>
>
> s = repr( myFunc() )
> print s
>
> 'None'
In the first example, your repr invocation is:
repr(myFunc)
i.e., you're asking for the repr of the function myFunc.
In the second example, your repr invocation is:
repr(my
On Tue, 7 Jun 2005, D. Hartley wrote:
> def findlist():
> newlist = []
> for i in range(480):
> line = fromlist[:640]
> del fromlist[:640]
> x = line.index(195)
> y = x + 5
> z = line[x:y]
> del line[x:y]
> for i in z:
> n
> Okay then I run
>
> s = repr( myFunc() )
> print s
>
> Wich returns
>
> 'None'
Hi Bernard,
Ok, what do you expect to see instead of 'None'? I ask this to make sure
I understand the situation better.
Best of wishes?
___
Tutor maillist - Tutor@py
EUGENE ASTLEY wrote:
> Python, pygames problem.
>
> At the end of my game, I go back to the desk top after displaying the
> score of the player, as follows:
>
> Def game_over(self)
>
> Games.Message(screen = self.screen,
>
> X = 400, y = 400
>
> Text + “Your Score is
On Jun 7, 2005, at 20:42, Bernard Lebel wrote:
> repr( myFunc )
>
> Wich returns
>
> ''
>
>
> Okay then I run
>
> s = repr( myFunc() )
> print s
>
> Wich returns
>
> 'None'
That's perfectly normal. Your last assignment calls the
function, then assigns to s the representation of the functi
Hello,
Possibly I am missing something, but how do you use the repr() function?
I type this ultra-simple function:
def myFunc(): print 'hello'
Then run
repr( myFunc )
Wich returns
''
Okay then I run
s = repr( myFunc() )
print s
Wich returns
'None'
Thanks
Bernard
__
I'm having trouble getting a script to make an
internet connection with my windows xp laptop with a
wireless connection. It works fine on my desktop with
a dial-up connection;
page = urllib.urlopen(my_URL).read()
gives the message;
Traceback (most recent call last):
File "C:/Python24/test.py",
Python, pygames problem.
At the end of my game, I go back to the desk top after
displaying the score of the player, as follows:
Def game_over(self)
Games.Message(screen = self.screen,
X
= 400, y = 400
Text
+ “Your Score is “ + str(Game.score_value),
Hello, everyone!
If someone has a few seconds, I am getting some weird errors and
Python won't tell me why. What I am trying to do is take a middle
chunk out of a line of an image, place that at the beginning of the
line, and slide the rest over to the end, like so:
111bb
to:
111aa
> I'm trying to call up flac's encoder from a Python program. I
believe I
> should be doing it ok, but I get completely different results when
doing
> it by hand and from the python script. Here's the command line:
>
> $/usr/bin/flac --endian=little --channels=2 --sign=signed --bps=16
> --sample-ra
Can i make a keylogger using python?
has anyone ever made one/tryed to make one?
does any one know how to make one?
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm0
Benjamin Klein-Fignier wrote:
> Hi,
>
> I am wondering if there is a way to efficiently run a double loop in
> Python. To be more precise, I would like to compute the sum of a
> function f(x,y) for every possible (x,y) pair.
How big are your lists (X and Y)?
A few minor suggestions below.
>
Hi,
I am wondering if there is a way to efficiently run a double loop in
Python. To be more precise, I would like to compute the sum of a
function f(x,y) for every possible (x,y) pair.
I have tried several alternatives so far:
1) the classic double loop:
for x in X:
for y in Y:
> If you want to know if your program has been launched from an interactive
> terminal or from a system background process like cron or init, then you
> look to see if stdin is a tty. Unix is usually very careful about who has a
> "controlling tty" and who does not. In Python, file objects have
Just replying to myself because I am extremely dumb, so maybe it will
help someone along the way if the same thing happens.
I forgot to include argv[1], which is basically the same as the name of
the file to be run.
So:
os.execl(tw_comppath, tw_comppath, "--endian=little", "--channels=2",
"--sig
Hi all,
I'm trying to call up flac's encoder from a Python program. I believe I
should be doing it ok, but I get completely different results when doing
it by hand and from the python script. Here's the command line:
$/usr/bin/flac --endian=little --channels=2 --sign=signed --bps=16
--sample-r
Hi all,
I'm trying to call up flac's encoder from a Python program. I believe I
should be doing it ok, but I get completely different results when doing
it by hand and from the python script. Here's the command line:
$/usr/bin/flac --endian=little --channels=2 --sign=signed --bps=16
--sample-r
Hi all,
I'm trying to call up flac's encoder from a Python program. I believe I
should be doing it ok, but I get completely different results when doing
it by hand and from the python script. Here's the command line:
$/usr/bin/flac --endian=little --channels=2 --sign=signed --bps=16
--sample-r
On 6/7/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 6 Jun 2005, Ron Nixon wrote:
>
> > Is there a site like Perl's CPAN for Python? I've seen the stuff at
> > ActiveState. Anything else?
>
> Hi Ron,
>
> Yes, there is a system called 'PyPI':
>
> http://www.python.org/pypi
PyPi i
35 matches
Mail list logo