Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It would be a little faster. The first part of copy.copy looks like

  def copy(x):
    """Shallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    """

    cls = type(x)

    copier = _copy_dispatch.get(cls)
    if copier:
        return copier(x)

    # more after this point but it's not relevant for lists
So calling copy.copy on a list over using list() will check for the type, look up the type in a dictionary after which it will proceed as if you called list() yourself.


Mental memo. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: