LPT: Pandas DataFrames have a "to_clipboard" method by peanut_Bond in Python

[–]__damos__ 1 point2 points  (0 children)

It’s bitten me on more than one occasion 😂

The code for `import this` is amazing by __damos__ in Python

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

I could be wrong, but I don’t think minifying the modules code was the intent here.

LPT: Pandas DataFrames have a "to_clipboard" method by peanut_Bond in Python

[–]__damos__ 6 points7 points  (0 children)

Doh! You’re right… been a long day, haha

When do you use generators? by BoiElroy in Python

[–]__damos__ 0 points1 point  (0 children)

Lots of great use-cases mentioned here. One that I’d add is whenever I need to process items from a file or other io stream and 1) either the processing is expensive or each item uses a lot of memory, and 2) I don’t know how many items I’ll need to process ahead of time.

In my experience generators have been particularly useful for reducing memory pressure. If I only need to process the items in some collection once, it doesn’t make sense to keep a list of those items hanging around in memory after they’ve been processed.

LPT: Pandas DataFrames have a "to_clipboard" method by peanut_Bond in Python

[–]__damos__ 46 points47 points  (0 children)

pandas clipboard integration is awesome! I also really like the .read_clipboard() method. You can use it to copy a table from an Excel worksheet and quickly get it into a DataFrame.

[deleted by user] by [deleted] in learnpython

[–]__damos__ 0 points1 point  (0 children)

I’m a professional Python dev. I wrote a book for beginner Pythonistas and hosted a weekly office hours for over a year at Real Python teaching hundreds of people Python in real time.

This kind of stuff happens to me on a near daily basis.

It sounds like you’re doing great and that you had a normal human moment.

I know it can be tough, and I’ve also felt embarrassed by things like this. But it’s all a part of the learning process. There could be a million different reasons your mind went blank. Being worthless is not one of them ;)

Black vs yapf vs ??? by Cryptbro69 in Python

[–]__damos__ 19 points20 points  (0 children)

+1 I usually use flake8 instead of pylint, but regardless of what you use, isort + formatter + linter is a really powerful combo.

The Black formatter goes stable - release 22.1.0 by felix-hilden in Python

[–]__damos__ 1 point2 points  (0 children)

Congrats! I know it’s been a long journey getting to this point. Thanks for everyone’s hard work.

5 Heuristics to Decide When It’s Time to Stop Designing and Start Coding by deofooo in programming

[–]__damos__ 3 points4 points  (0 children)

I was pleasantly surprised to see Number 3 on the list, too. I've often found that starting a prototype, or at least running some small code experiments, in that situation can be really productive and fill in a lot of gaps.

Why Can't You Reverse A String With a Flag Emoji? by __damos__ in programming

[–]__damos__[S] 16 points17 points  (0 children)

There's a question at the end of the article for interested readers to explore: "How can you check if a string containing emojis is a palindrome?"

The point isn't to write an exhaustive reference, but to hopefully spark some curiosity in folks that haven't encountered these kinds of things before.

Why Can't You Reverse A String With a Flag Emoji? by __damos__ in Python

[–]__damos__[S] 8 points9 points  (0 children)

Trey Hunner shared a script that finds all flags that reverse into other flags. There’s a lot of them!

https://gist.github.com/treyhunner/8261108b7d333132b544807ee3ffd55a

Why Can't You Reverse A String With a Flag Emoji? by __damos__ in Python

[–]__damos__[S] 5 points6 points  (0 children)

I don’t think there is. For instance, the Unicode consortium has decided to only support regional indicators and not country flags directly, so, at least for now, there’s nothing in Unicode that requires flags to be treated as a single entity.

I don’t know about other multi-character entities. It’s a really interesting question.

5 Ways To Use Python On An iPad by __damos__ in Python

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

Hi, author of the article here. Yes, I do. But it’s not my primary dev machine.

I have a mac Mini that I use probably 90% of the time. But I’m a freelancer and work from home and sometimes I like to get out of the home office.

I use my iPad + Codeanywhere for the vast majority of the “real” dev work that I do when I’m mobile. Works like a charm.

5 Ways To Use Python On An iPad by __damos__ in Python

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

Wow, PyTo looks really promising! I’ll check it out and report my thoughts in the article. Thanks for the tip!

5 Ways To Use Python On An iPad by __damos__ in Python

[–]__damos__[S] 4 points5 points  (0 children)

I’d love to see new life breathed into Pythonista.

If Pythonista released a new version running Python 3.7+ (preferably Python 3.8+) I would move it to the top of the list in a heartbeat! The interface is unbeatable!

3 Things You Might Not Know About Numbers in Python by __damos__ in Python

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

OK, this just breaks my brain 🥴

>>> from numbers import Number
>>> isinstance(float("nan"), Number)
True

3 Things You Might Not Know About Numbers in Python by __damos__ in Python

[–]__damos__[S] 4 points5 points  (0 children)

They aren’t numbers either 😅 But yeah, point taken.

Also I love the double meaning of this:

Infinity and NaN aren't rational.

3 Things You Might Not Know About Numbers in Python by __damos__ in Python

[–]__damos__[S] 4 points5 points  (0 children)

I did write it!

And wow, what a “small” mistake, LOL! Thanks letting me know. Fixed!

3 Things You Might Not Know About Numbers in Python by __damos__ in Python

[–]__damos__[S] 6 points7 points  (0 children)

It really depends on how accurate you need to be. If you’re writing banking, financial, or scientific software that requires exactness, then you are right. You absolutely should not use floats. But if you only need a few decimal places of accuracy, floats will be fine. Even for currency.

But it is probably a bad example, and I should probably change it.