|
It's not necessarily "bad" for what it does, but it does mean that Python ships with a Tcl interpreter and some other stuff to make it work which causes some amount of explosion in the building python. This isn't a great thing given how little tkinter is really used out in the real world.Ghost of Reagan Past posted:But yes just rip off the Python 2 bandaid. Now that supervisor 4 has Python 3 support there is basically zero excuse for it. Your lovely legacy application needs to get ported to Python 3, and that's all there is to it.
|
# ? May 25, 2019 16:09 |
|
|
# ? Jun 5, 2024 04:39 |
I find it hard to get worked up over libraries maintaining support for 2.7 while 2.7 is still supported by Python core.
|
|
# ? May 25, 2019 16:17 |
|
the yeti posted:Is tkinter really that bad? I ask this relatively innocently--I've seen a small example and it seemed pretty clumsy, but I have almost no experience with Python GUIs besides learning PySimpleGUI to refactor said small example.
|
# ? May 25, 2019 16:26 |
|
There's lots of stuff in the stdlib with inconsistent APIs or just simple stuff like not following PEP-8. Ironing out a bunch of that would help make the stdlib feel less icky. There's a lot of low hanging fruit here, but it just requires someone to take ownership and get it done. Something I use constantly is the logging package. getLogger...really?
|
# ? May 25, 2019 17:40 |
|
Thermopyle posted:I haven't read your posts on this subject real closely, but look into xpath maybe? Thanks, I'll look in to that!
|
# ? May 25, 2019 18:57 |
|
the yeti posted:Is tkinter really that bad? I ask this relatively innocently--I've seen a small example and it seemed pretty clumsy, but I have almost no experience with Python GUIs besides learning PySimpleGUI to refactor said small example. It's pretty bad, in that the options are too simple and clunky to make really nice interfaces. But it's good enough for simple ones. But I agree that it shouldn't be part of core Python, it should be a separate module. Or another example, getopt vs optparse vs argparse. We don't really need 3 argument parsing modules in stdlib, and 1 of them (getopt) is even kind of bad. Even the python docs for getopt and optparse point out that you should be using argparse, instead. The getopt doc page even has an argparse example, to basically say "look at how much cleaner and better this is, please don't actually use getopt". But so long as it exists in stdlib, newer people will continue stumbling upon getopt and then using it.
|
# ? May 25, 2019 21:18 |
|
You can always build python without tkinter, but that just makes using/deploying python more complicated in general.
|
# ? May 26, 2019 00:39 |
|
Hello I’m new to Python but I want to jump thirty steps ahead. I developed the code for a little program I can use for work (although perhaps Python wasn’t the best language for it, it’s a program that asks you how many tickets of each type do you want then spits out a price ) but I want to make a decent UI for it that anyone could use. Where would I work towards next? Thanks
|
# ? May 26, 2019 02:39 |
|
Empress Brosephine posted:Hello I’m new to Python but I want to jump thirty steps ahead. I developed the code for a little program I can use for work (although perhaps Python wasn’t the best language for it, it’s a program that asks you how many tickets of each type do you want then spits out a price ) but I want to make a decent UI for it that anyone could use. Where would I work towards next?
|
# ? May 26, 2019 02:44 |
|
Thanks for that, I already know HTML and CSS so it shouldn't be that much of a stretch
|
# ? May 26, 2019 02:56 |
|
Ghost of Reagan Past posted:My standard suggestion is build it as a web app. I always recommend Flask for this. You'll have to build HTML templates, but I've generally found that HTML+CSS+Javascript is better than most other GUI solutions like Qt or (as we've been talking about) Tkinter. Is there a way to organize a Flask app that doesn't involve hypothetical end users either relying on the developer to host the app or arranging their own server?
|
# ? May 26, 2019 03:48 |
|
the yeti posted:Is there a way to organize a Flask app that doesn't involve hypothetical end users either relying on the developer to host the app or arranging their own server?
|
# ? May 26, 2019 03:51 |
|
I think Flask is way out of my league skills wise now...I’ve only done If statements and for loops so far
|
# ? May 26, 2019 03:53 |
|
Empress Brosephine posted:I think Flask is way out of my league skills wise now...I’ve only done If statements and for loops so far Eh you'll be fine, just dive in. Flask is a lot of magic but if you follow the instructions you can build websites quite quickly. Python's an easy language, so just build poo poo even if it's out of your league.
|
# ? May 26, 2019 04:05 |
Dominoes posted:Pendulum, like moment and arrow, has no discrete Date and Time types. Unfortunately, although it does, to be fair, position itself just as a datetime replacement.
|
|
# ? May 26, 2019 07:56 |
|
Empress Brosephine posted:I think Flask is way out of my league skills wise now...I’ve only done If statements and for loops so far Building stuff out of your league is how you get them in your league!
|
# ? May 26, 2019 18:12 |
|
Yeah that’s true...I’ll try it out thanks for the pep talk goons :3
|
# ? May 26, 2019 19:15 |
|
Hi, I’m thinking about starting a game project and I’m wondering if some kind people would give me their 2 cents on this plan: The game itself is a simple auction game, where players “invest” in a portfolio of stocks, which give the right to someone for an income stream. The game then totals up this “income stream” using a bunch of silly metrics across trending twitter topics and tweets. This money is then returned to the player’s account at either a gain or a loss. Cash balance is just points, with stock market-like properties, except unlike the stock market, players must reinvest once a week. They will also have opportunities to invest in silly side games during the week, using the same system, but it is not mandatory. There are a lot more details but that’s the jist. I must emphasise, this is not a game for real money and will never be. It’s just among friends, like a silly Fantasy sports offshoot. Testing on the fly is ok, so long as it’s accessible.
The game will max out at 30 participants at first. Unlikely to be used more than a few times a week. I don’t mind paying for useful services/packages, but this game will not be earning any money, so within reason. May need light media like profile photos, photo descriptions of stocks etc, but doesn't need to be overly polished, just useable. I am an economist by trade who is familiar with python. I use jupyter/numpy frequently. I’ve set up a django login before with a dashboard. So this project is a little outside my norm, but it really seems like I could get a bare bones project up and running with enough time. Any feedback appreciated!
|
# ? May 27, 2019 15:31 |
|
That's all technically feasible and both Flask and Django are fine choices. There's nothing you'll have to or need to pay for except for maybe somewhere to host your code.
|
# ? May 27, 2019 17:03 |
|
I have been having a gilded poo poo of a time installing things with pip the last couple of days on everything. Pretty much anything has (PEP 5nn) after the module name it's trying to install, before it just fails saying something about no backend. The number varies but it seems to be in the 10s to 20s. What's changed recently. I can't find anything on it. e: From my pinebook, trying to install scipy in a python3 venv. Unfortunately it took a very long time to reach this conclusion, and when it finally did, the error was far longer than the lxterminal buffer. I've encountered similar on my Orange Pi 3 and Orange Pi zero running Armbian, and on my RPi Zero running Raspbian stretch. For some reason they are getting all worked up, trying to build wheels, and failing because of this PEP error. code:
General_Failure fucked around with this message at 00:16 on May 28, 2019 |
# ? May 27, 2019 22:51 |
|
Is there any recommended reading for thinking and designing your programs in an OOP style? I understand the basics of writing OOP, and I can walk through someone's OOP-styled program and understand what's going on. However, when it comes to designing my own programs, I naturally go to procedural or functional style. Learning more OOP seems like it would be beneficial since the majority of people write their python apps that way.
|
# ? May 28, 2019 01:00 |
|
That is a great question. I wonder the same thing. Like when I write a program that sends an email... do I split the code that sends an email into another object? Do I write the code in a functional style and then make all of the functions a method in my class?
|
# ? May 28, 2019 01:45 |
|
dougdrums posted:Oh and if you want to match on regex or an expression, you can filter with a comprehension over the dict then reduce. When choosing between idiomatic and clever, always chose idiomatic. The Else block is a perfectly natural part of code thats been around since the earliest days of both imperative and functional coding. code:
|
# ? May 28, 2019 04:42 |
|
duck monster posted:Hell, the latest fancy academic languages like Haskell build it right into the type system. I'm not sure what you mean? If you are referring to case expressions, any form of matching in haskell reduces into a case expression, but they're expressions. I'm not sure that there are any special rules for inference of case expressions, besides what can be derived from the semantics of case itself. You can't really compare if-elseif-else or cases in imperative languages to matching in functional languages (or the conditional operator), because the former are statements, and the latter are expressions. Matching with a dict in python is just the functional perspective, in that sense.
|
# ? May 28, 2019 12:09 |
|
Thermopyle posted:That's all technically feasible and both Flask and Django are fine choices. Thanks for reading, no doubt I'll be back with more questions once I get into the thick of it.
|
# ? May 28, 2019 12:36 |
|
For an application (I'm thinking of things like flask, where you create a single app instance to do everything/hold state info), does it make sense to create one logger at the application level or still to just create them per module as needed?code:
code:
|
# ? May 28, 2019 13:09 |
|
Going to start my first django project this week. If I like pycharm, is it worth getting the professional version over community because of the wed development related features? If this project goes well I expect to be using it daily for several weeks at least.
|
# ? May 28, 2019 13:16 |
|
Yes.
|
# ? May 28, 2019 13:20 |
|
Boris Galerkin posted:For an application (I'm thinking of things like flask, where you create a single app instance to do everything/hold state info), does it make sense to create one logger at the application level or still to just create them per module as needed? In my experience there's never any need to be passing logger objects around. Because of their namespacing magic, getLogger('a.b') will grab the same logger regardless of where it's run from, and it will inherit from getLogger('a') regardless of the relationship between the files. What I've done that works well is always do getLogger(__name__) for logging messages, and for configuration you always of changing the settings of the master logger instead of individual loggers. In other words, you can still make them all behave the same way, or not, as you prefer. On the other hand, if you are always using the same logger, you lose one of those options.
|
# ? May 28, 2019 13:45 |
|
Yeah I’d always make loggers for a module using __name__ because if you have static utility functions, whether done as free functions or as staticmethod or classmethod, you won’t necessarily have access to instance attribute loggers. Now you might go ahead and make instance loggers that are children of the module logger, but to make the namespacing work properly so you can do configuration at the top of the hierarchy a module level logger should probably be in there somewhere
|
# ? May 28, 2019 13:54 |
|
I find myself configuring a logger named like 'project' at the start and then each module gets its child logger 'project.' + __name__; just using the root logger and say, setting the level to DEBUG, will apply that to library code using loggers as well.
|
# ? May 28, 2019 14:39 |
|
KICK BAMA KICK posted:I find myself configuring a logger named like 'project' at the start and then each module gets its child logger 'project.' + __name__; just using the root logger and say, setting the level to DEBUG, will apply that to library code using loggers as well. Well, __name__ includes the module hierarchy so as long as you're working in a package you should still have a package root separate from the global root. Unless you just have a loose connection of scripts, or a project consisting of multiple packages (without a parent package), then yeah you may need to do string concatenation.
|
# ? May 28, 2019 14:51 |
|
CarForumPoster posted:Going to start my first django project this week. If I like pycharm, is it worth getting the professional version over community because of the wed development related features? If this project goes well I expect to be using it daily for several weeks at least. If you can afford it then yes absolutely
|
# ? May 28, 2019 17:24 |
|
SurgicalOntologist posted:or a project consisting of multiple packages (without a parent package)
|
# ? May 28, 2019 17:57 |
|
Weird. Put an __init__.py there and make a containing package IMO.
|
# ? May 28, 2019 18:02 |
|
Depending how you run it your entrypoint might have a __name__ of '__main__' and not get caught by configurations you apply to your package root just fyi.
|
# ? May 28, 2019 23:15 |
|
Hopefully quick Python installation question: I've installed 3.7.3 onto a Windows server, confirmed the path is set, and restarted it. I can now execute commands from command line, PowerShell, etc. locally just fine, but the same commands produce a "Can't find a default Python" error if I attempt to execute them as a remote batch job. The remote user has administrative rights, any ideas of what I might be missing?
|
# ? May 29, 2019 04:53 |
|
PierreTheMime posted:Hopefully quick Python installation question: I've installed 3.7.3 onto a Windows server, confirmed the path is set, and restarted it. I can now execute commands from command line, PowerShell, etc. locally just fine, but the same commands produce a "Can't find a default Python" error if I attempt to execute them as a remote batch job. The only thing I can think of off the top of my head the $PATH for python is not being passed to the remote user an environment setting. What happens when you execute with the full pathname to python in the script?
|
# ? May 29, 2019 05:28 |
|
Proteus Jones posted:The only thing I can think of off the top of my head the $PATH for python is not being passed to the remote user an environment setting. If I run it directly it works fine. If I try specifying the version, the py launcher helpfully informs me that it can't detect Python being installed. Test script (PyTest.py just runs print("test")): code:
code:
|
# ? May 29, 2019 13:51 |
|
|
# ? Jun 5, 2024 04:39 |
|
The subject of pickling came up earlier and I am new to the whole idea of serialization so I wanted to check if what I'm doing makes sense. I am working with spaCy for NLP and I wanted to save large Doc objects (spacy thing that contains lots of NLP data for text(s)) on the backend of my django app. Here's what I'm thinking: a user uploads a text and the backend processes it and saves it as a .pickle so they don't have to re-process the text every time they want to use it. When the user wants to do something to the previously uploaded text, I have the backend open up the saved pickle, search through it, and serve that data to the user. The pickle file seems gigantic to me (600 kb text file to 17 mb .pickle) so I'm worried I'm going about this the wrong way. Is this an appropriate use case? Eventually I want to add users and allow them to save processed text files. Do I store those pickle objects as fields in a database or is that a Bad Way to do things?
|
# ? May 29, 2019 20:49 |