Re: [Tutor] Python on USB device

2005-03-11 Thread Ralfas Jegorovas
I have just downloaded the package and from what I've seen of it, it looks 
excellent. As a bonus it is quite well documented (always a good thing :-) 
). I'll spend more time playing with it tommorow hopefully.

Thanks for your help.
All the best,
Ralf
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python on USB device

2005-03-11 Thread Brian van den Broek
Ralfas Jegorovas said unto the world upon 2005-03-11 20:33:
Hi everyone,
I would like to know if it is possible to install python on a usb device 
and run it. I found some references to this topic in the archives but I 
didnt find the information conclusive. Any information would be 
appreciated.

Ralf

 is the home of Movable 
Python developed by Michael Foord and Bruno Thoorens.

I've not tried it, but I do know that the contact developer (Foord AKA 
Fuzzyman) is a very friendly and helpful guy, who would almost 
certainly be happy to help you if you get stuck.

(I would be interested to hear how it went if you do try it.)
Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help me please!!!

2005-03-11 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-03-11 20:21:
ok i just restarted my pc and it works now thank you ..ok when i go to the 
start menu then go to all programs then to python 2.4 it gives me five things ok 
it says IDLE (python GUI)
Module Docs
python (command line)
python manuals
uninstall python
 When i click on IDLE (python GUI) the screan pops up and at the top it say 
python shell

*PLEASE* Reply to All.
(For the reasons Danny Yoo mentioned. More than once.)
Yes, the window that pops up and is entitled 'Python Shell' is IDLE's 
enhanced python shell. I believe that 'python shell' (without further 
modification) is conventionally understood to mean the bare Python 
shell one gets from clicking on  Python (command line). (That is the 
same you get by opening a DOS box and typing Python.)

The IDLE shell is only a part of the IDLE program. (Try File->New 
Window. Now you've got an IDLE editor window where you can write, 
save, and load scripts.[1].) The IDLE shell is enhanced by things such 
as syntax highlighting, and, compared to the bare shell on my Windows 
version at least, a scrollable and saveable history. There are also 
things that won't work well from the IDLE shell -- since it is itself 
a Python Tkinter GUI program, running a Tkinter GUI program from 
within it doesn't work too well.

[1] To stave off future worries -- when saving a script from IDLE, you 
have to explicitly give it the .py extension if you want your script 
to have it. (You do -- it makes it runable in Windows by double-click 
on the icon and tells IDLE to use the Python syntax highlighting which 
makes editing Python code much easier.)

Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python on USB device

2005-03-11 Thread Ralfas Jegorovas
Hi everyone,
I would like to know if it is possible to install python on a usb device and 
run it. I found some references to this topic in the archives but I didnt 
find the information conclusive. Any information would be appreciated.

Ralf
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help me please!!!

2005-03-11 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-03-11 19:00:
Ok some thing is messed up.. when i try to open the python shell i get a 
error meesage saying  socket error:connection refused and the head line at the 
top says IDLE subprocess error.. and then the python shell pops up with a 
error message on it saying. IDLE's subprocess didn't make connention. 
Either IDLE can't start or personal firewall software is blocking the connection. 
and the head line at the top says subprocess startup error..
and i did not even have to be online to use to befor i don't know what it 
problem is please help me..lol..thank you!!!

