* Kent Johnson <[EMAIL PROTECTED]> [050526 14:16]:
> John Carmona wrote:
> > Sorry I should have been clearer with the query perhaps.
> > Alan I am just going through the book "Learning Python" written by Lutz and
> > Ascher, and this is part of one exercise. I am still having problem in
> > putt
John Carmona wrote:
> Sorry I should have been clearer with the query perhaps.
> Alan I am just going through the book "Learning Python" written by Lutz and
> Ascher, and this is part of one exercise. I am still having problem in
> putting my head around in writting even very simple script. I can
Quoting Mark Kels <[EMAIL PROTECTED]>:
> I want to make a program to lock folders (so the user can only access
> them if he knows the password) under win32, the only problem is that I
> have no idea how to start or what to do. Do you guys have any ideas of
> how to do it?
Is your program going to
> I have to write a function that will return the index of a line like
this:
>
> gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU
>
> where it first becomes capital letters.
I'd go with a regex search for that one...
Alan g.
___
Tutor maillist - Tutor@python.org
> Rumor has it that Alan G may have mentioned these words:
>
> >Consuming 100% CPU won't make much difference, the CPU is running
all
> >the time anyway (when its not asleep).
>
> Not mine... my laptop runs a Crusoe processor, and it can
automatically
> scale itself from 300Mhz to 933Mhz. It's cal
Hi John,
> Alan I am just going through the book "Learning Python" written by
Lutz and
> Ascher, and this is part of one exercise.
I suspected it might be something you were doing just to explore.
Lutz and Ascher is a great book but they do assume some knowledge
of programming and computer concep
Pujo, Alan, John and Ben, thanks for the input.
Sorry I should have been clearer with the query perhaps.
Alan I am just going through the book "Learning Python" written by Lutz and
Ascher, and this is part of one exercise. I am still having problem in
putting my head around in writting even very
> Is there a way to create an empty function definition with no lines
of code
> in it? In my coding style I will often do this ( in other
languages ) for
> RAD just to remind myself that I will need to implement the function
later.
>
Use pass
def f(): pass
also works for classes:
class MyClass:
> i'm trying to write a code that handle errors help
>
> def print_menu(): ...
Personally I try to get the menu function to return the value selected
that way the meniu options and the code to check it is all wrapped
up in the same place.
But that is only a side issue...
> while menu_choice != 5
On 26 May 2005 [EMAIL PROTECTED] wrote:
> One of the worst I think was doing loads of real spazzy stuff trying to
> split whole files in to lists of letters and use string methods to find
> the first uppercase one.
Hi Chris,
An approach like this might work. Rather than read the whole thing i
On Thu, 26 May 2005, Mark Kels wrote:
> I want to make a program to lock folders (so the user can only access
> them if he knows the password) under win32, the only problem is that I
> have no idea how to start or what to do. Do you guys have any ideas of
> how to do it?
Hi Mark,
Out of curios
One of the worst I think was doing loads of real spazzy stuff trying to
split whole files in to lists of letters and use string methods to find the
first uppercase one.
The re tutorial has sorted it out for me. I figured this was the way to go,
I just couldn't work out how to get the index valu
On 26 May 2005 [EMAIL PROTECTED] wrote:
> I have to write a function that will return the index of a line like this:
>
> gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU
>
> where it first becomes capital letters. I've had about a hundred
> different ideas of the best way to do this, but always seem to hit
An alternative to pass is
raise NotImplementedError
This has the advantage/disadvantage of providing a meaningful exception
when you start testing and forget to provide some processing logic for a
stub function. pass will simply return None when used for a function
body. I nearly always
On Thu, 26 May 2005, William O'Higgins wrote:
> I am running into problems with script evaluation order - specifically,
> the Python interpreter seems to read and execute scripts line by line.
Hi William,
Ah! This happens to me too; one common idiom to avoid definition-order
issues like this
Hi,
I have to write a function that will return the index of a line like this:
gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU
where it first becomes capital letters. I've had about a hundred different
ideas of the best way to do this, but always seem to hit a fatal flaw. Any
thoughts?
Thanks,
Chris
__
> Is there a way to create an empty function definition with no lines of
> code in it? In my coding style I will often do this ( in other languages
> ) for RAD just to remind myself that I will need to implement the
> function later.
Hi Nick,
I agree with the others; using the no-op statement '
Feziwe Mpondo sanbi.ac.za> writes:
> i'm trying to write a code that handle errors help
I think the indentation was screwed up.
> while menu_choice != 5:
> menu_choice = input("Type in a number (1-5):")
I'd avoid using input. Use raw_input instead.
> break
break stops a loop. So you
Rumor has it that Alan G may have mentioned these words:
> > I'm running an application that has a polling loop to check a serial
>port
> > for certain signals, and on my laptop I can get about 6700 samples
>per
> > second, which (of course) consumes 100% CPU; which may impact
>battery life.
>
>Co
William O'Higgins utoronto.ca> writes:
> This is a problem if you are used to Perl, where the whole script is
> parsed first (Perl also auto-vivifies variables, but that's a different
> problem for a different day). Here is a test script:
The Python compiler parses the whole script too, can't c
Hi John,
you can use 'pass' . This works the same as with exceptions, eg
try:
open('somefile')
except IOError:
pass
so we can have
class doNothing:
def __init__(self):
pass
def boring(self, other):
pass
Hope that helps :)
Nick
--
Thanks Kent!
-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 26, 2005 9:52 AM
To: Gooch, John
Cc: tutor@python.org
Subject: Re: [Tutor] Are Empty "Placeholder" Functions possible?
Gooch, John wrote:
> Is there a way to create an empty function definit
I am running into problems with script evaluation order - specifically,
the Python interpreter seems to read and execute scripts line by line.
This is a problem if you are used to Perl, where the whole script is
parsed first (Perl also auto-vivifies variables, but that's a different
problem for a d
Gooch, John wrote:
> Is there a way to create an empty function definition with no lines of code
> in it? In my coding style I will often do this ( in other languages ) for
> RAD just to remind myself that I will need to implement the function later.
A block cannot be empty but there is a placeho
Is there a way to create an empty function definition with no lines of code
in it? In my coding style I will often do this ( in other languages ) for
RAD just to remind myself that I will need to implement the function later.
Example: For a file handling class, I may need functions such as
copy,d
hi
i'm trying to write a code that handle errors help
def print_menu():
print '1. Print Phone Numbers'
print '2. Add a Phone Number'
print '3. Remove a Phone Number'
print '4. Lookup a Phone Number'
print '5. Quit'
print
numbers = {}
menu_choice = 0
print_menu()
while men
Hi list.
I want to make a program to lock folders (so the user can only access
them if he knows the password) under win32, the only problem is that I
have no idea how to start or what to do. Do you guys have any ideas of
how to do it?
Thanks!
--
1. The day Microsoft makes something that doesn'
Ron Phillips wrote:>> short version: I need a way to get max and min E and N out of >> [(E0,N0),(E1,N1)...(En,Nn)] without reordering the list>>> Kent Johnson [EMAIL PROTECTED]> 5/25/2005 10:19 AM >>>For Python < 2.4 you need another set of [ ] e.g. min([e for e,n in coordList])
I knew I was wo
Or like this:
for x in range (0,256):
print ord(chr(x)), ': ', chr(x)
(you could just print x, instead of ord(chr(x)), but
then you would not be using ord)
Ben
--- Pujo Aji <[EMAIL PROTECTED]> wrote:
> Actually you can do the same way:
>
> # Convert intAscii to charAscii
> S = [chr
> S = [chr(x) for x in range (0,256)]
> for x in S:
> print x,
for x in range(256): print chr(x),
> The next step is to use the built-in functin ord() in order to
convert each
> character to an ASCII integer.
That will give you the numbers 0..255
ord() is simply the inverse of chr()
so tha
> And if I'm on Linux or programing for Mac?
Sadly sound is one of those things that tends to be
system dependant. There is a Sun audio module somewhere too...
On the Mac I believe its a Quicktime thing using the MacPython
libraries.
The good news is that I think PyGame provides a platform inde
Actually you can do the same way:
# Convert intAscii to charAscii
S = [chr(x) for x in range(0,256)]
for x in S: print x
#Convert charAscii to intAscii
AsciiInt = [ord(x) for x in S]
for x in AsciiInt: print x
Best Regards,
pujo
On 5/26/05, John Carmona <[EMAIL PROTECTED
32 matches
Mail list logo