






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Not recommended Best Practice from qcore import geo import os, sys from shared_workflow import shared from subprocess import Popen, PIPE import vtk import os import sys from subprocess import Popen, PIPE import vtk from qcore import geo from shared_workflow import shared from math import * import math or from math import ceil
Not recommended Best Practice if number != None: if number is not None: if flag == True: if flag:
global WIDTH
self.width
fraction = available_nodes / 264
MAX_NODES = 264 person = { 'first': 'Tobin', 'last': 'Brown', 'age': } # Bad: we have to change the replacement fields within our string, once we add new values print('{} {} is {} years old'. format( person['first'], person['last'], person['age']) ) print('{first} {last} is {age} years old'. format( ****** person)) # Output Tobin Brown is 20 years old
The exec statement enables you to dynamically execute arbitrary Python code which is stored in literal strings. Building a complex string of Python code and then passing that code to exec results in code that is hard to read and hard to test. Anytime the use of exec error is encountered, you should go back to the code and check if there is a clearer, more direct way to accomplish the task. Not recommended Best Practice s = "print("Hello, World!")" exec(s)
Hello, World! def print_hello_world(): print("Hello, World!") print_hello_world() Eg. In slurm_gm_workflow/install.py, this statement needs fixing, as it's hard to find what params it imports, would they have naming conflicts with the variables inside the current script etc.
Comply with PEP Find a standard that suits our projects and stick to it
https://www.python.org/dev/peps/pep-0008/ http://google.github.io/styleguide/pyguide.html http://docs.quantifiedcode.com/python-anti-patterns/