Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-14 Thread Alan Gauld via Python-list
On 13/06/2021 04:21, dn via Python-list wrote: > What do you think a professionally-recognisable series of skill-levels > for programmers? This has been done or attempted many times, with perhaps the most complete scheme being the British Computer Society's "Industry Standard Model" which breaks

Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-14 Thread Greg Ewing
On 13/06/21 3:21 pm, dn wrote: Will referring to skilled professionals as 'masters (of their profession/craft)' transgress (international or at least US-instigated) 'Political Correctness'? And what about all the university degrees with the word "master" in their names? Worst of all, will epis

Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-13 Thread jan via Python-list
inner" or "Junior", "Intermediate", > and "Advanced" or "Senior" which all sound school-ish; with the three > terms: "Apprentice", "Journeyman", and "Master" (see also > https://leanpub.com/b/python-craftsman). Jus

Terminology: EU language skills, and Master to Main (or ...)

2021-06-12 Thread dn via Python-list
onal context. NB I use the terms solely to indicate an expected audience, as distinct from assessing an individual's capability (or pay-rate)! There is a potential-problem in the rising sensitivity of the word "Master", eg the git CVS has replaced the idea of a Master-branch with &qu

Main threads waits indefinitely on futures if single future calls condition.wait()

2019-10-31 Thread i...@dantalion.nl
Hello, Recently I have been trying to use a reantrant read write lock in my project but discovered several problems when writing test cases. All the relevant material can be found on the following locations https://stackoverflow.com/questions/58410610/calling-condition-wait-inside-thread-causes-r

Re: Friday Finking: 'main-lines' are best kept short

2019-09-13 Thread boB Stepp
On Thu, Sep 12, 2019 at 10:59 PM DL Neil via Python-list wrote: > Ref: > Mastering Object-oriented Python, S Lott > Copyright © 2014 Packt Publishing Side note: When I looked this up I saw on Amazon that there is a second edition out targeting Python 3.7. It was published June of this year. --

Re: Friday Finking: 'main-lines' are best kept short

2019-09-13 Thread Cameron Simpson
On 13Sep2019 15:58, DL Neil wrote: Is it a good idea to keep a system's main-line* code as short as possible, essentially consigning all of 'the action' to application and external packages and modules? Generally yes. * my choice of term: "main-line", may be take

Friday Finking: 'main-lines' are best kept short

2019-09-12 Thread DL Neil via Python-list
(this follows some feedback from the recent thread: "WedWonder: Scripts and Modules" and commences a somewhat-related topic/invitation to debate/correct/educate) Is it a good idea to keep a system's main-line* code as short as possible, essentially consigning all of

EuroPython 2019: Monday and Tuesday activities for main conference attendees

2019-05-23 Thread M.-A. Lemburg
Although the main conference starts on Wednesday, July 10th, there’s already so much to do for attendees with the main conference ticket on Monday 8th and Tuesday 9th. Beginners’ Day and Sponsored Trainings -- You can come to the workshops and trainings venue

Re: setup.py, how to find main program/module?