Hi,
IDLE isn't the python shell.
You appear to be on Windows XP. A python shell is what you get when 
you open a command prompt (a DOS prompt on older Windows version; I 
don't know XP) and type python.

IDLE is a basic Integrated DeLopment Environment with an enhanced shell.
The problem you are experiencing with IDLE is a known bug. When it 
occurs, open up your task manager (CTRL + ALT + DEL on pre-XP Windows 
at least) and look for a Python related process (one with python in 
the name). Kill it. Try launching IDLE again. You should be fine 
thereafter.

There is more information about this bug (and a more permanent fix) in 
one or both of the archives of this list and of the edu-sig list.

Last, as a windows user, you might be interested in PythonWin. It is 
part of the Windows extensions by Mark Hammond 
. The editor is a bit nicer 
and more featurefull than that of IDLE. If you try that and have 
problems running it consistently (I did) see 


Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help me please!!!

2005-03-11 Thread Jeff420harris00
Ok some thing is messed up.. when i try to open the python shell i get a error meesage saying  socket error:connection refused and the head line at the top says IDLE subprocess error.. and then the python shell pops up with a error message on it saying. IDLE's subprocess didn't make connention. Either IDLE can't start or personal firewall software is blocking the connection. and the head line at the top says subprocess startup error..
and i did not even have to be online to use to befor i don't know what it problem is please help me..lol..thank you!!!
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please help me get started on how to program useing python 2.4!!! (fwd)

2005-03-11 Thread Danny Yoo
[Forwarding to [EMAIL PROTECTED]  Sorry about the repetition.]


-- Forwarded message --
Date: Fri, 11 Mar 2005 17:18:03 EST
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [Tutor] Please help me get started on how to program useing
python 2.4!!!

ok heres where i got the for,in, and
rangehttp://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html
and i tryed what it say and the...print "hello world"..and the next step
works...print "here are the ten numbers from 0 to 9".but the next dose 
not...
for i in range(10):
  print i,..


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please help me get started on how to program useing python 2.4!!! (fwd)

2005-03-11 Thread Danny Yoo
[Forwarding to [EMAIL PROTECTED]  Please use your email client's
"Reply-to-all" feature whenever you're replying to messages on the tutor
list.  Otherwise, no one else gets to see your questions.]


-- Forwarded message --
Date: Fri, 11 Mar 2005 17:07:15 EST
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [Tutor] Please help me get started on how to program useing
python 2.4!!!

ok i understand some of that like the = things being ture or false but i am
not realy wanting to know if its = or not, i was just trying to figer out how
to make a progarm or just program... and figer out the language..lol.if you
can help me do that i would
be realy thankful

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Installing Python....Getting Started (fwd)

2005-03-11 Thread Danny Yoo

[Forwarding to [EMAIL PROTECTED]  When you are replying to a message,
please use your email's "Reply-to-All" feature so that your message
reaches both me and the mailing list.]


-- Forwarded message --
Date: Fri, 11 Mar 2005 22:38:55 +0100
From: Jan EkstrÃm <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Installing PythonGetting Started

  Thank you for Your answer.
  I felt fresh air in my face.


  I got the instruction to start like this below


  What will we cover?
  How to start Python and what an error message looks like - just in
case...


For the next set of exercises I will assume you have a properly installed
version of Python on your computer. If not, go fetch the latest version from
the Python web site and follow the install instructions for your platform.

Now from a command prompt type python and the Python prompt should appear
looking something like this:

Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Alternatively you might find a shortcut to something called IDLE, or the
Python GUI, in your start menus. If you start IDLE instead of the command
line version you will get a similar prompt but in a window of its own and
with some pretty font colors! Danny Yoo has written a pretty good IDLE
Tutorial to get you started with IDLE and I recommend you pay it a visit if
you want to stick with it rather than the basic command prompt. It
duplicates some of the early material here but repetition of the basics is
no bad thing!

Jan





- Original Message -
From: "Danny Yoo" <[EMAIL PROTECTED]>
To: "Jan EkstrÃm" <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, March 11, 2005 10:11 PM
Subject: Re: [Tutor] Installing Python




On Fri, 11 Mar 2005, [iso-8859-1] Jan Ekstrm wrote:

> I have tried to install Python 2.4 on two pc-s and get this error when I
> follow the instruction and type python at the comand window or Idle
> window. I am running Windows xp home edition. What am I doing wrong?
>>
> Here is the error.
> IDLE 1.1
> >>> python
>
> Traceback (most recent call last):
>   File "", line 1, in -toplevel-python
> NameError: name 'python' is not defined


Hi Jan,

If you see that message, you're actually ok, because you're already in
Python!  *grin*

When you see the '>>> ' prompt, you're in Python's system.  You're doing
fine.

By the way, you may find this tutorial helpful:

http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

It's a little outdated; one of these days, I will update the screenshots
and fix some of the menu commands.  (For example, "Run Script" moved over
into the "Run" menu, and is renamed to "Run Module".)


If you have more questions, please feel free to ask!



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please help me get started on how to program useing python 2.4!!!

2005-03-11 Thread Brian van den Broek
Danny Yoo said unto the world upon 2005-03-11 16:07:
On Fri, 11 Mar 2005 [EMAIL PROTECTED] wrote:

When we ask: "Is the number 'one' greater than the number 'two'?", Python
is telling us "No!" by giving us back the value 'False'.  Whenever we ask
Python a question that's a yes/no sort of thing, Python will respond with
a value like 'True' or 'False'.
We can also compare strings to see if a word is "bigger" than another
word, based on where it might be located in a dictionary.  For example:
###
"application" < "applied"
True
"applied" < "application"
False
###
A slight refinement of what Danny said: for strings, comparisons 
determine which string is "bigger" based on a concept of `dictionary 
order' where  x is `bigger' than y if it comes later in a dictionary 
which puts uppercase letters before lower case ones.

Hence:
>>> 'z' < 'a'
False
>>> 'Z' < 'a'
True
>>>
Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Installing Python

2005-03-11 Thread Danny Yoo


On Fri, 11 Mar 2005, [iso-8859-1] Jan Ekström wrote:

> I have tried to install Python 2.4 on two pc-s and get this error when I
> follow the instruction and type python at the comand window or Idle
> window. I am running Windows xp home edition. What am I doing wrong?
>>
> Here is the error.
> IDLE 1.1
> >>> python
>
> Traceback (most recent call last):
>   File "", line 1, in -toplevel-python
> NameError: name 'python' is not defined


Hi Jan,

If you see that message, you're actually ok, because you're already in
Python!  *grin*

When you see the '>>> ' prompt, you're in Python's system.  You're doing
fine.

By the way, you may find this tutorial helpful:

http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

It's a little outdated; one of these days, I will update the screenshots
and fix some of the menu commands.  (For example, "Run Script" moved over
into the "Run" menu, and is renamed to "Run Module".)


If you have more questions, please feel free to ask!

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please help me get started on how to program useing python 2.4!!!

2005-03-11 Thread Danny Yoo


On Fri, 11 Mar 2005 [EMAIL PROTECTED] wrote:

> OK i have learned that on the python shell if you put, print "some
> message" the output is, some message

Hi Jeff,


Ok, yes, that looks right.  Let me do that myself:

###
>>> print "hello world"
hello world
###

(The '>>>' thing is what the Python shell prints out, as a "prompt" to
tell me that it's ready to read more commands).




> and if you put, type > "some message" the output is, true
>
> and if you put, type< "some message" the output is, false



H!  Let me make sure I understand:  are you doing this?

###
>>> type < "some message"
False
>>>
>>>
>>> type > "some message"
True
###

What we are asking Python here is actually a bit weird: we are asking it
to compare the 'type' function to see if it's either "less than" or
"greater than" the string 'some message'.

Did you get these expressions from some online tutorial?  If so, point us
to that tutorial, so I can bonk the author.  *grin*

How are you learning Python?  Are you going through a book, or through
some web page tutorial?


[Note for advanced users: I know that Python will give something that will
return some consistent result.  According to:

http://www.python.org/doc/ref/comparisons.html

"Most other types compare unequal unless they are the same object; the
choice whether one object is considered smaller or larger than another one
is made arbitrarily but consistently within one execution of a program."

So what Jeff is seeing is a completely arbitrary result, and it's not even
guaranteed to be the same between program executions!  That's why I think
it's the wrong thing to show because it's hard to explain.  And I think
it's a terrible idea to show something like that to a beginner since it's
not something that a sensible programmer would normally do anyway.]



Jeff, I think it might make more sense to compare two things that are the
same kind of thing.  For example, it should make more sense to compare two
numbers to see if one is bigger than the other:

###
>>> 1 > 2
False
>>> 2 > 1
True
###

When we ask: "Is the number 'one' greater than the number 'two'?", Python
is telling us "No!" by giving us back the value 'False'.  Whenever we ask
Python a question that's a yes/no sort of thing, Python will respond with
a value like 'True' or 'False'.


We can also compare strings to see if a word is "bigger" than another
word, based on where it might be located in a dictionary.  For example:

###
>>> "application" < "applied"
True
>>> "applied" < "application"
False
###


In technical terms, we are giving Python expressions that "evaluate" to a
"boolean" value: we're asking Python questions, and it's saying True or
False.  Does this make sense so far?  If not, please continue to ask
questions, and we'll try to show things more clearly.



> And if you put, for, in, or and it turns orange like print dose but I
> don't know why?

If you're using IDLE, then stuff that shows up as orange when it's a
special kind of "keyword".

A keyword is a word that Python knows is a special word.  When you learn
more about Python, you'll see a few more of these keywords.  The orange
coloring is there just to make them stand out from the rest of your
program, and doesn't have any other significance, other than just being
colorful.  *grin*


If you have questions on any of this, please feel free to ask.  Best of
wishes to you!

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Installing Python

2005-03-11 Thread Jan Ekström



I have tried to install Python 2.4 on two pc-s and get this error when 
I follow the instruction and type
python at the comand window or Idle window.
I am running Windows  xp home edition.
What am I doing wrong?
I have also ask for explanation on Googles and got the answer that there is 
such a problem but can'not understand the message.
Sincerely
Jan Ekström
Here is the error.IDLE 1.1  
>>> python
 
Traceback (most recent call last):  File "", line 
1, in -toplevel-pythonNameError: name 'python' is not 
defined>>> 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


RE: [Tutor] and once i have learned how to program ?

2005-03-11 Thread Kooser, Ara S
Title: RE: [Tutor] and once i have learned how to program ?






http://starship.python.net/crew/theller/py2exe/

This website is a good starting point.

Ara


-Original Message-
From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent: Fri 3/11/2005 12:26 PM
To: tutor@python.org
Subject: [Tutor] and once i have learned how to program ?

Once i have learned how to program what can i do with the programs can they
run out side of the python shell like on My OS or a game? My OS is window XP
home





___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] and once i have learned how to program ?

2005-03-11 Thread Paul Tremblay
On Fri, Mar 11, 2005 at 02:26:48PM -0500, [EMAIL PROTECTED] wrote:
> From: [EMAIL PROTECTED]
> Date: Fri, 11 Mar 2005 14:26:48 EST
> To: tutor@python.org
> Subject: [Tutor] and once i have learned how to program ?
> 
> Once i have learned how to program what can i do with the programs can they 
> run out side of the python shell like on My OS or a game? My OS is window XP 
> home



Yes, python will act like any other program, such as C++. If you want to
use python to run a gui (graphical user interface), then you would use
Tinker. Just to give you an idea, I just downloaded a program called
skencil. I get in the shell and type "skencil". I then get a window for
to draw in. I take my mouse and make lines and drawings. I point my
mouse to the file window and pull down the menu for save to save my
document. So the application works exactly like, say, Adobe Draw, with
small difference that I had to start it form my shell. I'm pretty sure
there are ways to start applications without a shell. That isn't too
hard. The hard part is writing a program with a graphical interface.
This is always hard, in any languge. 

Paul

-- 


*Paul Tremblay *
[EMAIL PROTECTED]*

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] and once i have learned how to program ?

