[Tutor] Using goto or labels in Python?

Raphael Raphael raphael_raphael at hotmail.com
Wed Feb 11 11:44:31 CET 2015


Hello,

Is there a way in which people have found to use goto or labels in Python?thank you.

Sent from my iPhone

> On Feb 11, 2015, at 12:27 PM, tutor-request at python.org wrote:
> 
> Send Tutor mailing list submissions to
>    tutor at python.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>    https://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>    tutor-request at python.org
> 
> You can reach the person managing the list at
>    tutor-owner at python.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Wondering if there is a print in location command for
>      terminal? (eryksun)
>   2. Timeline Script in Python (Siya Radebe)
>   3. Re: Timeline Script in Python (Alan Gauld)
>   4. Asking for help with installation of pyttsx (text to speech)
>      (Andrew K.)
>   5. Importing from classes (daaku gee)
>   6. Re: Asking for help with installation of pyttsx (text to
>      speech) (Alan Gauld)
>   7. Re: Importing from classes (Alan Gauld)
>   8. Re: Importing from classes (Steven D'Aprano)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 10 Feb 2015 08:29:56 -0600
> From: eryksun <eryksun at gmail.com>
> To: Alan Gauld <alan.gauld at btinternet.com>
> Cc: tutor at python.org
> Subject: Re: [Tutor] Wondering if there is a print in location command
>    for    terminal?
> Message-ID:
>    <CACL+1atmYRr1_K2nRZTPiTwFvdMxo4OA+t32hbcR-Vf_H8_m0Q at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
>> On Tue, Feb 10, 2015 at 3:02 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>> msvcrt wraps the Microsoft Vis C Runtime functions which don't
>> include positional commands.
>> 
>> Conio was a DOS library developed by the compiler makers as a way to access
>> the BIOS calls and has a gotoXY() and similar functions. It first appeared,
>> as I recall, in Turbo Pascal but was later picked
>> up by the C compilers as well.
>> There are at least 2 libraries on PyPi that simulate conio
> 
> OK, the only conio I was aware of was the conio.h API provided by
> various C runtime libraries on Windows, as described here:
> 
> https://en.wikipedia.org/wiki/Conio.h
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 10 Feb 2015 18:29:46 +0200
> From: Siya Radebe <siya at goodhost.co.za>
> To: tutor at python.org
> Subject: [Tutor] Timeline Script in Python
> Message-ID: <4AF81C6C-BB16-4278-91E7-A70010D1A51D at goodhost.co.za>
> Content-Type: text/plain;    charset=us-ascii
> 
> Hi,
> 
> Can you please help with a timeline script in python, in conjunction with how to use their timeline library?
> 
> I would love advise of how to best approach this, in going about developing an event/ activity stream timeline
> 
> I found two different libraries, one from Python, and other from Django which is best, and how do i go about developing the script to show a timeline of events?
> 
> https://pypi.python.org/pypi/timeline/0.0.1 <https://pypi.python.org/pypi/timeline/0.0.1>
> 
> https://pypi.python.org/pypi/django-admin-timeline <https://pypi.python.org/pypi/django-admin-timeline>
> 
> Looking forward to your favorable response
> 
> Kind Regards,
> Siya
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 10 Feb 2015 18:59:15 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Timeline Script in Python
> Message-ID: <mbdke3$r3q$1 at ger.gmane.org>
> Content-Type: text/plain; charset=windows-1252; format=flowed
> 
>> On 10/02/15 16:29, Siya Radebe wrote:
>> Hi,
>> 
>> Can you please help with a timeline script in python, in conjunction with how to use their timeline library?
> 
> Thus list is for those learning the Python language and its standard 
> library.
> Any information about third party modules will depend on whether anyone 
> here has used it, usually you are better asking on a dedicated forum (or 
> via email to the author) Django has a user forum, the PyPI package may not.
> 
> 
>> I would love advise of how to best approach this, in going about developing an event/ activity stream timeline
> 
> I think you need to be more specific about what you want to do.
> Are you building it in real-time or from a database analysis?
> What volume of events do you need to deal with?
> etc...
> 
> 
> HTH
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Tue, 10 Feb 2015 22:37:28 -0500
> From: "Andrew K." <ankos at live.com>
> To: <tutor at python.org>
> Subject: [Tutor] Asking for help with installation of pyttsx (text to
>    speech)
> Message-ID: <COL128-DS20F6A0C69C194534CFC473DB250 at phx.gbl>
> Content-Type: text/plain;    charset="koi8-r"
> 
> To whom it may concern.
> 
> I started the project CrocToy, a complex robotic toy in a form of a crocodile. I would like to use Python as programming platform. Having limited programming skills, I have troubles with software development. Particularly, right now I try to learn how to use pyttsx (text to speech). I would be very grateful for any help with installation and programming. 
> Thank you very much,
> Andrew
> PS 
> I would be very thankful if any mature Python programmer would like to participate in my project.
> Thank you,
> Andrew
> 
> ------------------------------
> 
> Message: 5
> Date: Tue, 10 Feb 2015 18:39:50 -0800
> From: daaku gee <daaqou at gmail.com>
> To: tutor at python.org
> Subject: [Tutor] Importing from classes
> Message-ID:
>    <CAH53p94+UHzGHyi1ap0-VBjcNVQkNs=ShUSxGxD4pbvNvf_w3w at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> Hi
> 
> When importing from other modules, I've seen syntax like:
> 
> import from <module> <Class>
> import <module>
> 
> And another one:
> import from <module> <Class> as <some_name>
> 
> Is one better than the other or is it just personal choice?
> 
> Thanks
> \d
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Wed, 11 Feb 2015 09:24:27 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Asking for help with installation of pyttsx (text
>    to    speech)
> Message-ID: <mbf74b$dn$1 at ger.gmane.org>
> Content-Type: text/plain; charset=windows-1252; format=flowed
> 
>> On 11/02/15 03:37, Andrew K. wrote:
>> 
>> I started the project CrocToy, a complex robotic toy in a form of a crocodile.
>> I would like to use Python as programming platform.
>> Having limited programming skills, I have troubles with software
> development.
> 
> This much we can help with since the list is here for those learning 
> Python and programming in general.
> 
>> Particularly, right now I try to learn how to use pyttsx (text to speech).
> 
> But we do limit ourselves to the standard library modules so for 
> anything else you will be gambling on somebody here already having
> used it. Usually you are better sending module specific queries to the 
> module support forum (or the author.)
> 
>> I would be very grateful for any help with installation and programming.
> 
> Do you have any specific queries? The more specific the query the more 
> specific the answer will be.
> 
> Please include details of your OS and Python version.
> 
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Wed, 11 Feb 2015 09:32:02 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Importing from classes
> Message-ID: <mbf7ii$7ti$1 at ger.gmane.org>
> Content-Type: text/plain; charset=windows-1252; format=flowed
> 
>> On 11/02/15 02:39, daaku gee wrote:
>> 
>> When importing from other modules, I've seen syntax like:
>> 
>> import from <module> <Class>
> 
> from <module> import <name>
> 
> Note you don't import classes from modules you import names.
> (The name might be the name of a class of course!)
> 
> This form is for cases where you only want to use one or two features of 
> a module and don't want to have the inconvenience of typing the module 
> name in front each time you use them.
> 
>> import <module>
> 
> This is the normal usage. It gives you indirect access to all of the 
> module features using the <module>.<name> notation
> 
>> import from <module> <Class> as <some_name>
> 
> import <module> as <alias>
> or
> from <module> import <name> as <alias>
> 
> These tend to be used where the module has a very long name that
> you don't want to type out in full each time, so you give it a
> shorter alias.
> You might also use it if you are working on code that already has
> a variable with the same name as the module/feature that you want
> to import. You either rename all your variable references or you
> choose an alias that does not conflict.
> 
>> Is one better than the other or is it just personal choice?
> 
> 'better' is often a subjective term.
> There are reasons for each as described above.
> What is best depends on the circumstance. If in
> doubt use
> 
> import <module>
> 
> HTH
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Wed, 11 Feb 2015 21:18:17 +1100
> From: Steven D'Aprano <steve at pearwood.info>
> To: tutor at python.org
> Subject: Re: [Tutor] Importing from classes
> Message-ID: <20150211101817.GZ2498 at ando.pearwood.info>
> Content-Type: text/plain; charset=us-ascii
> 
>> On Tue, Feb 10, 2015 at 06:39:50PM -0800, daaku gee wrote:
>> Hi
>> 
>> When importing from other modules, I've seen syntax like:
>> 
>> import from <module> <Class>
>> import <module>
>> 
>> And another one:
>> import from <module> <Class> as <some_name>
> 
> Not quite. The syntax is:
> 
> import <module>
> 
> import <module> as <new name>
> 
> from <module> import <object>  # not necessarily a class
> 
> from <module> import <object> as <new name>
> 
> 
>> Is one better than the other or is it just personal choice?
> 
> As far as Python is concerned, there is no difference at all. The "as 
> name" version just lets you pick a different name, usually to save 
> typing:
> 
> import module_with_a_really_long_name as module
> 
> 
> Obviously the usual rule for naming things applies here too: names 
> should be meaningful, they should not lie, or be confusing:
> 
> # Bad ideas.
> import math as string  # What? 
> import string as fred
> import os as barney
> 
> Beware of names which are easily confused, or have common meanings:
> 
> - try to avoid `l` and `I` because in some fonts they look like 1
> - same for `O` and 0
> - i is normally used for for-loop counters and other integers
> - n is also used for integers
> - x and y for floats
> 
> But apart from that, the names you choose are entirely up to you.
> 
> 
> -- 
> Steve
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> https://mail.python.org/mailman/listinfo/tutor
> 
> 
> ------------------------------
> 
> End of Tutor Digest, Vol 132, Issue 21
> **************************************


More information about the Tutor mailing list