How to make your python code more stable? So it can get running both in python2.7 and python3.x
1. Use zero built-in library or third_party package
Try to use built-in functions to do the same thing. If you only focus on one system, that would be easy.
"""
abs() all() any() ascii() bin() bool() bytearray() bytes() callable() classmethod() dict() dir() enumerate() eval() exec() float() format() globals() hasattr() hash() help() hex() input() int() isinstance() issubclass() iter() len() list() locals() max() min() object() oct() open() ord() pow() print() property() range() repr() reversed() round() set() setattr() slice() sorted() staticmethod() str() sum() super() tuple() type() vars() zip() __import__()
"""
2. Use no types
The type will break python2.7, and it will make your code more complex if you use more than json 5 base types.
Instead, use this template yingshaoxo created:
```
Instead of using type in function, you can directly put the type after variable name, so that python2 could run it, for example:
def hi(greeting_string):
result_string = "yingshaoxo: " + greeting_string
return result_string
Normally, all we need is function_name_complete, variable_name_complete, class_function_name_complete, it can be done with regex expression, so no need for using type hint.
```