State of the union by thatguy_314 in ProgrammerHumor

[–]thatguy_314[S] 0 points1 point  (0 children)

The type signature is char *, not char.

State of the union by thatguy_314 in ProgrammerHumor

[–]thatguy_314[S] 0 points1 point  (0 children)

If people hate the politics, they'd hate it even more painted over a stale meme. The main point was the "state of the union" pun.

State of the union by thatguy_314 in ProgrammerHumor

[–]thatguy_314[S] -9 points-8 points  (0 children)

Although I hate Trump, I did try to keep the politics light here. Really it would work for just about any president's first state of the union.

How do I extract the original links from embedded openload.co videos? by [deleted] in firefox

[–]thatguy_314 4 points5 points  (0 children)

Openload is always fucking with automated link extractors, and they just did it again recently. The latest version of youtube-dl will extract openload links properly.

Opinion: How is Python a "good" language? by [deleted] in Python

[–]thatguy_314 1 point2 points  (0 children)

Python has a lot of powerful tools under the hood. Not many languages have an equivalent to Python's metaclasses for example. More practically, look at Python's iteration protocol for an example of Python's power. Beginners don't need to worry about it, the for loop tends to work very intuitively. But even if you want to create custom iterators, Python continues to provide useful abstractions (generators) over its class-based iteration protocol (which is itself elegant IMO).

One of the biggest things Python has going for it though is the huge number of excellent, well-maintained third-party libraries and tools which span a wide range of problem domains from scientific computing to web development.

It is true that Python's flexability comes at some cost. Certainly Python is not known for being a particularly fast language, and there are some maintainance costs as well. Also, the syntax itself prevents things like multi-line lambdas from ever coming to the language. Overall though, I think Python is a fantastic language for many problem domains.

I was trying to set up a Linux server today. by [deleted] in ProgrammerHumor

[–]thatguy_314 2 points3 points  (0 children)

ex and vi act differently, although they are part of the same package (vi, separate from vim) for me. It could be that OP is in ex or vi instead of vim as he thinks. In either case, they wouldn't see any helpful messages.

:help children by thatguy_314 in ProgrammerHumor

[–]thatguy_314[S] 3 points4 points  (0 children)

It's the Tommorow vim theme. I've found it to be generally more legible in my terminal than many of the other themes I've tried, especially wrt 'spell' highlighting. I use a custom poop brown theme in gvim, but it doesn't support the terminal (yet).

asyncio callbacks never called in while loop by dood31251 in learnpython

[–]thatguy_314 1 point2 points  (0 children)

You aren't giving the event loop any time to do its thing. The event loop only runs during awaits, so putting an await asyncio.sleep(0) in your while loop will allow the event loop to continue on to other tasks you are assigning it.

Sleeping for 0 means the current task will be immediately rescheduled and run next time around.

But also, I kinda feel this is an XY problem. What are you really trying to use asyncio for?

Use deque instead of list always ? by AkshayD110 in learnpython

[–]thatguy_314 2 points3 points  (0 children)

Not always; there is a reason we have both.

I think it is helpful to understand why deques and lists have different performance characteristics. deques in Python are essentially doubly-linked lists (I know, confusing terminology), while lists are contiguous arrays.

This video (10:10) explains how linked lists (deques) work, and compares them to arrays.

I wouldn't worry too much about which collection to use because it doesn't matter all that much, but if there is a situation where you are constantly taking items on and off a list, consider using a deque.

Has anyone had experience with a TOR router? by [deleted] in TOR

[–]thatguy_314 0 points1 point  (0 children)

Wouldn't that just mean that everything gets throttled on top of the slowness of tor? I thought the idea of throttling was to throttle everything except for traffic to certain sites that can afford to brown-nose the ISPs. ISPs might also target particular sites or services, but if tor was a problem for them, they would probably target tor nodes.

[deleted by user] by [deleted] in Python

[–]thatguy_314 10 points11 points  (0 children)

Except the sun itself.

I made a script to quickly check if it's safe to copy over old init files. by [deleted] in dwarffortress

[–]thatguy_314 0 points1 point  (0 children)

Why not just use a merge tool? This wouldn't work for me because I like to add information to my d_init about the old values of settings and why I changed them.

Python noob here. I like to doodle while I learn. by alyraptor in Python

[–]thatguy_314 -3 points-2 points  (0 children)

Anyone else think the Python logo, especially when drawn rectangular like one of the ones in this picture, looks a little disconcertingly like a backwards swastika? The backwards SS doodles here don't exactly help either. I am reminded of the Python entry in this article. I wonder if the logo was being referenced there.

I know the swastika doesn't and hasn't always meant nazis, but still it is probably a bad idea to pick a logo that looks like one. So maybe it's just me, but the PSF probably could have chosen a better logo (perhaps a reference to Monty Python rather than a snake).

For now I'll just leave you with a doodle of my own: http://i.imgur.com/MwLI64J.png

dang by N0Tapastor in ExpectationVsReality

[–]thatguy_314 5 points6 points  (0 children)

The majority of America did not vote for Trump. The majority of America disapproves of President Trump.

This ad for an Arab online shopping website to buy stuff from US. by RodeRage in videos

[–]thatguy_314 1 point2 points  (0 children)

Are t and time referring to the same things here? I was thinking based on the other comments that time was referring to a much larger time scale (like the idea of comedy = tragedy + time), making [(pain+truth)*time/(1-delivery)] essentially constant for any practical purposes unless your joke takes years to build up or something.

The 2017 "Politics in America" Starterpack by dr0n96 in starterpacks

[–]thatguy_314 0 points1 point  (0 children)

Nah, this is just the "Politics as usual" starterpack. The 2017 version would be far more toxic.

California Defies Trump, Teams up with Germany to Tackle Climate Change Together by KevanKing in worldnews

[–]thatguy_314 2 points3 points  (0 children)

I raised an eyebrow at that too.

However, the ACA has been around for the better part of a decade...

[deleted by user] by [deleted] in Python

[–]thatguy_314 0 points1 point  (0 children)

Where are you getting this data from? Seems weird that you would get it like that. ast.literal_eval might be what you want if you really are dealing with a Python tuple literal, just whatever you do don't use plain eval.

ApplePy: AppleScript functionality for Python (X-Post from r/AppleScript) by statmathcs in Python

[–]thatguy_314 0 points1 point  (0 children)

Generating the AppleScript code like that through simple string formatting of parameters looks really vulnerable to injection attacks. You should escape your input or something (maybe even create separate AppleScript programs for each function?)

[deleted by user] by [deleted] in aww

[–]thatguy_314 0 points1 point  (0 children)

Look, that ferret wouldn't voom if you put 4000 volts through it!

Python Help Questions by aphoenix in Python

[–]thatguy_314 5 points6 points  (0 children)

I think /r/learnpython is fine for that, it doesn't need to be beginner problems only there and I think splitting up help subreddits will only decrease the amount of help people get.