morfizm (morfizm) wrote,
morfizm
morfizm

Attention test

Find a bug:
class A(list):

    @staticmethod
    def _flatten_item(item):
        return item.split('|')

    def flatten(self):
        # save original list
        copy = list(self)

        # clear list
        for a in self:
            self.remove(a)
 
        # populate it with new lists 
        # as we transform saved elements
        for a in copy:
            self.extend(self._flatten_item(a))
(Syntax highligher used: http://tohtml.com/python/)
Tags: in english, software development
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 11 comments