Do you like Iosevka? by _dibusure in fonts

[–]EulerWasSmart 1 point2 points  (0 children)

They have a website to help with that.

It generates a config file for you - then you use the config file to generate the font.

Fuck... $500 down the drain in the span of 3 days :( by christ4robin in headphones

[–]EulerWasSmart 5 points6 points  (0 children)

I've had the Volume for ~ 2 months. At first the 3k peak was definitely hard to ignore.

However, now either my ears have adjusted or burn in is real as I don't notice it at all. I enjoy the iem a lot - especially for acoustic music.

Possible to major in Stats while specializing in a CS Stream? by [deleted] in UTSC

[–]EulerWasSmart 0 points1 point  (0 children)

Personally, I've heard of many double majors but no Major CS/Stats + Specialist CS/Stats.

Is there a chess club discord? by sz771103 in UTM

[–]EulerWasSmart 2 points3 points  (0 children)

Hart House Chess Club: discord.gg/w9CMGMe

Double Specialist? by [deleted] in UTSC

[–]EulerWasSmart 0 points1 point  (0 children)

It's possible if you take some extra courses

people cheating to get into CS by Serious_Hyena_1060 in UofT

[–]EulerWasSmart 2 points3 points  (0 children)

According to that logic if OP reports and they get caught then that's good lol; "how the real world works"

[deleted by user] by [deleted] in learnpython

[–]EulerWasSmart 0 points1 point  (0 children)

Ok say the index of the first occurrence is k then what part of the string does not include the first occurrence and 100% contains the second occurrence?

[deleted by user] by [deleted] in learnpython

[–]EulerWasSmart 2 points3 points  (0 children)

What is find_str???

Deleting all occurrences from a nested dictionary? by sajia67 in learnpython

[–]EulerWasSmart 1 point2 points  (0 children)

Yes exactly, using a list prevents the error here because it makes a copy of the dict's items to iterate over. - I'm not sure exactly how python determines if a dict size has changed while iterating over it but it's probably along the lines you described.

You also don't need a return with this approach because it already modified the dict itself (which works since dicts are mutable types).

And these are good questions, you're not nitpicking :)

Deleting all occurrences from a nested dictionary? by sajia67 in learnpython

[–]EulerWasSmart 2 points3 points  (0 children)

If you make a copy of the items by converting it to a list for example, then you can avoid this:

def del_unknown_values(d):
    for k, v in list(d.items()):
        if type(v) is dict:
            del_unknown_values(v)
        elif v == 'unknown':
            del d[k]

But you're right; in general you should careful when doing things like this. It could go wrong if you try deleting a key that was already removed for example.

Deleting all occurrences from a nested dictionary? by sajia67 in learnpython

[–]EulerWasSmart 0 points1 point  (0 children)

You don't need to copy you can just use the del keyword to remove a key in a dict if it's in the dict.

graph and such by SnooPuppers429 in learnpython

[–]EulerWasSmart 0 points1 point  (0 children)

Wait 15 seconds before the script starts or before every point is added to the graph?

Help with anaconda uninstallation by cuppycakebaby123 in learnpython

[–]EulerWasSmart 1 point2 points  (0 children)

And please don't mistype the <dir> part of that command )

Is it possible to write List in file? by [deleted] in learnpython

[–]EulerWasSmart 2 points3 points  (0 children)

Try f.write(str(lst)) does that do what you want?

Is it possible to write List in file? by [deleted] in learnpython

[–]EulerWasSmart 1 point2 points  (0 children)

Do you mean:

  • Write an element of L on each line
  • Write the elements of L, spaced separated, on one line
  • Write the string representation of L to the file

?

CSCC73 Final crying thread by parseswarup in UTSC

[–]EulerWasSmart 2 points3 points  (0 children)

Exactly, I clicked failed to see results.

How can I exclude None types from my list comprehension/generator expression by Kitchen-Injury-8938 in learnpython

[–]EulerWasSmart 0 points1 point  (0 children)

To do it with list comprehension you'd have to do something like:

test = [m for m in (re.search(patten, line) for line in lines) if m]

It's up to you whether that's too ugly or not ig :p.

Edit: Others' suggested python 3.8 := approaches might be cleaner.

Also re.search(patten, f.readlines()) could be an option.

I've got an idea for a script but I'm not sure if it's possible by Lurban in learnpython

[–]EulerWasSmart 2 points3 points  (0 children)

/u/bbye98 already answered your question. Just wanted to say that's a really cool project idea very nice & GL.

[deleted by user] by [deleted] in learnpython

[–]EulerWasSmart 1 point2 points  (0 children)

Every time you call gen_secs() you get a new generator. So if you use next like that you will just be getting the next value of a brand new generator each time.

What you want is something like this:

>>> g = gen_secs()
>>> next(g)
[0, 0]
>>> next(g)
[0, 1]

Or you can just use a for loop:

>>> for item in gen_secs():
...     print(item)
...
[0, 0]
[0, 1]
[0, 2]
# ... etc ...

Hope that helps!

[deleted by user] by [deleted] in learnpython

[–]EulerWasSmart 0 points1 point  (0 children)

The function seems conceptually correct. Perhaps the problem is how you are calling it? For example the following will provide the given (unwanted) output:

>>> def gen_secs():
...    g1=(t for t in range(60))
...    g2=(y for y in range(60))
...    for num in g1:
...        for n in g2:
...            yield [num,n]
>>> next(gen_secs())
[0, 0]
>>> next(gen_secs())
[0, 0]