Re: [Tutor] creating Turtle() object using 2 different ways

2014-02-01 Thread spir

On 01/31/2014 10:38 PM, Alan Gauld wrote:

If you want multiple turtles you should use
the first version.


Yes, the turtle module has a global turtle that can be used by people playing 
with a single turtle, and prefere conventional procedural programming style, 
rather than object-oriented (OO). If you need multiple turtle or prefere OO, 
then you need to first create an OO turtle as you did, using turtle.Turtle().

(It's all explained in the docs: http://docs.python.org/3/library/turtle.html :
<< The turtle module provides turtle graphics primitives, in both 
object-oriented and procedure-oriented ways. >> )


d



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-02-01 Thread Walter Prins
Hi Bob,

On 31 January 2014 21:59, bob gailer  wrote:
> On 1/29/2014 8:59 PM, scurvy scott wrote:
> I signed up at Dogehouse. What the heck is it? There is no explanation as to
> what it does or what I'd do with it!

I don't know if you're familiar with BitCoin and the concept of the
"pooled mining", but Dogehouse appears to be a bitcoin mining pool.
Basically instead of mining for bitcoins directly alone by yourself,
you pool your mining efforts with a pool of others and then share the
return with the pool: https://en.bitcoin.it/wiki/Pooled_mining
https://en.bitcoin.it/wiki/Why_pooled_mining

Also, I'm not entirely sure if you were being facetious with your
"import requests" comment -- I suspect you were and if so I should not
be commenting on that ;) (and in thaat case please ignore this entire
paragraph), but in case not -- it's a third party module for doing web
interaction that's actually been mentioned a couple of times on this
list: http://docs.python-requests.org/en/latest/

Scurvy Scott: There's nothing really special about printing stuff, so
there's something you're not telling us or that you're not aware of
that's causing your program to behave differently between running it
"in the interpreter" and otherwise (from the command line,
presumably.)  Do you for example have multiple versions of Python
installed?  Are you sure for example you're using the same version of
Python interpreter? (print syntax changed between Python 2.x and 3.x.)
 How are you running it from the command line exactly?

Best regards,

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] help me

2014-02-01 Thread hind fathallah
hi can you answer this question for me plz 
 
Modify the Guess My number program from this chapter so that the player has 
only five guesses. If the player run out of guess, the program should end the 
game and display an appropriately chastising message. ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help me

2014-02-01 Thread Mark Lawrence

On 01/02/2014 04:55, hind fathallah wrote:

hi can you answer this question for me plz
Modify the Guess My number program from this chapter so that the player
has only five guesses. If the player run out of guess, the program
should end the game and display an appropriately chastising message.



Please give your message a sensible subject.  Better still tell us which 
chapter from which book so that we can help you, or copy the contents 
here so that we can see them.  Your Python version and OS are useful as 
well.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help me

2014-02-01 Thread Danny Yoo
On Fri, Jan 31, 2014 at 8:55 PM, hind fathallah
 wrote:
> hi can you answer this question for me plz

[question omitted]

Many of us probably could answer this.

But this is not a homework-answering mailing list.  The problem itself
is not interesting to us.  What is interesting is why the problem is
giving you trouble.  We'd rather focus on where you are having
difficulty: we'd rather help *you*.

Tell us what you've tried, where you're getting stuck, what other
kinds of problems you've done that are similar to this one.  That is,
show us what general problem solving strategies you're using now.
Maybe some of those strategies are not working for you.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Best version for novice

2014-02-01 Thread Ian D
Hi 

Is it better to use python 3 as a newcomer who isn't really going to be writing 
any software as such just using it for learning?

Also in 2.7 I use no subprocess by giving my python exe a -n argument, 
otherwise my canvas program's freeze.

Is this needed also in version 3?

Ta 
  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-02-01 Thread scurvy scott
Please always reply to the tutor list so we can all play with your question.

--sorry about that Bob, I've now hit reply all.

I am stuck at "import requests". Where did you get that module?

--requests is a third party webscraping module.

I signed up at Dogehouse. What the heck is it? There is no explanation as
to what it does or what I'd do with it!

--dogehouse.org is a dogecoin mining pool that allows users to pool CPU/GPU
resources to make mining cryptocurrency more efficient.


Scurvy Scott: There's nothing really special about printing stuff, so
there's something you're not telling us or that you're not aware of
that's causing your program to behave differently between running it
"in the interpreter" and otherwise (from the command line,
presumably.)  Do you for example have multiple versions of Python
installed?  Are you sure for example you're using the same version of
Python interpreter? (print syntax changed between Python 2.x and 3.x.)
 How are you running it from the command line exactly?

Best regards,

Walter

--I'm only using Python 2.7 and yes either running the code live in the
interpreter, which works just fine, or running from command line using
"python programname.py". In this instance, I've named the program
dogeScrape.py, so python dogeScrape.py . I've been messing with python for
a while and have never had this problem before. I've also tried using the
different print syntax for 3.x just to be sure, to no avail.

I've also tried running the code without it being in functions, and just
running it I guess "straight through" or whatever you'd call it, also to no
avail.
The site is implementing its own API in the next week or so, so I just
figured I'd work out these bugs when that happens and maybe some magical
unicorn will cure whatever is ailing me.

