News for hackers. Stuff that matters.
Re:“Python's batteries are leaking” by tanilama on Saturday May 18, 2019 @03:55PM (#19949399)
> Brown called out the XML parser and tkinter in particular for making the standard library larger and harder to build, burdening all programmers for the sake of a few

Tkinter needs to go...There is very little reason except for the legacy ones, why it needs to be there still...

Re:“Python's batteries are leaking” by liability on Saturday May 18, 2019 @06:20PM (#19950043)
If Tkinter goes, then Python is dead to me. I use Python for small dep-free single file GUIs for small projects meant to be used by people who have Python installed but can't be bothered to go through an installation checklist. Tkinter is great for that and is the only reason I bother using Python for anything.
Re:“Python's batteries are leaking” by zbentley on Sunday May 19, 2019 @11:34AM (#19953780)
"pip install --user -r requirements.txt" is not a terribly odious "installation checklist", and I don't think it's the start of a slippery slope towards one either.

If you're worried about people not RTFM when using your projects, you could always start your scripts with the standard try/import/except wrapper around the required package, and tell them to run pip install when it's not found--or (and this is a terrible idea) run it in a subprocess for them.

Re:“Python's batteries are leaking” by liability on Monday May 20, 2019 @11:21PM (#19967354)
Asking my users to use the command line is odious.
Re:“Python's batteries are leaking” by blhack on Sunday May 19, 2019 @01:43AM (#19951661)
Pardon me, but why wouldnt you be able to just run an old python if tkinter came out of the stdlib, or even just package it with whatever you are distributing?
Re:“Python's batteries are leaking” by bobbylarrybobby on Sunday May 19, 2019 @02:09AM (#19951736)
The point was that it’s much easier to distribute a single file app than it is to “correctly” distribute a full app with dependencies bundled.
Re:“Python's batteries are leaking” by blhack on Sunday May 19, 2019 @01:10PM (#19954279)
Could you use cython to accomplish this? I personally haven’t used it, but looking at some examples it looks really straightforward.
Re:“Python's batteries are leaking” by analognoise on Saturday May 18, 2019 @06:09PM (#19950007)
Tkinter is awesome, I hope it isn't jettisoned. I haven't found anything that easy to use with a similar Canvas.

Being able to add items to a canvas, attach callbacks to them - without tracking them yourself, setting up the infrastructure for indexes, bounding boxes, all that stuff - I haven't found anything else as easy as Tkinter's Canvas.

If there is something better, I'd love to hear about it.

Re:“Python's batteries are leaking” by DonHopkins on Sunday May 19, 2019 @08:34AM (#19953010)
Come over to the PyCairo side of The Force! It will drawn you in and fill your path with beautiful pixels.

https://cairographics.org/pycairo/

You do have a good point about Tk's canvas easy input handling though, which is something Cairo doesn't do. It's just an immediate mode drawing api like PostScript's rendering model or html canvas 2d context.

You can pass a pycairo context into C++ Python extensions, and they can go to town with it quite efficiently.

https://github.com/SimHacker/micropolis/tree/master/Micropol...

https://github.com/SimHacker/micropolis/blob/master/Micropol...

Re:“Python's batteries are leaking” by analog31 on Saturday May 18, 2019 @08:54PM (#19950673)
I love Tkinter, but I could accept letting it be an installable package rather than built-in. I can certainly see its size and complexity being a burden on smaller installations. I think making "pip install tkinter" be bulletproof would go a long way. You're not going to start using Tkinter unless you're reading a tutorial anyway.

There's always going to be a good debate about which batteries should be included. I'd almost put numpy ahead of Tkinter, but maybe that reflects my bias for scientific programming.

Re:“Python's batteries are leaking” by smitty1e on Saturday May 18, 2019 @04:31PM (#19949570)
There is the expectation of IDLE, no? Isn't that a tkinter product?
Re:“Python's batteries are leaking” by analog31 on Sunday May 19, 2019 @12:38AM (#19951465)
This question suggests a criterion for what batteries should be included, which is platform dependence. What both Tkinter and IDLE do, is ensure that there is a basic GUI library, and a code editor, that can run on any platform.

Coming from Visual Basic, and similar things (HyperCard, Turbo Pascal), being able to run a program with GUI on both Windows and Linux with no code changes was nothing short of amazing to me. So maybe that's one way to draw the line with batteries, namely to make it so a beginner can get started with Python, with no regrets about which OS they're using. This requires some out-of-box hardware abstraction, where they keyboard, mouse, and display, all effectively count as hardware.

Re:“Python's batteries are leaking” by tanilama on Saturday May 18, 2019 @04:59PM (#19949675)
But this only can't justify that tkinter being part of the STANDARD library.

Taking tkinter out of the standard library won't stop IDLE being built with it, if they chose to do so.

Re:“Python's batteries are leaking” by dragonwriter on Saturday May 18, 2019 @05:04PM (#19949703)
Though OS packaging may frequently obscure this because OS packagers break up the language distribution, Idle is part of the language distribution, so (unless you expand the distribution to include core packages outside of stdlib, as with Ruby’s gemification effort) it has to be built with stdlib alone. Tkinter, therefore, needs to be part of stdlib.
Re:“Python's batteries are leaking” by tanilama on Saturday May 18, 2019 @05:10PM (#19949733)
Taking IDLE outside of the standard distribution and make a separate download link for it, isn't in anyway going to hurt Python at this point.

Just move tkinter like what they do with typing package is good enough to address everyone's need.

Re:“Python's batteries are leaking” by detaro on Saturday May 18, 2019 @05:01PM (#19949690)
Depends, do you consider IDLE part of the standard library? (it's separated in many distributions, but documented in the standard library documentation, so it's a bit mixed, but it's probably okay to not consider it part of the library, but just the standard distribution)
Re:“Python's batteries are leaking” by sigzero on Saturday May 18, 2019 @04:56PM (#19949663)
It is.
Re:“Python's batteries are leaking” by bjourne on Sunday May 19, 2019 @08:58AM (#19953082)
Tkinter is used by matplotlib's show() function. Without tkinter, you would somehow need to replace it with some other platform independent gui library.
Re:“Python's batteries are leaking” by zbentley on Sunday May 19, 2019 @11:36AM (#19953784)
If it weren't in the stdlib, could it not be installed as a depdencency when you install matplotlib?
Re:“Python's batteries are leaking” by jonnycomputer on Saturday May 18, 2019 @05:51PM (#19949925)
Why does it need to go?
Re:“Python's batteries are leaking” by rlayton2 on Saturday May 18, 2019 @06:14PM (#19950026)
It uses a non trivial amount of resources for (nearly) every python install. Therefore if it isnt of substantial use then it should be removed to free those resources
Re:“Python's batteries are leaking” by icegreentea2 on Saturday May 18, 2019 @06:46PM (#19950140)
It does, but it's hardly an egregious amount (my 3.7 install on Win10 has it at 800Kb... though I guess tcl takes up 10MiB =P). For reference, the built in venv module (which I never use cause I'm all about that virtualenv life) is 1MB. The python tests are 20MB, and that ships by default on every python installation.

Like if you were in a resource constrained situation, you would be customizing your python install anyways (if nothing else, getting rid of the docs, the tests, maybe stripping out all but the compiled code...).

Re:“Python's batteries are leaking” by schlenk on Sunday May 19, 2019 @06:41AM (#19952616)
Maybe just use kitdll instead of a full blown Tcl/Tk distro, to provide the dependency, that would shrink the size a lot.

http://kitcreator.rkeene.org/fossil/wiki?name=KitDLL