Having fun with python

Tzury Afro.Systems at gmail.com
Wed Oct 3 09:28:17 CEST 2007

    def loadResMap(self):
        self.resMap = []
        [[self.resMap.append(str('A2' + sim[0] + '/r' + str(x)))
            for x in range(1, eval(sim[1])+1)]
                for sim in [x.split(':')
                    for x in quickViews.smsResList.v.split(",")]]
        # Confused? Have this one:

        data = quickViews.smsResList.v
        sims, slots = [], data.split(",")
        for slot in slots:
        for sim in sims:
            for x in range(1, eval(sim[1])+1):
                self.resMap.append(str('A2' + sim[0] + '/r' +

        # same functionality different approaches
        # forloops vs. list comprehension
        # redability vs. smartassicity
        # AKA: You have read too many Lisp books

More information about the Python-list mailing list