2005-03-11 Thread Jeff420harris00
Once i have learned how to program what can i do with the programs can they run out side of the python shell like on My OS or a game? My OS is window XP home
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Please help me get started on how to program useing python 2.4!!!

2005-03-11 Thread Jeff420harris00
OK i have learned that on the python shell if you put, print "some message"
the output is, some message   and if you put, type> "some message"
the output is, true    and if you put, type< "some message"
the output is, false   And if you put, for, in, or and it turns orange like print dose but I don't know why? 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Can you get python to force a number to remain 32 bit instead of autoconverting to type 'long'?

2005-03-11 Thread Kent Johnson
R. Alan Monroe wrote:
I tried to convert this pseudocode
function IntNoise(32-bit integer: x)
x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fff) / 1073741824.0);
end IntNoise function

from this website
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
to python. But it seems to rely on wraparound within the 32 bit int.
Can you duplicate this behavior in python?
If you haven't figured this out I suggest you ask on comp.lang.python.
Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] cyclically rotate a seq

2005-03-11 Thread Kent Johnson
kevin parks wrote:
Hi folks,
I am trying to cyclically rotate a seq until it reached the beginning 
stage again.
I would like to be able to rotate in both directions and using any 
arbitrary interval.
I think the code is correct but I have a few suggestions below.
#!/usr/bin/env python
import sys
import random

