From c6a66288f5c78f46e08fb7df2c509a5fa3bab486 Mon Sep 17 00:00:00 2001 From: Rahim Nathwani Date: Wed, 14 Nov 2018 12:53:01 +0800 Subject: [PATCH] Split hello.py into separate library and application packages --- source/examples/python/hello/greeter.py | 9 +++++++++ source/examples/python/hello/hello.py | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 source/examples/python/hello/greeter.py diff --git a/source/examples/python/hello/greeter.py b/source/examples/python/hello/greeter.py new file mode 100644 index 0000000..7bcb781 --- /dev/null +++ b/source/examples/python/hello/greeter.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +import time + + +def greeting(): + '''Returns a pleasant, semi-useful greeting.''' + return "Hello world, the time is: " + time.ctime() + diff --git a/source/examples/python/hello/hello.py b/source/examples/python/hello/hello.py index b11a93b..4beafcf 100644 --- a/source/examples/python/hello/hello.py +++ b/source/examples/python/hello/hello.py @@ -1,15 +1,7 @@ #!/usr/bin/env python -# -# Copyright (c) 2013 Jason McVetta. This is Free Software, released under the -# terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for details. -# Resist intellectual serfdom - the ownership of ideas is akin to slavery. import time - - -def greeting(): - '''Returns a pleasant, semi-useful greeting.''' - return "Hello world, the time is: " + time.ctime() +from greeter import greeting def main(): @@ -18,4 +10,3 @@ def main(): if __name__ == '__main__': main() -