From: W. Trevor King Date: Mon, 19 Mar 2012 17:34:25 +0000 (-0400) Subject: Allow AnalogChannel.__init__ to take integers for `range`. X-Git-Tag: 0.5~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4bcae04cf127e7a7a51d3e980b0ea271b4a9bb52;p=pycomedi.git Allow AnalogChannel.__init__ to take integers for `range`. If you know the index of your desired range, you can now use that index directly and skip the usual call to `find_range`. --- diff --git a/pycomedi/channel.pyx b/pycomedi/channel.pyx index 76bb5eb..69bd878 100644 --- a/pycomedi/channel.pyx +++ b/pycomedi/channel.pyx @@ -279,6 +279,8 @@ cdef class AnalogChannel (Channel): super(AnalogChannel, self).__init__(**kwargs) if range == None: range = self.get_range(0) + elif isinstance(range, int): + range = self.get_range(range) self.range = range if aref == None: flags = self.subdevice.get_flags()