Ignore:
Timestamp:
04/17/13 18:30:16 (12 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed checks for passed dataset table argument in new methods.

Use 'instances is not None' idiom and not a boolean test to guard against cases
where the passed dataset length is 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/tree.py

    r10959 r11459  
    15201520    def __new__(cls, instances=None, weightID=0, **argkw): 
    15211521        self = Orange.classification.Learner.__new__(cls, **cls._rename_dict(argkw)) 
    1522         if instances: 
     1522        if instances is not None: 
    15231523            self.__init__(**argkw) 
    15241524            return self.__call__(instances, weightID) 
     
    18641864    def __new__(cls, data=None, weightID=0, **argkw): 
    18651865        self = Orange.core.Learner.__new__(cls, **argkw) 
    1866         if data: 
     1866        if data is not None: 
    18671867            self.__init__(**argkw) 
    18681868            return self.__call__(data, weightID) 
Note: See TracChangeset for help on using the changeset viewer.