Duncan Booth wrote: > > Yes, it would, although since the implication is that your class expected > numbers and the file iterator returns strings I'm not sure how much it > matters: you are still going to have to write more code than in your > example above. e.g. > > v1 = Vector3D(float(n) for n in itertools.islice(f, 3)) > > or with my variant: > > v1 = Vector3D(*(float(n) for n in itertools.islice(f, 3))) >
The generator expression wouldnt really be neccesary since the constructor converts the iterated values to floats. But! I understand your objection. It doesn't quite fit with 'explicit is better than implicit'. Im just debating the trade-off with catching foolish mistakes and making it easier to use for beginners. Thanks. -- http://mail.python.org/mailman/listinfo/python-list