> On Nov 23, 2018, at 09:35, Alan Gauld via Tutor <tutor@python.org> wrote:
> 
> On 23/11/2018 05:34, Avi Gross wrote:
>> What I was thinking was the ability to do something like this:
>> 
>> import ReChoir as require
>> 
>> require.version(condition, before=True, after=False)
>> require.modules(module list, recursive=True)
>> require.os([“Eunuchs”, “Windblows”])
>> require.functionality(“print3”)
> 
> I can see the logic but suspect discussion of new features is
> probably the preserve of the main Python list. If you can get
> traction there somebody might actually go ahead and write one!

discussion of a “require” library probably isn’t necessary.  It’s pretty 
straightforward to include the logic using existing methods.

For the version of python, test against sys.version_info
For the modules, put your import calls in a try block and handle exceptions
For the OS version, test against os.name or sys.platform
The last one, “functionality,” is a bit vague.  Probably another candidate for 
a try block.


— 
David Rock
da...@graniteweb.com




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

Reply via email to