i'm stucked at a point and i can't progress, sorry for this silly question. I searched a lot for that but i couldn't know what i am missing. Please help me.
I studied modules and classes in python. Now i want to make some operations using python and apt. I'm studying from : http://apt.alioth.debian.org/python-apt-doc/library/apt.cache.html However, i couldn't understand, the module is apt.cache, as shown in the top of the page. I expected that object should be created by writing apt.cache.Cache(), but object is created by writing apt.Cache(), as shown below. Why?
    import apt
    import apt.progress
    # First of all, open the cache
    cache = apt.Cache()
    # Now, lets update the package list
    cache.update()
    # We need to re-open the cache because it needs to read the package list
    cache.open(None)
    # Now we can do the same as 'apt-get upgrade' does
    cache.upgrade()
    # or we can play 'apt-get dist-upgrade'
    cache.upgrade(True)
    # Q: Why does nothing happen?
    # A: You forgot to call commit()!
    cache.commit(apt.progress.TextFetchProgress(),
                 apt.progress.InstallProgress())
Second similar question is about below code, Cache class is imported from module apt.cache. I expected that object would be created by writing apt.cache.Cache(), but it is created by writing apt.Cache(). Why?
    >>> from apt.cache import FilteredCache, Cache, MarkedChangesFilter
    >>> cache = apt.Cache()
    >>> changed = apt.FilteredCache(cache)
    >>> changed.set_filter(MarkedChangesFilter())
    >>> print len(changed) == len(cache.get_changes()) # Both need to have same length
    True
Thanks in advance
 
    