Reader small image

You're reading from  Learning Python Application Development

Product typeBook
Published inSep 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781785889196
Edition1st Edition
Languages
Right arrow
Author (1)
Ninad Sathaye
Ninad Sathaye
author image
Ninad Sathaye

Ninad Sathaye has spent several years of his professional career designing and developing performance-critical engineering applications written in a variety of languages, including Python and C++. He has worked as a software architect in the semiconductor industry, and more recently in the domain of Internet of Things. He holds a master's degree in mechanical engineering.
Read more about Ninad Sathaye

Right arrow

Modularizing the code


We have been referring to modules in the earlier chapters. An explanation is in order. A single Python file with a .py extension is a module. You can use this module in some other source code using an import statement. The module name is the same as the file name, except the .py extension. For example, if the file name is knight.py, then import knight will import the module into your source file.

In this section, we will split the code in the attackoftheorcs_v1_1.py file into individual modules. You can find this file in the supporting code bundle for the previous chapter.

Attack of the Orcs v2.0.0

We will name this version 2.0.0. The major version is incremented to 2 as we are about to make some API level changes. The way we access functionality from the code will change after introduction of the new modules. Let's review the source file, attackoftheorcs_v1_1.py, from Chapter 2, Dealing with Exceptions. The first step is to create a module (a new file) for each of the...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Python Application Development
Published in: Sep 2016Publisher: PacktISBN-13: 9781785889196

Author (1)

author image
Ninad Sathaye

Ninad Sathaye has spent several years of his professional career designing and developing performance-critical engineering applications written in a variety of languages, including Python and C++. He has worked as a software architect in the semiconductor industry, and more recently in the domain of Internet of Things. He holds a master's degree in mechanical engineering.
Read more about Ninad Sathaye