|
What's a good library for drawing an array of pixels? They would change over time (I'm not animating figures, though), and I plan on eventually feeding into some LEDs, but for now I'd rather prototype without wiring up a bunch of LEDs. I've thought of just doing it with Flask + Javascript but I'm wondering if there's some other good solution. I'm semi-willing to use some other language, but Python's the language I use daily so I'd rather just stick with that unless I can't find an adequate solution.
|
# ¿ Apr 8, 2017 01:23 |
|
|
# ¿ May 2, 2024 00:52 |
|
huhu posted:https://python-pillow.org/ OnceIWasAnOstrich posted:numpy for the array and matplotlib imshow() to render? praise be to numpy
|
# ¿ Apr 8, 2017 01:59 |
|
QuarkJets posted:Wouldn't that necessitate also specifying that the step size is 1, then? Although practicality beats purity
|
# ¿ Apr 11, 2017 16:40 |
|
When you run a script, either directly or by importing it, it executes all the code in it from top to bottom. But suppose you wanted to import this as a module. If you had a runall() function defined and then called at the bottom, it would run when you import, which may not be the behavior you want. You might want to have different behavior if it's running as a script, or as a module.
|
# ¿ Jun 2, 2017 13:07 |
|
shrike82 posted:Do most of you run Python in Windows? In the brave new world of Bash for Windows, you don't really need to run VMs or dual boot if you don't want to. Ghost of Reagan Past fucked around with this message at 12:35 on Jun 6, 2017 |
# ¿ Jun 6, 2017 12:32 |
|
Dex posted:i'm a windows 7 holdout on my work laptop for reasons, does the windows subsystem for linux fix all those annoying things like not being able to run gunicorn because windows doesn't have fcntl and so on?
|
# ¿ Jun 6, 2017 14:42 |
|
You can totally do thiscode:
|
# ¿ Jun 7, 2017 12:56 |
|
CPython has the Global Interpreter Lock, which means that only one thread can process Python bytecode at a time. It's not that Python code can't be multi-threaded, but that the interpreter is locked if one thread is executing Python bytecode; no others can process bytecode. Apparently it helps because the CPython memory management isn't thread-safe. As far as I understand it, anyway, I'm no CPython internals guru (I've looked in there precisely once). The GIL is acquired by a thread and released on I/O operations, if it helps you understand where bottlenecks might occur. I love Python, but the CPython implementation has some serious drawbacks and other languages should be used in certain cases. For what it's worth, most Python modules written in C don't acquire the lock (because they're running in C and aren't Python bytecode).
|
# ¿ Jun 15, 2017 16:12 |
|
Boris Galerkin posted:Well I just had a frustrating time figuring out what was wrong with a part of my code when it turns out it was numpy being weird. code:
|
# ¿ Jul 4, 2017 16:06 |
|
One. Otherwise, users of the function will have to do type-checking themselves and call the right function or pass in the right kwargs, when you could do that burdensome work for them and reduce the possibility of error/proliferation of ways of doing said checking. Simple is better than complex.
|
# ¿ Aug 5, 2017 19:23 |
|
You might also be interested in other plotting libraries. I'm personally fond of ggplot, a port of the R library. There's also Bokeh, which has some interactivity functionality and is useful for web data visualizations. But seaborn + matplotlib will serve you well.
|
# ¿ Aug 16, 2017 13:48 |
|
Thermopyle posted:As a followup to that thing I posted from stackoverflow about how Python is the fastest growing language, they delve into why its the fastest growing language.
|
# ¿ Sep 15, 2017 03:42 |
|
VikingofRock posted:Why does this happen? (Python 3.6.3) You can do the following: Python code:
You could probably use functools.partial to do this but (also I'm not super familiar with it and the 30 seconds I tried I couldn't get it to work right so) E: f; b
|
# ¿ Dec 27, 2017 00:20 |
|
Thermopyle posted:I'm so dependent upon formatting and syntax highlighting that I literally cannot read that post without significant effort. I mean without indentation it isn't valid Python anyway
|
# ¿ Jan 13, 2018 01:41 |
|
Boris Galerkin posted:Anyway on an unrelated topic, does anyone use Jupyter notebooks? I feel like Jupyter notebooks are one of these things that I've always heard about and people rave about it, like Docker, but I don't really "get" it so I'm having a hard time seeing use cases for them. But I'll admit that once I actually sat down and understood Docker sometime last year I went from "meh okay" to "holy poo poo, this is awesome" real fast. I'm hoping the same thing happens with Jupyter notebooks. They're less good for most other coding things. There are obviously holdouts but if you work with data in Python, you're going to use notebooks.
|
# ¿ Feb 22, 2018 19:48 |
|
Business posted:I don't know quite how to ask for what I'm looking for because I know very little about actual software development even if I've done some programming. I have not tried it at all so I can't vouch for it, but Python Fire might be useful for your purposes?
|
# ¿ Jul 12, 2018 02:07 |
|
NtotheTC posted:I'm not trying to nominate it for code of the year, just pointing out a real-world example of it EDIT: I think my greatest Python code crime was erasing exceptions deep in some library and baffling myself and others about how the gently caress it was breaking. It made sense at the time but holy gently caress it's a mess.
|
# ¿ Dec 29, 2018 04:35 |
|
QuarkJets posted:Brown starts off saying that the stdlib doesn't have enough useful features, so users need to rely on third party stuff, which sucks The fact is there isn't a great solution to the problems because Python and the library are nearly 30 years old now. But you can make it better, and as a Python developer I think that's a good goal. 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 15:50 |
|
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 |
|
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 |
|
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 |
|
Hollow Talk posted:I have a quasi-religious (i.e. style) question, since I briefly paused today when writing something to consider what would be the most natural way for other people. Background is how to write/compose a set of transformations, e.g. funneling a dict through a series of functions which each take a dict, operate on it, and return a dict.
|
# ¿ May 1, 2020 12:36 |
|
taqueso posted:DNG is a digital negative file from lightroom I think
|
# ¿ Jun 17, 2020 12:16 |
|
|
# ¿ May 2, 2024 00:52 |
|
The homebrew maintainers also made it impossible to install older packages from a git commit, which you might want for development purposes, because in the Real World we have to use non-bleeding-edge software for compatibility reasons. Basically making it useless to developers. This is recent and they've been absolutely unresponsive and unsympathetic to the mess that this causes. It's not the "intended workflow", which they just changed without warning because they clearly don't care about how people actually use brew. It's always been garbage and now it's somehow worse than it's ever been.
|
# ¿ Nov 22, 2020 03:52 |