有没有更好(更有说服力)的方法来检查有效参数?
def load_data filename, start_percent, end_percent
raise 'Values must be [0,1]' if start_percent < 0
raise 'Values must be [0,1]' if end_percent < 0
raise 'Values must be [0,1]' if start_percent > 1
raise 'Values must be [0,1]' if end_percent > 1
...
红宝石 1.9.3
编辑:应该是花车start_percent
。end_percent