|
Is there any really good standard library reference for Python? Compared to Ruby, the official documentation absolutely sucks, and it's really frustrating me because I absolutely adore the Pylons framework and then doing more menial Python stuff in the framework is comparatively painful.
|
# ¿ Nov 12, 2007 13:50 |
|
|
# ¿ Apr 25, 2024 06:02 |
|
Has anyone used the Django ORM bindings to MongoDB? How well do they work? I need to write a frontend to the network monitoring system I'm building.
|
# ¿ May 26, 2011 04:26 |
|
Is anyone aware of a pre-existing synchronized priority queue implementation for gevent? I'm writing a Nagios->Graphite perfdata forwarder and I want to make sure that new files coming in on the inotify greenlet are given priority over old files lingering in the spool (queued on a different greenlet). Edit: Never mind, it seems that gevent has an undocumented priority queue that I found by going through queue.py Vulture Culture fucked around with this message at 19:27 on Oct 30, 2012 |
# ¿ Oct 30, 2012 15:01 |
|
Captain Capacitor posted:Something like this?
|
# ¿ Oct 30, 2012 20:45 |
|
I just finished my first legitimate (non-toy) Python project, Metricinga, a daemon that forwards Nagios/Icinga performance data to Graphite. Would anyone mind taking a minute to look over my code and tear it apart so I can write better code?
|
# ¿ Nov 1, 2012 21:41 |
|
Captain Capacitor posted:I personally would find it a bit annoying if I had to consult a few different places for logging output (sys.stderr output versus whatever is given). Just a personal nitpick.
|
# ¿ Nov 2, 2012 01:26 |
|
Titan Coeus posted:
I guess I should be happy that many of your concerns focused on someone else's code, though. I'll still fix it up to be less... 2002. Titan Coeus posted:
Titan Coeus posted:
Titan Coeus posted:I'm not sure about send_metric(self, metric). If you have no internet connection, this is going to loop indefinitely. You should probably set some limit (20?) on the number of failed attempts. I do need a more graceful way of deleting the files only after the metrics are sent. Propagating control messages down several layers in gevent (or anything) is frustrating. Titan Coeus posted:In run(), your finally block has a "shutdown successfully" message. If joinall throws some other non-expected error, that message will be false. Titan Coeus posted:See the following regarding string formatting: http://docs.python.org/2/tutorial/inputoutput.html#old-string-formatting Vulture Culture fucked around with this message at 04:00 on Nov 2, 2012 |
# ¿ Nov 2, 2012 03:58 |
|
BigRedDot posted:A few weeks ago my company put on PyData NYC, a conference dedicated to data analytics with python. Authors and contributors of numpy, scipy, pandas, pytables, ipython, and other projects all gave great talks to several hundred attendees. Today all the talks were made available on Vimeo, for anyone interested!
|
# ¿ Nov 10, 2012 19:30 |
|
BigRedDot posted:A few weeks ago my company put on PyData NYC, a conference dedicated to data analytics with python. Authors and contributors of numpy, scipy, pandas, pytables, ipython, and other projects all gave great talks to several hundred attendees. Today all the talks were made available on Vimeo, for anyone interested!
|
# ¿ Nov 11, 2012 21:27 |
|
stubblyhead posted:I'm in the process of learning python, and I'm having trouble with array slice syntax. So foo[1:4] will return indices 1-3, which is really counter-intuitive to me. What's the reasoning for the second number being the first index not included instead of the last index that is? The latter seems more logical to me, but I'm sure there are things I haven't taken into consideration about why that would be a bad idea. This is one of those things that constantly frustrates the poo poo out of people who regularly switch between Ruby and Python for different projects.
|
# ¿ Nov 20, 2012 04:42 |
|
Is there a thin database abstraction layer for Python that basically just takes user-supplied connection strings using whatever database driver a user feels like without having to do a bunch of manual legwork to import and instantiate some arbitrary class name in my own code? I don't want an ORM.
|
# ¿ Nov 28, 2012 05:14 |
|
Suspicious Dish posted:SQLAlchemy
|
# ¿ Nov 28, 2012 05:28 |
|
duck monster posted:I was always fond of ADOdb on PHP
|
# ¿ Nov 30, 2012 19:37 |
|
I need a tool for yet another project that, given a reply email containing a quoted part, will extract out the portion of the message that's just the reply. Does anyone know anything that would fit the bill? Edit: Nice! https://github.com/zapier/email-reply-parser Vulture Culture fucked around with this message at 17:14 on Dec 1, 2012 |
# ¿ Dec 1, 2012 16:45 |
|
Does logging call flush() on registered log handlers when a program exits, or is that something that needs to be done manually in the application?
|
# ¿ Dec 5, 2012 07:25 |
|
Delicate Stranger posted:Sounds like the consensus is to learn a framework like Django or Flask and then, piece by piece, learn the magic it's doing under the hood. As necessary. PHP was invented so HTML authors could easily add backend functionality to their pages using a style that was convenient and comfortable. This is fine for Joe's Homepage (the "H" in "PHP/FI"), but this approach obviously started to have problems as more entire websites started to be built as dynamic applications. Vulture Culture fucked around with this message at 20:17 on Dec 8, 2012 |
# ¿ Dec 8, 2012 20:15 |
|
Caddrel posted:I'm not very proficient with python yet, but of the the free books out there Dive Into Python is helping me get up to speed quickly. I think it's best when you are already familiar with similar data structures and OO in other languages, and just need to know how python does it. It's an okay thing to teach you the absolute basics, but make sure to read lots of Python code actually written in the past several years if you're going to take it seriously.
|
# ¿ Dec 10, 2012 01:25 |
|
MeramJert posted:I kind of like project Euler when I'm learning the syntax of a new language. I know all the solutions to the first 10 problems or so, which is all I generally do. I do think it can be helpful to type them in anyway in a new language to get a feel for it.
|
# ¿ Dec 11, 2012 01:18 |
|
duck monster posted:Use this thing: http://kivy.org/
|
# ¿ Dec 15, 2012 21:13 |
|
Hanpan posted:I have some new scripts that need to run periodically, once an hour, once a day etc. Supervisor seems to be really backwards at starting process at intervals so I've been looking into alternatives. Obviously, cron would be ideal for this but does require a crontab, something I've tried to avoid because it makes the app less encapsulated.
|
# ¿ Dec 23, 2012 04:18 |
|
I'm becoming more interested in TDD, but I'm largely clueless because most of what I use Python for is async with gevent. Anyone have any recommendations for starting points with testing concurrent clusterfuck applications?
|
# ¿ Apr 21, 2013 00:16 |
|
Dominoes posted:The tutorials I learned from would use statements like "for parameter in parameters" or "for day in range". I don't like them because I have the phrase "parameter(s)" and "day(s)" several other places in the program, and want to make it easy to distinguish.
Both of these things also make it harder to unit test your code, which starts the death spiral of "this code is unreadable and I don't want to touch it because I might break something." Dominoes posted:The short names also make the code easier to read, although harder for someone else to interpret. I'm open to changing and suggestions on alternate ways of doing this. "loc1" was a typo.
|
# ¿ Apr 22, 2013 01:02 |
|
Suspicious Dish posted:Don't do that. Your package's payload should have all the stuff it needs. Offline installation should be supported. For basically all other instances though, agreed.
|
# ¿ Apr 22, 2013 21:48 |
|
Rohaq posted:So I'm writing a Django app that needs to talk to our RequestTracker system: No problem, the python-rtkit module does a pretty good job of talking to the RT API. Vulture Culture fucked around with this message at 16:17 on Apr 23, 2013 |
# ¿ Apr 23, 2013 16:15 |
|
ARACHNOTRON posted:That is actually literally the case. RabbitMQ/pika message queue consumption :/
|
# ¿ Apr 24, 2013 02:42 |
|
QuarkJets posted:When you're done with an object that takes up a lot of memory (for instance, a 1k by 1k by 1k numpy array), is it considered better practice to delete it with del or just leave it for garbage collection? Objects in Python don't have any defined destructor semantics and inherit them from the runtime, which makes object destruction sort of an onerous thing. In CPython objects are reference-counted and __del__ is called as soon as the last reference goes out of scope, but in IronPython and Jython they pick up the finalizer semantics from the CLR and JRE mark-and-sweep GCs, respectively.
|
# ¿ Apr 28, 2013 21:20 |
|
Suspicious Dish posted:CPython has a cycle collector too which means that destruction isn't deterministic if you have a reference cycle. I do not advocate using __del__ for anything as it can gently caress up your program in various, subtle ways.
|
# ¿ Apr 28, 2013 21:29 |
|
Can someone point me towards a larger Python project that they think has really good unit tests?
|
# ¿ May 9, 2013 13:14 |
|
From a unit testing perspective, each file should contain all the imports it needs to test the classes defined in that file. Anything else is going to be a trainwreck once you start actually writing test cases.
|
# ¿ May 13, 2013 16:19 |
|
Hammerite posted:Is it considered poor form to use the fact that loop variables are still set after the loop? Python code:
|
# ¿ May 14, 2013 21:42 |
|
Hammerite posted:At each step in the process, at least one of the elements of the dictionary should satisfy the if clause (otherwise the dictionary shall be considered badly-formed by definition). However, I don't know which one(s).
|
# ¿ May 15, 2013 15:45 |
|
Hammerite posted:Is it good style to use assert statements as a form of documentation? i.e. "I know that at this point in the function, condition X must hold because it follows from something I did a few lines ago. But the reader trying to understand the function might benefit from having this pointed out to them, so put in an 'assert X'."
|
# ¿ Jun 5, 2013 12:00 |
|
QuarkJets posted:That's usually due to all of the additional layers of security and monitoring software that are installed; most corporate/government computers are just going to be Windows workstations and won't be running custom code at all
|
# ¿ Jun 9, 2013 21:13 |
|
Pollyanna posted:How come the get_timeframe() function doesn't know what ask_timeframe() is? I defined it before I called get_timeframe().
|
# ¿ Sep 25, 2013 03:01 |
|
a lovely poster posted:PySide is my personal recommendation
|
# ¿ Sep 26, 2013 01:09 |
|
Hammerite posted:The Game of Life occurs on an infinite plane, so given that you don't have enough memory to keep the whole thing in memory, how do you get around that limitation? I appreciate that there are other ways to manage things than a simple two-dimensional array of on/off values, for example you could instead have a list of cells that are "on", but (1) the number of cells that are "on" can still grow without bound, (2) your implementation is still incomplete on some level if it doesn't support an arbitrary, potentially infinite set of "on" cells in the initial state. Vulture Culture fucked around with this message at 20:20 on Oct 1, 2013 |
# ¿ Oct 1, 2013 20:16 |
|
And this is a pretty awful algorithm to begin with. The Sieve of Eratosthenes could be implemented in a few lines more, and the Sieve of Atkin in a handful more than that. Each has way less runtime complexity.
|
# ¿ Oct 20, 2013 20:36 |
|
Most of the dynamic content (polls, visualizations, etc.) on the Washington Post's website is also Django. They've got a pile of extensions on their GitHub account.
|
# ¿ Nov 4, 2013 06:37 |
|
Pollyanna posted:So, you know those web games where you click a button, a number goes up, and you feel a fleeting sense of accomplishment before the high fades away and you need a new fix? (Don't worry, I'm just using this as a little project.) Is that something I can program in Python and attach to Django or Flask, or does it rely on stuff like Javascript instead?
|
# ¿ Nov 4, 2013 19:28 |
|
|
# ¿ Apr 25, 2024 06:02 |
|
Pollyanna posted:You have got to be kidding me
|
# ¿ Nov 4, 2013 23:40 |