[MERGE] bzrlib.osutils fixes
Dmitry Vasiliev
dima at hlabs.spb.ru
Sun Mar 11 13:09:03 GMT 2007
Robert Collins wrote:
> Theres another possible with with using named variables; we have a bit
> of an ugly smell around file kinds at the moment: they are strings, and
> you call functions to get things related to those strings. The actual
> strings are rarely printed anywhere though.
>
> Perhaps we could instead have:
>
> class PathKind(object):
>
> def __init__(self, marker, versionable):
> self.marker = marker
> self.versionable = versionable
>
>
> kind_directory = PathKind('/', True)
> kind_file = PathKind('', True)
> kind_link = PathKind('@', True)
> kind_socket = PathKind('$', False)
> ...
>
> 'foo is kind_directory' will work, as will 'foo is not kind_directory'
> and 'foo in (kind_directory, kind_file)' etc.
Actually osutils module definitely needs some refactoring and I like
this proposal as a step forward.
--
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru
More information about the bazaar
mailing list