Hi!

What is the best (shortest memory usage) way to store lots of pathnames
in memory where:

1. Path names are pathname=(dirname,filename)
2. There many different dirnames but much less than pathnames
3. dirnames have in general many chars

The idea is to share the common dirnames.

More realistically not only the pathnames are stored but objects each
object being a MyFile containing
self.name - <base name>
getPathname(self) - <full pathname>
other stuff

class MyFile:

  __allfiles=[]

  def __init__(self,dirname,filename):
    self.dirname=dirname  # But I want to share this with other files
    self.name=filename
    MyFile.__allfiles.append(self)
    ...

  def getPathname(self):
    return os.path.join(self.dirname,self.name)

  ...

Thanks for any suggestion.
Paulo

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to