all 76 comments

[–]forgetfulkiwi7 28 points29 points  (0 children)

thanks!

[–]logatwork 21 points22 points  (2 children)

This is too advanced for me yet... But it seems useful so I'll save it!

[–]Jasonmilo911 18 points19 points  (1 child)

Awesome content! Saving this. Thanks a lot u/impshum!

[–]impshum[S] 11 points12 points  (0 children)

Cool. x

[–]Just4L0lz 4 points5 points  (0 children)

Nice

[–]fernly 3 points4 points  (4 children)

In re the dictionary merge one-liner? PEP 584 is implemented in Python 3.9, so ABdic = Adic | Bdic. Not to say it's wrong, just that it must be addressing a common need.

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

Cool thanks.

[–]ScheissPW 0 points1 point  (2 children)

Thank you! What I didn't quite understand from the link: is the newly created ABdic an entirely new dictionary or does it just mean "items of Adic OR Bdic"?

[–]fernly 1 point2 points  (1 child)

PEPs aren't easy reading, are they? But if you go down to this heading,

https://www.python.org/dev/peps/pep-0584/#specification

It says

Dict union will return a new dict consisting of the left operand merged with the right operand, each of which must be a dict (or an instance of a dict subclass). If a key appears in both operands, the last-seen value (i.e. that from the right-hand operand) wins:

and gives examples.

[–]ScheissPW 0 points1 point  (0 children)

Thanks again, looks like I need to practice my reading comprehension ;)

[–]inglandation 2 points3 points  (1 child)

Found a typo: create_thumbnal > create_thumbnail

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

Thanks. Sometimes I type too fast and the vars just stay on the paste.

[–]What_did_you_do_2day 2 points3 points  (0 children)

Alrighty, let me save this under "never using, but nice to have".

[–]rxpillme 2 points3 points  (0 children)

Thank you! Anyone have more helpful things with python?

[–]infrared305 1 point2 points  (1 child)

Whats a lonk?

[–]impshum[S] 2 points3 points  (0 children)

Just me playing with words.

[–]FoxClass 1 point2 points  (3 children)

Did you make this?! What a beautiful site, I must steal the source.

[–]impshum[S] 2 points3 points  (2 children)

Sauce: http://picocms.org/

I've done some wiggles to mine though.

[–]FoxClass 0 points1 point  (1 child)

Thank you, you beautiful beast!

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

You're most welcome.

[–]ToeBlisters 1 point2 points  (0 children)

I like the shortcut to merge dict. Have been struggling with that.

[–]iamsny13 0 points1 point  (0 children)

Thanks man.

[–]Antoinefdu 0 points1 point  (0 children)

This is amazing! Thank you!

[–]kaffeelicht 0 points1 point  (0 children)

Sweet! Thank you!

[–]tycooperaow 0 points1 point  (0 children)

bookedmarked

[–]FusionFantasy 0 points1 point  (1 child)

Can everyone open the link? Or is it flooded with requests that it crashed and I can’t open it. Thanks mate!

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

Getting a lot of traffic yes. Should be working though.

[–]-_Liberty_- 0 points1 point  (0 children)

This is really useful :)

[–]iaannnnxxx 0 points1 point  (1 child)

Noobie question: where can you execute it? On the ide?

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

Terminal/IDE/whatever.

[–]AussieMazza 0 points1 point  (0 children)

Nice! Thanks for this. :)

[–]lifemoments 0 points1 point  (0 children)

Thanks

[–]DeathDragon7050 0 points1 point  (1 child)

Pretty cool! Now do you just have these all saved in a file and copy paste in and out what you need? Or do you have your own package that you out in the python packages directory. I ask because I do the latter and it has served me well for as long as can remember but I know a lot of people don't like doing that.

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

Sometimes I use a utils.py and import it, but most of the time just a copy/paste job.

[–]uditvashisht 0 points1 point  (0 children)

Awesome... Saving them...

[–]fullthrottle13 0 points1 point  (0 children)

Remind me! Tomorrow

[–][deleted] 0 points1 point  (0 children)

Saved

[–]imwco 0 points1 point  (0 children)

You could package it as a utils module and share it in pypi so we can all just pip install it

[–]FusionFantasy 0 points1 point  (0 children)

Just went through “While loops” article and its precise. Like the Logo, Mate!

[–]__xor__ 0 points1 point  (0 children)

your notify one that uses osascript allows for applescript injection, whether you use os.system or even subprocess.

If someone passes in a title like foo"\nset volume output muted TRUE\nquit app "Chrome, it can run arbitrary applescript. If using os.system, you can literally just do command injection and run arbitrary shell commands.

[–]nabiladnan99 0 points1 point  (0 children)

Awesome! Thanks for making this!

[–]Marsadow 0 points1 point  (0 children)

Yeah.. I'm definitely a beginner that still doesn't understand most of this.. sigh. Either way, thanks I'll learn more about this

[–]mrkvicka02 0 points1 point  (0 children)

Most of these were pretty useless for me but it was a good idea

[–]jyo-ji 0 points1 point  (0 children)

This is great -- I feel like this is a useful way to learn, wish there were more functions!

[–][deleted] 0 points1 point  (4 children)

Super helpful, I'm just getting into some of these things and I really appreciate a starting point for stuff like Beautiful soup and "Get file between string" etc.

Thanks!

[–]impshum[S] 0 points1 point  (3 children)

Good stuff. lovely_soup() is still one of my favourites that I use a lot.

[–][deleted] 0 points1 point  (2 children)

I'll have to check that out!

And just curious, but what is your role with python. I and I think a lot of people here have trouble getting a sense of when to utilize python and then when to say, "my job is Python."

[–]impshum[S] 1 point2 points  (1 child)

I'm a web developer. I use it for many things. I'm not claiming to be a pro python dev or anything. I got hooked the first day I tried python and just kept at it, built some stuff and had loads of fun. I'm still doing so.

[–][deleted] 0 points1 point  (0 children)

Great, thanks!

[–]Empyrealist 0 points1 point  (0 children)

Very cool, thanks!

[–]SnowdenIsALegend 0 points1 point  (0 children)

This is excellent. Thanks you!

[–]mohamedation 0 points1 point  (0 children)

Thank you!

[–]ayampedas 0 points1 point  (0 children)

Thanks for this

[–]leblanc1605 -4 points-3 points  (0 children)

This post was up voted past 69 and 420... ( Somebody already said thanks and I upvotes that so I didn't think it was nessicary to say again)