« first day (3840 days earlier)      last day (1094 days later) » 

11:20 PM
@erotavlas setting pythonpath in your env variables may help?
@Shanthi yeah, probably writing a decorator
 
Is using list(zip(lst1,lst2)) a substituent for list(map(lambda a,b: (a,b),lst1,lst2))
 
@AndrasDeak - good point, however, I have logging.info in my python modules in multiple different places, I thought doing something with filter or handler would make it easier.
 
@CoolCloud yeah, list(zip(lst1,lst2)) is more readable imo
 
@ElderDruid Okay that's cool :D
If I were to pass a list onto a function and then append to the list, this would actually make changes to the list on global right. Obviously. But is there anyway to avoid this?
 
11:38 PM
@CoolCloud copy the list
 
@AndrasDeak Using copy method right? But I use recursion in my function and copy triggers maximum recursion error.
 
if the list has mutable elements you might have to deepcopy it, depending on whether you're also mutating its contents
@CoolCloud I doubt that
A bug triggers maximum recursion error.
 
Just a min, lemme just verify
 
Either you're relying on that mutation and your code breaks with a copy, or the code is correct but it needs more than 1000 recursive steps.
 
Well I was trying to make my own zip_longest function, but I just started writing it, so forgive the foolishness in it.
lst1 = [1,2,3]
lst2 = ['a','b']

def my_zipper(lst1,lst2):
    main = []
    first = lst1.copy()
    second = lst2.copy()
    if len(lst1) == len(lst2):
        for i,a in enumerate(lst1):
            for j,b in enumerate(lst2):
                if i==j:
                    main.append((a,b))
        return main
    else:
        if len(lst1) > len(lst2):
            big = len(lst1)
            for i in range(big-len(lst2)):
                second.append(None)
        my_zipper(lst1,lst2)

my_zipper(lst1,lst2)
 
11:41 PM
> Well I was trying to make my own zip_longest function
Stop right there.
1. Why are you making your own zip_longest function? 2. Why is it recursive?
 
@AndrasDeak In my defense, I am just trying to familiarize with some loopings and all
 
mhmm
 
It is recursive because once both the lists are made into same length, I would do the normal zipping
 
@CoolCloud I'm sorry to say this but that's pretty terrible
 
@AndrasDeak I might agree too, just went with the first method that came upto me. Any better ideas?
 
11:43 PM
But I'm also going to bed so I'll spare you the code review now. Others will probably comment in the meantime.
@CoolCloud from itertools import zip_longest
 
lol okay :p
 
but I acknowledge the importance of being able to reimplement it, and you should indeed work on that
But not using regular zip in it is inexplicable. That's one of the most important basic tools in python.
1. what if len(lst1) < len(lst2)?
2. what are you doing with second?
3. what does your function return if len(lst1) != len(lst2)?
good night
 
@AndrasDeak This is just for understanding loops and some advanced thinking, on a normal project I would definitely use zip and zip_longest.
@AndrasDeak Its not completed yet, i stopped when I realize the appending happens on global level.
@AndrasDeak night night
 
not me who had to search up zip_longest
 
Hi!
 I’ve been trying to superpose a transparent-gray image mask over another image so you can see the second image through the mask. The mask has white and gray pixels, so I’d like the white ones to seem completely transparent while through the gray ones you can see the original image under it.

I’ve been using ImageChops to basically multiply both the image and the image mask, which works good for most of the colors for what I want, but by multiplying both images it is not able to apply the mask to black regions (for any black pixel color, it will return black instead of black with the gr
 
11:57 PM
4. That double loop doesn't let me sleep.
 

« first day (3840 days earlier)      last day (1094 days later) »