From 4bcae04cf127e7a7a51d3e980b0ea271b4a9bb52 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 19 Mar 2012 13:34:25 -0400 Subject: [PATCH] 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`. --- pycomedi/channel.pyx | 2 ++ 1 file changed, 2 insertions(+) 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() -- 2.26.2