Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-03 Thread Cameron Simpson
On 03Aug2017 00:57, Steven D'Aprano wrote: Can you explain the use-case for when somebody might want to use console_scripts entry points? I have a module with a main() function and an "if __name__ == ..." guard. Under what circumstances is that not sufficient, and I would

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread eryk sun
On Wed, Aug 2, 2017 at 4:06 PM, Wolfgang Maier wrote: > On 08/02/2017 04:57 PM, Steven D'Aprano wrote: > >> I have a module with a main() function and an "if __name__ == ..." >> guard. Under what circumstances is that not sufficient, and I would want >>

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Wolfgang Maier
On 08/02/2017 04:57 PM, Steven D'Aprano wrote: On Wed, Aug 02, 2017 at 10:48:39PM +1000, Ben Finney wrote: Thomas Güttler writes: Maybe I am doing something wrong. I was proud because I did use “console_scripts” entry points. Did someone lead you to believe

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Steven D'Aprano
On Wed, Aug 02, 2017 at 10:48:39PM +1000, Ben Finney wrote: > Thomas Güttler writes: > > > Maybe I am doing something wrong. I was proud because I did use > > “console_scripts” entry points. > > Did someone lead you to believe it was wrong? Setuptools

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Ben Finney
Thomas Güttler writes: > Maybe I am doing something wrong. I was proud because I did use > “console_scripts” entry points. Did someone lead you to believe it was wrong? Setuptools console_scripts entry points are a good tool. My point was that it is an *advanced*

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Thomas Güttler
Am 02.08.2017 um 05:51 schrieb Steven D'Aprano: On Wed, Aug 02, 2017 at 11:22:00AM +1000, Ben Finney wrote: Steven D'Aprano writes: On Tue, Aug 01, 2017 at 04:54:40PM +0200, Thomas Güttler wrote: [...] I use Python since several years and I use console_script in

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Thomas Güttler
Am 02.08.2017 um 05:35 schrieb Abdur-Rahmaan Janhangeer: what difference do you make between python scripts and python code files? are codes relating to file manipulation called scripts? Do you ask this question all people on this list, or only one particular person? I don't know the

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Alan Gauld via Tutor
On 02/08/17 04:35, Abdur-Rahmaan Janhangeer wrote: > what difference do you make between python scripts and python code files? > Not much. Scripts are a concept more than a defined term, they often refer to executable programs written in a "scripting language" - which is usually an interpreted

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-02 Thread Abdur-Rahmaan Janhangeer
what difference do you make between python scripts and python code files? are codes relating to file manipulation called scripts? Abdur-Rahmaan Janhangeer, Mauritius abdurrahmaanjanhangeer.wordpress.com On 1 Aug 2017 22:48, "Alan Gauld via Tutor" wrote: > On 01/08/17 15:54,

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Steven D'Aprano
On Wed, Aug 02, 2017 at 11:22:00AM +1000, Ben Finney wrote: > Steven D'Aprano writes: > > > On Tue, Aug 01, 2017 at 04:54:40PM +0200, Thomas Güttler wrote: > > > > [...] > > > I use Python since several years and I use console_script in > > > entry_points of setup.py. > > >

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Ben Finney
Steven D'Aprano writes: > On Tue, Aug 01, 2017 at 04:54:40PM +0200, Thomas Güttler wrote: > > [...] > > I use Python since several years and I use console_script in > > entry_points of setup.py. > > What's console_script in entry_points of setup.py? It is an advanced

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Steven D'Aprano
On Tue, Aug 01, 2017 at 04:54:40PM +0200, Thomas Güttler wrote: [...] > I use Python since several years and I use console_script in entry_points > of setup.py. What's console_script in entry_points of setup.py? In particular, what does that have to do with writing an executable script?

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Alan Gauld via Tutor
On 01/08/17 15:54, Thomas Güttler wrote: > He asked me if "if __name__=='main':" is state of the art if you want > to translate a shell script to python. It all depends what you plan to do with the script. If you literally just want to translate a shell script such that it will always be

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Chris Warrick
On 1 August 2017 at 16:54, Thomas Güttler wrote: > I have a friend who is a talented shell script writer. He is a linux guru > since > several years. > > He asked me if "if __name__=='main':" is state of the art if you want > to translate a shell script to python. >

Re: [Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Zachary Ware
On Tue, Aug 1, 2017 at 9:54 AM, Thomas Güttler wrote: > I have a friend who is a talented shell script writer. He is a linux guru > since > several years. > > He asked me if "if __name__=='main':" is state of the art if you want > to translate a shell script to

[Tutor] if __name__=='main' vs entry points: What to teach new comers?

2017-08-01 Thread Thomas Güttler
I have a friend who is a talented shell script writer. He is a linux guru since several years. He asked me if "if __name__=='main':" is state of the art if you want to translate a shell script to python. I started to stutter and did not know how to reply. I use Python since several years and I