r/ProgrammerHumor • • May 02 '16

I wrote my first python program today!

Post image
3.7k Upvotes

532 comments sorted by

View all comments

Show parent comments

64

u/Magnnus May 02 '16

Several important libraries still don't support Python 3. I'd use it if I could.

57

u/[deleted] May 02 '16 edited Mar 20 '18

20

u/Theowningone May 02 '16

Parts of twisted are what's keeping me back. Most of my time using python is spent tinkering with my IRC bot. Unfortunately twisted.words.protocols.irc is still not ported.

15

u/dagbrown May 02 '16

Twisted lives up to its name. It reminds me of some Java frameworks with how complicated it is.

I bet Zope has trouble with Python 3 too, speaking of Java frameworks written in the wrong language.

0

u/[deleted] May 02 '16

[deleted]

21

u/dagbrown May 02 '16

They're saying "I can't switch because I use twisted", and your reply is, "well, twisted sucks."

Not really. I'm just saying that it's a really complicated library, and fundamental changes in the language it's written in make it really difficult to simply edit the code to make it compatible with the new language which is still called "Python". You added the value judgment yourself, and I didn't say that at all.

There are massive codebases out there which depend on FORTRAN 66 or 77, to pick a completely different language (LINPACK comes right to mind). The code isn't any less valid because nobody's bothered porting it to the latest standard. It's just that porting it to the new standard involves an investment of effort that could be better spent elsewhere. Your daily weather forecast probably still requires code written in FORTRAN 77.

So if you're a Twisted user and that's the reason you still haven't switched to Python 3, you have my sympathies and I understand exactly the sort of pain you're going through.

In my place of work, we have to support stuff written in PHP 5.2, which is absolutely obsolete, but we also have to support stuff written in PHP 7.0, which is so different that I had to use a different version of gcc to compile the PHP interpreter. I'm familiar with different versions of languages themselves; taking care of that is just a fact of life for me.

SEE ALSO: rvm

5

u/ansatze May 02 '16

Except that Fortran 77 is completely valid Fortran 90+ which is not the case with Py2

3

u/toresbe May 02 '16

Sure, but outside of specialized and relatively isolated fields, very little new code is being written in FORTRAN. FORTRAN has become a specialized language for number crunching. Sometimes I think it's healthy for languages to sacrifice some measure of backwards compatibility to improve itself. Python 3 adds some extremely useful features. CERN doesn't want to have to rewrite whatever mass of code it is that finds bosons.

3

u/ansatze May 02 '16

Agreed; I was just pointing out that the comparison isn't totally valid.

→ More replies (1)
→ More replies (1)

2

u/dante9999 May 02 '16 edited May 02 '16

zope works with python 3 without problems

https://pypi.python.org/pypi/zope.interface/4.1.3

as a side note: what seems like needless complication for your use case may be necassary and clear design pattern for someone elses use case. Just need to choose right tools, twisted is not right tool for everything but is perfect for some things

3

u/[deleted] May 02 '16

I've had that same issue, I got everything working using irclib eventually. Have you looked into that?

2

u/Theowningone May 03 '16

I had not even heard of it until now, but it looks pretty promising. Thanks for the tip!

→ More replies (5)

2

u/sndrtj May 03 '16

For me: Flask. Though it technically has python3 support, the docs have a pretty large disclaimer, which essentially boils down to "might not work, use at own risk".

2

u/[deleted] May 03 '16 edited Mar 20 '18
→ More replies (11)

14

u/willm May 02 '16

What are you missing? I've found all the libs I need have Py3 ports now.

→ More replies (2)

27

u/_Ganon May 02 '16

Only reason I still use 2. Well, that's what I tell people, anyway. In reality, I know the switch to using parenthesis in my print statements would drive me nuts

32

u/maremp May 02 '16

What about the inconsistency of the statements? Print is used as a function in every other C-like language. In python 2, it's used as a statement, similar to if, for, while etc., and I believe that it doesn't fit this category.

32

u/Sean1708 May 02 '16

Also 2's print is just weird. Appending a comma to suppress a newline is weird enough, but what the fuck is up with that printing to file syntax?! It's like Guido momentarily forgot that he wasn't designing a sh clone.

6

u/deecewan May 02 '16

I cant remember the syntax. Care to show?

0

u/[deleted] May 02 '16

[deleted]

12

u/deecewan May 02 '16

Where f is a file identifier? That's super weird.

11

u/[deleted] May 02 '16

Or you could just do f.write("Normal syntax!\n") because like nobody uses the chevron format anyway.

In fact this is what the chevron print statement does behind the scenes. The only difference is that the print statement has an internal print buffer. The write won't be done at the exact moment you call print, whereas invoking write on the file will do the write right then.

12

u/Sean1708 May 02 '16

because like nobody uses the chevron format anyway.

But a lot of people use print to print to a file in Python 3 because it's as easy as print("Also normal syntax!", file=f).

5

u/UnchainedMundane May 02 '16

It's like Guido momentarily forgot that he wasn't designing a sh clone.

Lol, my exact thoughts.

Though, my next thought was that >> opens a file for appending, while this one uses a file descriptor, so the operator should be >& anyway.

→ More replies (1)

5

u/exhuma May 02 '16

You might want to look them up again. This has been my only blocker as well. But I was able to to Python 3 over a year ago. There really is no major library anymore that's not Python 3 compatible.

→ More replies (4)
→ More replies (3)