2018-12-19 Thread ant
dieter wrote: > ant writes: >> ... >> yet not quite all the way yet. i run the >> commands to make the sdist and wheels and upload >> it using twine to my test account, but when >> i install it and try to run it the ngfp.py is >> not found (i'

Re: setup.py, how to find main program/module?

2018-12-18 Thread dieter
ant writes: > ... > yet not quite all the way yet. i run the > commands to make the sdist and wheels and upload > it using twine to my test account, but when > i install it and try to run it the ngfp.py is > not found (i've also tried nfgp and main). > ... >

setup.py, how to find main program/module?

2018-12-18 Thread ant
hello, i'm getting there... yet not quite all the way yet. i run the commands to make the sdist and wheels and upload it using twine to my test account, but when i install it and try to run it the ngfp.py is not found (i've also tried nfgp and main). test upload

Re: about main()

2018-07-08 Thread Abdur-Rahmaan Janhangeer
non native speakers try to do their best as for ... who can't be bothered to use correct grammar in English, and probably are comparably sloppy in their code. ... maybe but check INADA NAOKI Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ or the practicality of killfiling people who

Re: about main()

2018-07-08 Thread Abdur-Rahmaan Janhangeer
i appreciate every suggestions though ^^_ Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Ahh, yes. The elegant purity of reading every email that goes through > this mailing list, or the practicality of killfiling people who can't > be bothered to use correct grammar in English, and p

Re: about main()

2018-07-07 Thread Gene Heskett
On Friday 06 July 2018 14:27:16 Grant Edwards wrote: > On 2018-07-06, Gene Heskett wrote: > > In that case, I hate to say it, but your education is sorely lacking > > in the fundamentals. Smelting for instance was discussed at length > > in the high school physics books I was reading by the time

Re: about main()

2018-07-06 Thread Gregory Ewing
Robin Becker wrote: The villagers will shout "hey siri I need a compiler" and one will be provided Then one day someone says "Hey, Siri, make me an artificial intelligence that can respond to voice commands", and then it's not long before the AIs are breeding by themselves and take over. Berri

Re: about main()

2018-07-06 Thread Steven D'Aprano
On Fri, 06 Jul 2018 18:27:16 +, Grant Edwards wrote: > On 2018-07-06, Gene Heskett wrote: > >> In that case, I hate to say it, but your education is sorely lacking in >> the fundamentals. Smelting for instance was discussed at length in the >> high school physics books I was reading by the t

Re: about main()

2018-07-06 Thread Jim Lee
On 07/06/18 12:57, Terry Reedy wrote: On 7/5/2018 9:40 PM, Jim Lee wrote: On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is

Re: about main()

2018-07-06 Thread Grant Edwards
On 2018-07-06, Jim Lee wrote: > On 07/06/18 11:25, Grant Edwards wrote: >> On 2018-07-06, Jim Lee wrote: >> >>> Pedantics again. Didn't even get the point before tearing apart the >>> *analogy* rather than the *point itself*. >> Jim Lee, this is the Internet. >> >> Intenet, this is Jim Lee. >> >>

Re: about main()

2018-07-06 Thread Terry Reedy
On 7/5/2018 9:40 PM, Jim Lee wrote: On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is so realistic. Even the Eskimos and Inuit

Re: about main()

2018-07-06 Thread Jim Lee
On 07/06/18 11:25, Grant Edwards wrote: On 2018-07-06, Jim Lee wrote: Pedantics again. Didn't even get the point before tearing apart the *analogy* rather than the *point itself*. Jim Lee, this is the Internet. Intenet, this is Jim Lee. :) You have an inaccurate anthropomorphic referenc

Re: about main()

2018-07-06 Thread Grant Edwards
On 2018-07-06, Jim Lee wrote: > > Pedantics again. Didn't even get the point before tearing apart the > *analogy* rather than the *point itself*. Jim Lee, this is the Internet. Intenet, this is Jim Lee. :) -- Grant Edwards grant.b.edwardsYow! I'm encased in the

Re: about main()

2018-07-06 Thread Grant Edwards
On 2018-07-06, Gene Heskett wrote: > In that case, I hate to say it, but your education is sorely lacking in > the fundamentals. Smelting for instance was discussed at length in the > high school physics books I was reading by the time I was in the 3rd > grade. Don't they teach anything in sch

Re: about main()

2018-07-06 Thread Grant Edwards
On 2018-07-05, Jim Lee wrote: > Take a village of people. They live mostly on wild berries. It's completely orthogonal to your point of course, but I thought villages happened precisely because people had stopped living off wild stuff and had adopted organized agriculture... -- Grant Edwards

Re: about main()

2018-07-06 Thread Robin Becker
On 05/07/2018 21:43, Jim Lee wrote: ... identifying the poisonous berries. I would respect your analogy more if every compiler used today were forty years old and not being developed by anyone other than its original creator(s). ChrisA It's not about compilers - it's about skills. 

Re: about main()

2018-07-06 Thread Mark Lawrence
On 06/07/18 07:04, Gregory Ewing wrote: Steven D'Aprano wrote: Even the Eskimos and Inuit, living in some of the harshest environments on earth, managed to have a relatively wide variety of foods in their diet. They might be living on a very wide variety of berries. Or perhaps, in their lang

Re: about main()

2018-07-06 Thread Mark Lawrence
On 06/07/18 02:40, Jim Lee wrote: On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is so realistic. Even the Eskimos and Inuit,

Re: about main()

2018-07-05 Thread Gregory Ewing
Steven D'Aprano wrote: Even the Eskimos and Inuit, living in some of the harshest environments on earth, managed to have a relatively wide variety of foods in their diet. They might be living on a very wide variety of berries. Or perhaps, in their language, "berry" simply means "food". -- Gr

Re: about main()

2018-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2018 18:40:11 -0700, Jim Lee wrote: > On 07/05/18 18:25, Steven D'Aprano wrote: >> On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: >> >>> Take a village of people.  They live mostly on wild berries. >> Because of course a community of people living on one food is so >> realistic.

Re: about main()

2018-07-05 Thread Gene Heskett
On Thursday 05 July 2018 21:25:31 Steven D'Aprano wrote: > On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: > > Take a village of people.  They live mostly on wild berries. > > Because of course a community of people living on one food is so > realistic. Even the Eskimos and Inuit, living in som

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 18:25, Steven D'Aprano wrote: On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is so realistic. Even the Eskimos and Inuit, living in some of the harshest env

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 18:14, Michael Torrie wrote: On 07/05/2018 11:47 AM, Calvin Spealman wrote: That wasn't me, but I do agree with the sentiment in that its often silly to focus on them at the wrong time and without constraints that warrant that focus. Premature optimization is the root of all evil,

Re: about main()

2018-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2018 11:27:09 -0700, Jim Lee wrote: > Take a village of people.  They live mostly on wild berries. Because of course a community of people living on one food is so realistic. Even the Eskimos and Inuit, living in some of the harshest environments on earth, managed to have a relat

Re: about main()

2018-07-05 Thread Michael Torrie
On 07/05/2018 11:47 AM, Calvin Spealman wrote: > That wasn't me, but I do agree with the sentiment in that its often silly > to focus on them at the wrong time and without constraints that warrant > that focus. Premature optimization is the root of all evil, the saying goes. I see this kind of th

Re: about main()

2018-07-05 Thread Steven D'Aprano
On Thu, 05 Jul 2018 10:41:36 -0700, Jim Lee wrote: > The horde of > programmers a generation or two from now may have no clue how to do > these things. That's okay, the horde of programmers have never known how to do these things (optimization). They either don't do it at all, or they run riot

Re: about main()

2018-07-05 Thread Cameron Simpson
On 05Jul2018 11:22, Rhodri James wrote: On 05/07/18 09:43, Abdur-Rahmaan Janhangeer wrote: just when to use main() in if __name__ == '__main__' : main() is far is it good in py? or should file intended to be run just not include it? It's a matter of taste. If your &q

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 14:15, MRAB wrote: On 2018-07-05 21:43, Jim Lee wrote: On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and en

Re: about main()

2018-07-05 Thread MRAB
On 2018-07-05 21:43, Jim Lee wrote: On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 12:58, Chris Angelico wrote: On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among tasks so every single one of us does

Re: about main()

2018-07-05 Thread Chris Angelico
On Fri, Jul 6, 2018 at 4:27 AM, Jim Lee wrote: > > > On 07/05/18 10:47, Calvin Spealman wrote: >> >> >> >> You say "pitfall", but I say "allow developers to focus on higher-level >> problems and enable developers to specialize among tasks so every single one >> of us doesn't have to be a jack of a

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 10:47, Calvin Spealman wrote: You say "pitfall", but I say "allow developers to focus on higher-level problems and enable developers to specialize among tasks so every single one of us doesn't have to be a jack of all trades just to build a todo list app". Sure, that's the

Re: about main()

2018-07-05 Thread Calvin Spealman
On Thu, Jul 5, 2018 at 1:41 PM, Jim Lee wrote: > > > On 07/05/18 10:15, Calvin Spealman wrote: > > On Thu, Jul 5, 2018 at 12:59 PM, Jim Lee wrote: > >> >> >> On 07/05/18 05:14, Marko Rauhamaa wrote: >> >>> Abdur-Rahmaan Janhangeer : >>> * Create as many functions as you can > perfo

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 10:15, Calvin Spealman wrote: On Thu, Jul 5, 2018 at 12:59 PM, Jim Lee > wrote: On 07/05/18 05:14, Marko Rauhamaa wrote: Abdur-Rahmaan Janhangeer mailto:arj.pyt...@gmail.com>>: * Create as many functions as you can

Re: about main()

2018-07-05 Thread Calvin Spealman
On Thu, Jul 5, 2018 at 12:59 PM, Jim Lee wrote: > > > On 07/05/18 05:14, Marko Rauhamaa wrote: > >> Abdur-Rahmaan Janhangeer : >> >>> * Create as many functions as you can >>> performance? >>> >> Python? >> >> Seriously, though. The principle of expressive encapsulation is one of >> the basi

Re: about main()

2018-07-05 Thread Jim Lee
On 07/05/18 05:14, Marko Rauhamaa wrote: Abdur-Rahmaan Janhangeer : * Create as many functions as you can performance? Python? Seriously, though. The principle of expressive encapsulation is one of the basic cornerstones of writing computer programs. Performance barely ever becomes a questi

Re: about main()

2018-07-05 Thread Chris Angelico
On Thu, Jul 5, 2018 at 10:47 PM, Abdur-Rahmaan Janhangeer wrote: > that's what happens when you type from mobile > > btw i have top posted since some days only in this thread > > as for my english well i got distinction in cambridge ucles in gp for high > school but practicality beats purity Ahh,

Re: about main()

2018-07-05 Thread Chris Angelico
On Thu, Jul 5, 2018 at 9:20 PM, Marko Rauhamaa wrote: > Rhodri James : >> I'm not a big fan of "main()" functions myself; creating a function >> which will be called exactly once seems rather wasteful. > > A function is the encapsulation of a distinct ... wel

Re: about main()

2018-07-05 Thread Abdur-Rahmaan Janhangeer
that's what happens when you type from mobile btw i have top posted since some days only in this thread as for my english well i got distinction in cambridge ucles in gp for high school but practicality beats purity Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > > > -- https://ma

Re: about main()

2018-07-05 Thread Mark Lawrence
On 05/07/18 11:39, Abdur-Rahmaan Janhangeer wrote: i once saw a python course (by academics) advertising main() in it's promotional flier that's put me in doubt as whether it's that recommended or not Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ I can remember b

Re: about main()

2018-07-05 Thread Marko Rauhamaa
Abdur-Rahmaan Janhangeer : >> * Create as many functions as you can > performance? Python? Seriously, though. The principle of expressive encapsulation is one of the basic cornerstones of writing computer programs. Performance barely ever becomes a question, and even more rarely has anything to d

Re: about main()

2018-07-05 Thread Abdur-Rahmaan Janhangeer
it will run the code within the if > block. If that has a main() function it makes it simpler later to > change what main does instead of cluttering up the if block. But > there is no 'performance' issue that I can see. > > > > Abdur-Rahmaan Janhangeer > > htt

Re: about main()

2018-07-05 Thread Joel Goldstick
is that it gets compiled, and run. If it is imported, and you have the 'if __name__ ... block, it will run the code within the if block. If that has a main() function it makes it simpler later to change what main does instead of cluttering up the if block. But there is no 'performance&

Re: about main()

2018-07-05 Thread Abdur-Rahmaan Janhangeer
performance? Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ * Create as many functions as you can -- https://mail.python.org/mailman/listinfo/python-list

Re: about main()

2018-07-05 Thread Bart
On 05/07/2018 11:22, Rhodri James wrote: On 05/07/18 09:43, Abdur-Rahmaan Janhangeer wrote: just when to use main() in if __name__ == '__main__' : main() is far is it good in py? or should file intended to be run just not include it? It's a matter of taste.  If your &q

Re: about main()

2018-07-05 Thread Marko Rauhamaa
Rhodri James : > I'm not a big fan of "main()" functions myself; creating a function > which will be called exactly once seems rather wasteful. A function is the encapsulation of a distinct ... well ... function. Functions that are called just once are desirable. So I&

Re: about main()

2018-07-05 Thread Marko Rauhamaa
Abdur-Rahmaan Janhangeer : > just when to use main() in > > if __name__ == '__main__' : > main() > > is far is it good in py? > > or should file intended to be run just not include it? I think all Python programs should have it. Marko -- https://mail.

Re: about main()

2018-07-05 Thread Abdur-Rahmaan Janhangeer
i once saw a python course (by academics) advertising main() in it's promotional flier that's put me in doubt as whether it's that recommended or not Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > main() > > > > is far is it good in py? > &g

Re: about main()

2018-07-05 Thread Rhodri James
On 05/07/18 09:43, Abdur-Rahmaan Janhangeer wrote: just when to use main() in if __name__ == '__main__' : main() is far is it good in py? or should file intended to be run just not include it? It's a matter of taste. If your "file intended to be run" also co

about main()

2018-07-05 Thread Abdur-Rahmaan Janhangeer
just when to use main() in if __name__ == '__main__' : main() is far is it good in py? or should file intended to be run just not include it? Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ -- https://mail.python.org/mailman/listinfo/python-list

OK, now one main block only , but loop.run_forever() ? idk...

2017-12-31 Thread Wu Xi
pack() root.update() #async_loop.run_forever() # < uncomment, then it won"t work anymore root.mainloop() # how to replace ? # To do everything in the main thread, # one can replace 'root.mainloop' with loop.run_forever (in the main thread) # and repeated root.update calls. -- https://mail.python.org/mailman/listinfo/python-list

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
On Oct 27, 2017 5:38 PM, "Ian Kelly" wrote: In addition to what others have answered, if the code in question has any variables then I'll prefer to put it inside a function and call the function. This ensures that the variables are local and not going. It's a minor code hygiene point, but a good

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
In addition to what others have answered, if the code in question has any variables then I'll prefer to put it inside a function and call the function. This ensures that the variables are local and not going. It's a minor code hygiene point, but a good practice in my opinion. -- https://mail.pytho

Re: Just a quick question about main()

2017-10-27 Thread Ned Batchelder
On 10/27/17 2:05 PM, ROGER GRAYDON CHRISTMAN wrote: While teaching my introductory course in Python, I occasionally see submissions containing the following two program lines, even before I teach about functions and modules: if __name__ = '__main__': ... main() When I ask about

Re: Just a quick question about main()

2017-10-27 Thread Grant Edwards
On 2017-10-27, Chris Angelico wrote: > On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: >> While teaching my introductory course in Python, I occasionally see >> submissions containing the following two program lines,[...] >> if __name__ = '__main__&#

Re: Just a quick question about main()

2017-10-27 Thread Thomas Jollans
On 27/10/17 20:05, ROGER GRAYDON CHRISTMAN wrote: > While teaching my introductory course in Python, I occasionally see > submissions containing the following two program lines, even before > I teach about functions and modules: > > if __name__ = '__main__': > ... mai

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
h about functions and modules: >> >> if __name__ = '__main__': >> ... main() >> >> When I ask about it, I hear things like they got these from other >> instructors, >> or from other students who learned it from their instructors, or maybe >&g

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: > While teaching my introductory course in Python, I occasionally see > submissions containing the following two program lines, even before > I teach about functions and modules: > > if __name__ = '__main__':

Just a quick question about main()

2017-10-27 Thread ROGER GRAYDON CHRISTMAN
While teaching my introductory course in Python, I occasionally see submissions containing the following two program lines, even before I teach about functions and modules: if __name__ = '__main__': ... main() When I ask about it, I hear things like they got these from other instr

is it possible use python to run another main point or function in some range of memory in executable file

2016-10-25 Thread meInvent bbird
is it possible python to run another main point or function in some range of memory in executable file -- https://mail.python.org/mailman/listinfo/python-list

Re: How to call this method from main method

2016-09-28 Thread Peter Pearson
>"g,m,a,s,c,p,d") > > When i am calling the above method from main method it is not > returning the value but when i use print it is showing the value. Is > there any wrong in returning the value from a method. How do you know it's not returning a value? Y