Thanks for y'alls help.
Scott


On Sat, Feb 1, 2014 at 5:05 AM, Walter Prins  wrote:

> Hi Bob,
>
> On 31 January 2014 21:59, bob gailer  wrote:
> > On 1/29/2014 8:59 PM, scurvy scott wrote:
> > I signed up at Dogehouse. What the heck is it? There is no explanation
> as to
> > what it does or what I'd do with it!
>
> I don't know if you're familiar with BitCoin and the concept of the
> "pooled mining", but Dogehouse appears to be a bitcoin mining pool.
> Basically instead of mining for bitcoins directly alone by yourself,
> you pool your mining efforts with a pool of others and then share the
> return with the pool: https://en.bitcoin.it/wiki/Pooled_mining
> https://en.bitcoin.it/wiki/Why_pooled_mining
>
> Also, I'm not entirely sure if you were being facetious with your
> "import requests" comment -- I suspect you were and if so I should not
> be commenting on that ;) (and in thaat case please ignore this entire
> paragraph), but in case not -- it's a third party module for doing web
> interaction that's actually been mentioned a couple of times on this
> list: http://docs.python-requests.org/en/latest/
>
> Scurvy Scott: There's nothing really special about printing stuff, so
> there's something you're not telling us or that you're not aware of
> that's causing your program to behave differently between running it
> "in the interpreter" and otherwise (from the command line,
> presumably.)  Do you for example have multiple versions of Python
> installed?  Are you sure for example you're using the same version of
> Python interpreter? (print syntax changed between Python 2.x and 3.x.)
>  How are you running it from the command line exactly?
>
> Best regards,
>
> Walter
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best version for novice

2014-02-01 Thread Alan Gauld

On 01/02/14 18:41, Ian D wrote:


Is it better to use python 3 as a newcomer who isn't really going to be
writing any software as such just using it for learning?


The more important question is which version does your
preferred tutorial use?

Both versions will teach you a lot about programming and Python,
but the tutorial that suits your style of learning best will
most likely determine the version you use since its harder
to learn when the examples don't work!

Although some might argue that fixing them teaches you
even more!


Also in 2.7 I use no subprocess by giving my python exe a -n argument,
otherwise my canvas program's freeze.


I don;t need to do that in any of my Python versions.
Are you by any chance running your code in IDLE? There
used to be issues with idle and subprocesses and
Tkinter. But I thought they'd all been fixed by 2.7...

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best version for novice

2014-02-01 Thread Steven D'Aprano
On Sat, Feb 01, 2014 at 06:41:10PM +, Ian D wrote:
> Hi 
> 
> Is it better to use python 3 as a newcomer who isn't really going to 
> be writing any software as such just using it for learning?

Yes, you should use Python 3, with one proviso: many tutorials, 
especially the older ones, are based on Python 2. That means that you 
either need to find another tutorial, or mentally adjust from Python 2 
to 3 when you read it. That's easy for an experienced user, but perhaps 
not for a beginner.

The differences aren't really that great, no more different than between 
(say) British English and American English, but it may be disconcerting 
for somebody who isn't confident with the language.

Python 3 is the future of Python. All improvements are going into 3, 2 
is only getting bug fixes. If you aren't *required* to stick with Python 
2 for some reason, you should use 3.


> Also in 2.7 I use no subprocess by giving my python exe a -n argument, 
> otherwise my canvas program's freeze.

I'm afraid that I have no idea what you are talking about here, Python 
doesn't accept a -n argument:

[steve@ando ~]$ python2.7 -n
Unknown option: -n
usage: python2.7 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.



Regards,



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best version for novice

2014-02-01 Thread eryksun
On Sat, Feb 1, 2014 at 8:20 PM, Steven D'Aprano  wrote:
>
> I'm afraid that I have no idea what you are talking about here, Python
> doesn't accept a -n argument:

-n is an IDLE option:

If IDLE is started with the -n command line switch it will run in a
single process and will not create the subprocess which runs the RPC
Python execution server.  This can be useful if Python cannot create
the subprocess or the RPC socket interface on your platform.  However,
in this mode user code is not isolated from IDLE itself.  Also, the
environment is not restarted when Run/Run Module (F5) is selected.  If
your code has been modified, you must reload() the affected modules and
re-import any specific items (e.g. from foo import baz) if the changes
are to take effect.  For these reasons, it is preferable to run IDLE
with the default subprocess if at all possible.

With respect to Tkinter, using -n allows your widgets to piggyback on
IDLE's main loop. I looked into this a bit:

In a terminal you usually don't have to manually `update` [1] the
embedded Tcl interpreter's event queue. What happens is the _tkinter
extension module sets the global function pointer PyOS_InputHook to a
function that calls Tcl_DoOneEvent [2]. The readline module calls this
hook about 10 times per second while waiting for input. However,
readline isn't used for IDLE's child process, which gets code from a
socket in a background thread.

[1] http://www.tcl.tk/man/tcl8.5/TclCmd/update.htm
[2] http://www.tcl.tk/man/tcl8.5/TclLib/DoOneEvent.htm
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor