Last active
February 22, 2018 20:28
-
-
Save lmazuel/9fe0f75f986610821801802363eb301d to your computer and use it in GitHub Desktop.
Py3 / Py2 compat test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from virtual_machine_py3 import VirtualMachine | |
except (SyntaxError, ImportError): # Catch SyntaxError if Py2 or ImportError if we decide to build wheel for Py2 without py3 files. | |
from virtual_machine import VirtualMachine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VirtualMachine(object): | |
def __init__(self, **kwargs): | |
self.name = kwargs["name"] # Let it fail if not there |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VirtualMachine(object): | |
def __init__(self, *, name:str) -> None: | |
self.name = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment