These are chat archives for asmodehn/rostful

25th
May 2015
Ben Kehoe
@benkehoe
May 25 2015 22:32
wow, you've made a lot of progess!

The usual Pythonic way of doing it is something like this:

_ROCON = False
try:
  import rocon
  _ROCON = True
except: pass

if _ROCON:
  def func_that_uses_rocon():
    pass
  class RoconWrapper(object):
    pass

class SomeClass(object):
  def always_want_this(self):
    pass
  if _ROCON:
    def this_method_only_with_rocon(self):
      pass

Does that make sense?

You can see a more complicated example in my tfx package (which gives much more convenient transform classes than tf; let me know if you want to know more about it) https://bitbucket.org/benkehoe/tfx/src/19d68953da5bc84804ca91ad85d980fc4146cae6/src/tfx/canonical.py?at=default