Re: How to call a method returning a value from a main function

2016-09-28 Thread Paul Moore
On Wednesday, 28 September 2016 07:47:38 UTC+1, prasanth kotagiri wrote: > def GenAccessToken(mackey,authid,configid,tokenexp,*perm): > args=JWTParms() > args.configurationId=configid > args.authzSystemMacKey=mackey > args.authzSystemId=authid > args.tokenExpiryInSeconds=tokene

Re: How to call this method from main method

2016-09-28 Thread Ben Finney
prasanthk...@gmail.com writes: > When i am calling the above method from main method You don't have a main method, and you don't specify what “the above method” is. I assume you mean “… calling the ‘GenAccessToken’ function” (which is not a method of anything, in the code you showe

How to call a method returning a value from a main function

2016-09-27 Thread prasanth kotagiri
#!/sur/bin/env python import sys import jwt import argparse from calendar import timegm from datetime import datetime import uuid class TokenGenerator: def __init__(self, args): self.macKey = args.authzSystemMacKey self.authzSystemId = args.authzSystemId self.permissio

How to call this method from main method

2016-09-27 Thread prasanthktgr
args.tokenExpiryInSeconds=tokenexp args.permissions=perm tokenGen=TokenGenerator(args) tok=tokenGen.generate() return tok if __name__ == '__main__': GenAccessToken("This_is_a_Test_QED_MAC_Key_Which_Needs_to_be_at_Least_32_Bytes_Long", "default&qu

Re: Putting the main program in a main function

2015-09-14 Thread Ben Finney
een different parts of the program are more explicitly and strictly defined. So yes, it's advisable to write a ‘main’ function for the application and keep to absolute minimum the ‘if __name__ == "__main__"’ block. That said, your ‘main’ function can be slightly more self-contained

Re: Putting the main program in a main function

2015-09-14 Thread Nobody
On Mon, 14 Sep 2015 09:13:47 +0200, ast wrote: > is it advised to always write programs like that ? If global (module-scope) variables are initialised by main, then those variables won't exist unless main() is run, which means that you can't use it as a module, only as a script.

Putting the main program in a main function

2015-09-14 Thread ast
Hi I saw here http://inventwithpython.com/pygame/chapter3.html a program where the main program is put in a function. So the structure is: def main(): main code here def f1(): function 1 code def f2(): function 2 code .. if __name__ == '__main__': main() The a

An improved version of the main snippet

2015-05-05 Thread Virgil Stokes
I have attached what I believe to be an improved version of my main snippet for testing. --V :-) ''' Purpose: get current bid, ask and rate for currency exchanges (FOREX trading) Note: 1. yahoo seems to give the best estimates for the currency exchange rates 2. Not

Re: Glade/Python - positioning main window at startup

2014-12-31 Thread mbg1708
On Tuesday, 30 December 2014 17:56:56 UTC, Cousin Stanley wrote: > > > > Problem: Can anyone help me find settings (either in Glade or elsewhere) > > which will start the application window with the application window center > > aligned with the desktop center ? > > You might try the fol

Re: Glade/Python - positioning main window at startup

2014-12-30 Thread Cousin Stanley
> > Problem: Can anyone help me find settings (either in Glade or elsewhere) > which will start the application window with the application window center > aligned with the desktop center ? You might try the following entry in your .glade file center -- Stanley C. Kitch

Glade/Python - positioning main window at startup

2014-12-30 Thread mbg1708
Environment: Fedora 21, Linux 3.17.6, XFCE4 (with one workspace) Python: 2.7.8 Glade: 3.18.3 Background: the application window developed in Glade is (deliberately) somewhat smaller than the desktop. When the application starts, it starts offset from the center of the desktop. It looks as thou

Re: Compiling main script into .pyc

2014-01-17 Thread Grant Edwards
On 2014-01-17, Steven D'Aprano wrote: > On Thu, 16 Jan 2014 23:43:02 -0500, Dave Angel wrote: > [steve@ando ~]$ cat sample.py > print("Hello!") > > [steve@ando ~]$ ls sample.pyc > ls: sample.pyc: No such file or directory > [steve@ando ~]$ python -m compileall sample.py > Compiling sample.py ...

Re: Compiling main script into .pyc

2014-01-17 Thread Alister
On Thu, 16 Jan 2014 17:01:51 -0800, Sam wrote: > One thing I observe about python byte-code compiling is that the main > script does not gets compiled into .pyc. Only imported modules are > compiled into .pyc. > > May I know how can I compile the main script into .pyc? It is to

Re: Compiling main script into .pyc

2014-01-17 Thread Steven D'Aprano
On Thu, 16 Jan 2014 23:43:02 -0500, Dave Angel wrote: > MRAB Wrote in message: >> On 2014-01-17 02:56, bob gailer wrote: >>> On 1/16/2014 8:01 PM, Sam wrote: >>>> One thing I observe about python byte-code compiling is that the main >>>> script does

Re: Compiling main script into .pyc

2014-01-16 Thread Terry Reedy
On 1/16/2014 10:19 PM, MRAB wrote: On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile

Re: Compiling main script into .pyc

2014-01-16 Thread Dave Angel
MRAB Wrote in message: > On 2014-01-17 02:56, bob gailer wrote: >> On 1/16/2014 8:01 PM, Sam wrote: >>> One thing I observe about python byte-code compiling is that the main >>> script does not gets compiled into .pyc. Only imported modules are compiled >>&g

Re: Compiling main script into .pyc

2014-01-16 Thread MRAB
On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh

Re: Compiling main script into .pyc

2014-01-16 Thread Ned Batchelder
On 1/16/14 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats

Re: Compiling main script into .pyc

2014-01-16 Thread bob gailer
On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh? Just import it! -- https://mail.python.org

Compiling main script into .pyc

2014-01-16 Thread Sam
One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats. -- https://mail.python.org/mailman

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Terry Reedy
On 12/11/2013 5:26 AM, Ben Finney wrote: Better design is to make the argument list a parameter to the ‘main’ function; this allows constructing an argument list specially for calling that function, without ‘main’ needing to know the difference. You'll also want to catch SystemExit and r

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Chris Angelico
On Thu, Dec 12, 2013 at 2:42 AM, bob gailer wrote: > It also ensures that the defining all the classes and functions happens > before referencing them (less "bookkeeping" for me). > > These two allow me to write the main program first, and follow it with all > the globa

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread bob gailer
On 12/11/2013 4:55 AM, JL wrote: What is the advantage to using a main()? In addition to what's been said I add: It separates all the global activities: defining of functions and classes, importing modules, etc. from the "doing" the actual task of the program. It also e

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread rusi
On Wednesday, December 11, 2013 7:47:34 PM UTC+5:30, Roy Smith wrote: > JL wrote: > > Python scripts can run without a main(). What is the advantage to using a > > main()? Is it necessary to use a main() when the script uses command line > > arguments? (See script below)

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Roy Smith
In article , mar...@letterboxes.org wrote: > I would agree with the previous post but also add that I've stopped > calling the main function "main()" and usually give it a more > descriptive name, such as "bake_cookies()" or whatever. I think that > that

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Roy Smith
In article <32615c9a-b983-4399-bb55-6df6c230f...@googlegroups.com>, JL wrote: > Python scripts can run without a main(). What is the advantage to using a > main()? Is it necessary to use a main() when the script uses command line > arguments? (See script below) > &

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread marduk
I would agree with the previous post but also add that I've stopped calling the main function "main()" and usually give it a more descriptive name, such as "bake_cookies()" or whatever. I think that that makes it clearer what it's doing when used as a library and

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Chris Angelico
On Wed, Dec 11, 2013 at 9:26 PM, Ben Finney wrote: > except SystemExit, exc: For new code, you'd of course want to write that as: except SystemExit as exc: which is compatible with Python 2.6, 2.7, and 3.x, while the other syntax is 2.x only. ChrisA -- https://mail.python.org/mailman/

Re: Is there any advantage to using a main() in python scripts?

2013-12-11 Thread Ben Finney
JL writes: > Python scripts can run without a main(). What is the advantage to > using a main()? Modular code – that is, implementing the program functionality in small, well-defined units with narrow, strictly-defined interfaces – is good design. Practical benefits include being a

Is there any advantage to using a main() in python scripts?

2013-12-11 Thread JL
Python scripts can run without a main(). What is the advantage to using a main()? Is it necessary to use a main() when the script uses command line arguments? (See script below) #!/usr/bin/python import sys def main(): # print command line arguments for arg in sys.argv[1

  1   2   3   4   5   >