If you make these comments into a docstring (a triple-quoted string that starts the method) then 
they will be accessible to IDEs, help(rotate), etc.

# cyclically rotate a sequence
# -- 
# should work on any sequence type
# should work with any hop(n) interval
# should also work in both directions (left or right)
# -- 
def rotate(seq, n=1):
if len(seq) == 0:
return seq
I would also check for seq == None. An easy way to check for both None and 
an empty sequence is
  if not seq:
return seq
This will reject also a few other things you probably don't care about such as the number 0 and an 
empty dict...

# Normalize n, using modulo - even works for negative n
n = n % len(seq)
return seq[n:] + seq[:n]
   
def test():
start = 1
x = [7, 2, 1, 0, 11, 6, 5, 4]
print; print x; print '--' * 8
for i in range(len(x)):
If you use
  for i in range(1, len(x)+1)
then you don't need start, i will have the same value
out = rotate(x, start)
print out
start = start + 1
Your test is not nearly as thorough as your docs suggest. You don't test rotation by a negative 
number or by a number bigger than len(x).

You might want to write this as a unittest so the results are checked automatically instead of you 
having to eyeball them each time. Here is a start:

import unittest
class RotateTest(unittest.TestCase):
def test_rotate(self):
x = [7, 2, 1, 0, 11, 6, 5, 4]
out = rotate(x, 1)
self.assertEquals([2, 1, 0, 11, 6, 5, 4, 7], out)
out = rotate(x, -1)
self.assertEquals([4, 7, 2, 1, 0, 11, 6, 5], out)
if __name__ == '__main__':
unittest.main()
Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor