163 points · by sndean · 8y ago · 145 comments
Hundreds!
> "Please don't ask me to mail it to you -- at 1.76 Megabytes it is unwieldy at least..."
I can not even figure out if this means email or snail mail.
That's why when Google released GMail with 1GB of storage in 2004 ( https://slashdot.org/story/04/04/01/0038200/googles-gmail-to... ) it really blew everybody's mind.
See "logical formats":
God I love the language. The only language, that allows my thoughts to flow alongside writing code that allows my thoughts to manifest.
I am well experienced with C# as well, but something about statically typed stuff (I worked with C# before the dynamic stuff wasn't added to it) breaks the flow of thoughts.
With python, it's like designing systems on paper. Friction-free.
Truth be told, I am not a Python fan. I am seeing it take over in my industry, because it's superficially 'easy' and it's popular. The lack of static typing only later becomes a big problem when large codebases start to appear with many contributors.
I think the efforts of adding type/type hints to python are interesting - but there's a tension between "weee! Look at me ducktyping, metaprogramming all the prototypes!!"-design and leveraging types as part of your design. Haskell/f#/ml are great languages, but they feel very different from python (ml maybe less so,but afaik there are no full featured implementations with areasonable standard lib...).
If Python is the starting point, I think there's probably four approaches that makes sense if python ends up being limited (in part due to lack of typing): move to a language like Julia, proto-type in python; re-employment in go, prototype in python; reimplement parts in cython and/or rust, add type hints on top of python.
[ed: almost forgot, secret option number five: use restricted-python and the pypy framework to implement a language suited to the problem domain..]
Python + pascal are by far the ones I enjoy the most. I do a lot of F# now, and I like it, except, is not a good pascal!
i.e: The thing that bother my most of F# is that by default it not force to anotate types. One thing good about pascal is that is VERY EASY to figure out almost any line you read (without IDE help. Infurate me that F# know, but hide the knowledge to me!). With python is easy to infer the operations but not the data (ie: easy to read "I'm iterating" but not "and is a array of ints")
I could anotate a lot on F#/Python but is not idiomatic. This mean, that a lot of times I'm lost with F# in the ways is with python, with the worse thing that the infered stuff get crazy hard.
But, IMHO, python and pascal are in the TOP of truly well designed languages, where the sum of all the small things match well
What does make it easy to build big systems is semantic typing. I.e., the ability not just to declare a machine type, but to declare the actual assumptions made by any component about its inputs. In some low-level code those assumptions are about machine types (argument i must be an 8-bit integer, and s must be a string). But in other cases the assumptions are about what the argument represents (argument s is a string denoting a filename (not just any string), argument n is a number between 1 and 36.2 (regardless of machine type)). Any given component makes some assumptions about what it can handle, and if you can easily declare those assumptions and validate against them, then the component is easy to read, easy to understand, easy to use, safe against user errors, and easy to implement (as you don't have to write any code to handle conditions not allowed by the declarations).
The beauty of Python is that semantic typing can be implemented very naturally within the language itself, which is crucial because it has to be extensible to handle any given domain's objects if it is to be of use. There are a variety of options, but my own package Param (https://ioam.github.io/param) provides support for semantic typing, and if you look at some of the examples there you should be able to get a feeling for how you can have the best of all worlds in Python: freedom where you can handle it, constraints where you want them, and everyone being up front about what they are doing in a way that makes big teams able to work freely with whatever other people come up with.
I absolutely love the free form in the prototype phase, but once I've got that one nailed and want to make it maintainable... well, I always miss it at that time.
For unfammilliar codebases using MonkeyType is now a option too.
However, quickly iterating through to a solution and then optimizing it in a static language is a workflow that can be adopted. However, that may be necessary for only the most critical parts of an application.
With software development moving towards distributed computing, there is a lot of breathing space for languages like Python.
1. The KeyboardInterrupt exception for SIGINT. Whoever came up with that idea destroyed the credibility of the entire interpreter. Python falls flat on its face to me because of this one design choice. It's impossible to write a Python script that will not dump a full debug stack trace if you send SIGINT (ie: Ctrl+C) before the first line of your script is reached. That is, even if your very first line of code is a try/except block intended to catch KeyboardInterrupt, a SIGINT early on will still fail spectacularly at some point during Python's internal startup. Python runs a lot of code before turning control over to your script and it's simply not possible to, from within Python, catch these signals.
In order to provide a professional piece of software to clients that will not dump debugging gibberish to the terminal, one must wrap every single Python script with a shell script or small C binary that catches signals and proxies/rewrites SIGINT as SIGTERM, in order to avoid KeyboardInterrupt entirely. Something as fundamental as signal handling having been botched to this extent is frustrating.
2. The asyncio module. They screwed up the async implementation in the earlier phases, and the hacks that have been implemented in an attempt to improve the situation are grotesque. The state of async in Python is confusing enough as it is, but if you happen to run into one of the edge cases where the ways in which they've hacked the core of the language to make room for the async stuff affects you, you're in for quite the ride.
% python -c pass
^CTraceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in <module>
import os
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 400, in <module>
import UserDict
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 83, in <module>
import _abcoll
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py", line 9, in <module>
"""
KeyboardInterrupt
There was some discussion about this at https://bugs.python.org/issue14228 , with strong pushback from some of the core developers.One of the workarounds was to do:
python -S
to avoid importing the site module, then set your signal handlers, then import site manually. In that case the only output, if caught at the wrong time, will be the message 'KeyboardInterrupt'. This isn't quite what you want, but it's a lot closer.(Another request for this feature is at https://bugs.python.org/issue24261 .)
If you are still working with Python, and still want this feature, you might contribute to that second thread. The first is rather contentious.
I never noticed that but now that you say it...
There should be a way to pass an option to Python so that if you do 'python --early-sigint "message"' it prints the message for an early sigint.
You should post that to the python-ideas mailing list. It's a long and tedious process to get everyone on board by writing mails, but it works. Pretty much everyone can do it.
I suppose you could avoid the possibility of a name clash if the interpreter maintained a hidden, name-mangled reference for you...?
Personally I think it's a bigger problem that python isn't all that well suited to functional programming because of lack of tco etc (see slackness python etc). But I understand the design decision.
While they are not true anonymous functions, I have yet to stumble on a scenario where a context manager did not fit the bill. They're easy to create - nothing more than a try/except/finally with a "yield" call to execute... you guessed it, essentially an anonymous function block. It's a little mind-warping the first time through, but it winds up creating clean code. PEP 343 is a good source to learn more.
And you can do composition easily, that's the main seller for me.
conda create -n py1 python=1.0
source activate py1
python
Python 1.0.1 (Mar 26 2014)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>>
Sorry Windows, only on macOS and Linux. Python 1.0.1 (Mar 26 2014)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
Segmentation fault (core dumped)
.. I did capture the backtrace though; for what it's worth: (gdb) bt
#0 0x00000000004212bb in do_mkvalue ()
#1 0x00000000004210a7 in do_mktuple ()
#2 0x00000000004211a8 in do_mkvalue ()
#3 0x00000000004213f2 in vmkvalue ()
#4 0x00000000004214a1 in mkvalue ()
#5 0x0000000000422438 in err_input ()
#6 0x000000000042258c in parse_file ()
#7 0x00000000004226ae in run_file ()
#8 0x0000000000422bf3 in run_script ()
#9 0x000000000042232a in realmain ()
#10 0x00000000004039f4 in main () python -c "print 'hello world'"> "If you have a WWW viewer"
Just curious, had the term "browser" not caught on by then?
The WWW? Isn't that just a WWW viewer? :)
Java may not get much exposure here or in startups, but if you go out in the real world of 'boring' business applications, Java is pretty much the defacto language (together with C#).
If you go outside this filter bubble and look at the large IT companies, such as IBM, Oracle, Accenture, Atos, Capgemini, SAP, etc. they are all JVM/.NET shops. Also, on job sites such as Indeed, there are more Java jobs than Python jobs (currently respectively ~60,000 vs. 47,000 in the US) [1].
Note, I am not denying that Python is popular. Python is immensely popular. And I definitely like the Python ecosystem more than the Java ecosystem. I was just contending that the original statement that Python is the most successful language in the last 20 years is concorrect. Java is younger and is (still) more widely used in companies. Of course, Python may or may not surpass Java some day.
[1] Also, the positions mentioning Java often require that an applicant knows Java, whereas ads with Python often have wording such as "dynamic languages such as Javascript, Ruby, Python, and Perl are preferred".
http://www.benfrederickson.com/ranking-programming-languages...
Github is for FOSS projects, or building CV portfolios for startups that think we don't have anything else to do after work.
I use Python for simple scripts and often for data transformation. But e.g. at work we have a few million lines of C# that I would never ever want to manage if it was written in Python.
I take issue with this. In terms of speed, python can't even hold a candle to java. Even when using pypy, which isn't 100% compatible with cpython.
Java have a super big assets: A very powerfull VM. And this is the part where python is not as good. Is sad that Python3 was not used as the moment to build up a good VM, but well, history is history.
And this actually mean: Put a very strong and well funded team behind it. Make a good VM for python is hard:D
I like Python, but as an Android developer, well Java is still the obvious choice for me.
I use a code formatting tool in my python work flow as well but it’s nowhere near as nice/fun as with a non-significant white space language ...
https://groups.google.com/forum/?_escaped_fragment_=topic/co...
”Python for MS-DOS
Python 2.4.2 for DOS/DPMI, built on the DJGPP platform, is also available”
.So, yes, there was one. The link (http://www.caddit.net/pythond) works, and seems to still have the binary. You will need a ”proper Long Filename Driver for your platform” to fully enjoy it.
Have been using Python 3 exclusively in production since about a year ago and it really seems like the whole 2/3 thing is starting to blow over.
I haven't found any packages I need that aren't 3 compatible and porting to 3 was really way easier than people had made it out to be.
For example [issue #1](https://github.com/tensorflow/tensorflow/issues/1) for Tensorflow - one of the most popular Python packages out there is "add Python 3 support".
It's one of the biggest reasons not to use Python IMO. No other popular language has this issue. The other reasons I wouldn't use Python:
1. Difficult to distribute standalone programs. You end up having to bundle an interpreter which is a pain. 2. So many programs include python interpreters you end up with insane path issues, especially on windows. 3. It's still slow.
Py2/3 is not an issue in practice.
No other popular language struggles with issues of backwards incompatibility? That's a huge exaggeration.
> Difficult to distribute standalone programs. You end up having to bundle an interpreter which is a pain.
I guess then you generally prefer not to use interpreted languages?
> So many programs include python interpreters you end up with insane path issues...
How is that? There's usually a system Python which system programs should reference explicitly if they care. If you code up a Python program without being careful about its dependencies, then yeah you're asking for trouble. But that's true of any program, whether it needs to locate an interpreter or be compiled against a shared library.
None of the pain points you mention are inherently specific to Python. But maybe Python's huge success and ubiquity trick people into conflating general software development issues with Python issues; rather like how people start confusing popular brand names with actual products (e.g. Band-Aids).