Jason R. Coombs <jar...@jaraco.com> added the comment:

What do you think about readlink returning something like:

class Link(str):
  print_name = None  # type: str | None

  @property
  def friendly_name(self) -> str:
    return self.print_name or self

os.readlink would always return one of these Link objects, and since it's a 
substr, it would behave the way it currently behaves, but with an additional 
property. This approach would expose the underlying duality of the "name" of a 
link or junction, such that tools that need a friendly name could use 
.friendly_name and tools that need to inspect the print name could do that... 
but for the cases that wish for the most precise target could use the default 
value.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to