python - Importing Turtle graphics modules -


I believe I have just started

Python 3.3 in turtle graphics, and Started with a YouTube presentation from to Turtle Import * . This allows at least the commands as FD (100) instead of the format I turtle.forward (100) etc.

My questions are:

  1. Am I using an unacceptable shortcut using this format?
  2. How can I stop Python IDL from interpreting every command in this format as "Turtle Graphics"?
  3. "*" What does suffix mean, as is "everything"?

    If I should not ask many questions in a post, I apologize in advance, but they are relevant to each other and it seems logical.

    Normally, yes, you can avoid using the form from the module import * It does this that opens this module (a normal python file), and basically takes every function, class etc. defined in that file and adds it to your namespace. And you are right - * means "everything".

    Therefore, if I wrote a module named foo.py which contained the function named bar 1 , bar2 Etc., from foo import * to allows me to use these functions as I defined it in my current file:

      to foo import * Bar1 () times2 () # etc   

    The main reason is that it performs an unknown task and sections and dumps it in your namespace when you suddenly blue It's difficult to track, for example:

      Import import * import * import * from * example () # Where did it come from? Modules A, B, or C? What if A and B define a # function called 'Example'?   

    You already know about the Import module; Module.function form, but there is a third form which is also useful:

      Turtle import by FD, right, left # etc right (90) FD (100) backwards (300) # throws an error! Forward (300) # throws an error!   

    Now, I want to cherish the tasks, know where they come from, and avoid polluting my namespace.

    However, in your case, I do not worry too much about it since you are using and after learning about using the turtle module, I think that the idiomatic Python Rather than writing, it is more important to focus on that aspect.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -