Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Last active February 22, 2018 20:28
Show Gist options
  • Save lmazuel/9fe0f75f986610821801802363eb301d to your computer and use it in GitHub Desktop.
Save lmazuel/9fe0f75f986610821801802363eb301d to your computer and use it in GitHub Desktop.
Py3 / Py2 compat test
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
class VirtualMachine(object):
def __init__(self, **kwargs):
self.name = kwargs["name"] # Let it fail if not there
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