6 ms·
Two pieces of advice: - Just learn the language with all of its quirks - If you are new, ignore the quirks until you are ready Creating a new language sounds
by II2II 6y ago
Two pieces of advice:
- Just learn the language with all of its quirks
- If you are new, ignore the quirks until you are ready
Creating a new language sounds ideal, but there are a whole slew of caveats. Python tends to be recommended as a beginner language since it is reasonably easy to learn and offers considerable room for growth By the time the Next Python reached that stage, we would have accumulated a new two decades of techniques and features that would leave Next Python in a similar position to Python today. That assumes that people would even agree upon which language would serve as Next Python as a standard recommendation. One of the advantages of having so many people agreeing upon Python as a starting point is it eliminates the first hurdle novices most novices face: figuring out where to start.
As for the batteries being included, it is also a strength of Python. Choosing libraries can be difficult. That's true for the novice and it's true for anything but trivial projects. Lean standard libraries encourage fragmentation. We should have learned that from the shortcomings of C, yet many languages have followed in the same footsteps with similar results. We should have learned that large standard libraries can be useful, from the success of languages like Java and Python. Package managers don't change the degree of fragmentation, they only make it easier to deal with.
- smitty1e 6y ago> Creating a new language sounds ideal I seriously cannot think of anything I could do to exceed Python. Does it do everything? No. But name a tool with significantly greater overall reach. Some compete, but seriously. . .
- jimbob45 6y agoBetter main method calling, better chaining, multiple constructors, and better reflection.
- jtdev 6y agoAgreed. I’ve always felt that the following sums up why Python is my preferred language: Python is the second-best language for everything.
- monsieurbanana 6y agoWith the big, big, notable exception: targeting the browser.
- folkrav 6y agoTo be perfectly fair, unless you count WASM or other compiles-to-JS-but-not-quite-native langs (which, outside TS, are pretty niche), this is the case with literally every language except JS.
- monsieurbanana 6y ago> unless you count WASM or other compiles-to-JS-but-not-quite-native langs As a happy user of clojurescript, or seeing the popularity and adoption rate of typescript, I do not count them out.
- Izkata 6y agoPossibly not for long: https://www.brython.info/ https://www.brython.info/
- mkl 6y agoBrython has been around since 2014.
- pansa2 6y agoPython is great if you’re writing code to run on your own computer(s). But it’s terrible for packaging into executables to give to others (compared to Go), for embedding in applications (compared to Lua) and for running in the browser (compared to JS). There’s no reason a new scripting language couldn’t excel in all three of those areas. But AFAIK none currently come close.
- Wowfunhappy 6y agoPyinstaller seems to work pretty damn well for packaging standalone binaries. Or at least it does on macOS, I haven't tried it on other platforms.
- vram22 6y agoI have tried PyInstaller some, on Windows, for both CLI and GUI (wxPython) apps, and what I tried worked fine, including single-file EXEs.
- MikeTheGreat 6y agoI'm using PyInstaller on Win10. It works well, although the single-file binaries get slower as I add more libraries because it starts by extracting that single file out into a temporary directory and then running it. It's a personal project so I like to experiment, but it's also a CLI program that accepts command line arguments, runs, and then exits, so a 3-5 second delay _each_time_ it runs is pretty painful. Luckily for me there's a 'single directory' option, which puts everything (uncompressed) into a folder. Snappy start because there's no decompression step, and while I like the idea of a single file .exe it turns out I don't really need that (I'm not copying the program from computer to computer). So - thumbs up for PyInstaller!
- sireat 6y agoPyinstaller is nice for packaging projects with smaller libraries. Hello world is about 7MB. Try including pandas with a few other popular libraries. Suddenly you have 500MB blobs. Not very practical for passing around multiple projects. I suppose that is not worse than Electron apps...
- jshen 6y agoThere are a lot of things python could do to be much better. Two examples, 1) dependency management in python is a train wreck compared to most modern languages. 2) the way package paths are done for imports is far more confusing than it should be.
- javajosh 6y agoJavaScript has greater reach. ES6 in a modern browser with native modules, and if you avoid classes and this, focus on object literals and pure functions, and pick a decent utility library, its a very good environment with max reach.
- didibus 6y agoI'm not sure what you mean by reach? But Clojure given one definition has more reach. It can make use of Python libraries, Java libraries, C# libraries, JavaScript libraries, Erlang libraries, C libraries, and can run on desktop, mobile and browser.
- peterkelly 6y ago> I seriously cannot think of anything I could do to exceed Python. Just off the top of my head: - Pattern matching - Multi-line lambdas - Proper variable capture in lambdas and inner functions (as was fixed with the 'let' keyword vs 'var' in recent versions of JavaScript) - Support for cyclic imports (a bad pattern in general but necessary in some cases) - A well-defined C API for extensions that doesn't get them too entangled in the internals of CPython. This would make it possible for other implementations to reach the level of library support that CPython enjoys.
- maxs 6y agoI would say proper variable scoping in general. It would be awesome to have let variables in python!
- zo1 6y agoVariables are scoped just fine from my point of view. What do you mean by proper?
- maxs 6y agoI meant to say block scoped. Variables in python have function or global scope but no global scope. E.g. you can say for x in ...: and then use x outside of the loop.
- knighthack 6y agoI have no idea why you would want to declare an x in the loop, and then use it outside the loop. There are better ways of doing things. The fact that you can do such a thing in JavaScript is exactly why JavaScript is such a mess of a language with its globally-declared and hoisted variables. That sort of practice has never made sense, and is not a language design that Python should follow.
- deleted 6y ago[deleted]
- mattlondon 6y ago> ignore the quirks until you are ready If you are new, chances are do not yet know what is a quirk and what is idiomatic. It can be challenging and frustrating trying to follow guides or tutorials and they are all doing things differently - which is the "right" way? You have no idea as a beginner.