Tall, Snarky Canadian 16 Apr 2018 3 min read Python An approach to lazy importing in Python 3.7 [Please note that the code in this blog post is now up on PyPI as part of the modutil library ] One of the new features in Python 3.7 is PEP 562 which adds support for __getattr__() and __dir__() on modules. Both open up some interesting possibilities. For instance, with __dir__() you can now have dir() only show what __all__ defines. But being so immersed in Python's import system, my interest lies with __getatt
[Twisted-Python] anyway to know client address in XMLRPC? wang wei wgwigw at gmail.com Thu Mar 29 03:52:20 MDT 2007 Previous message (by thread): [Twisted-Python] anyway to know client address in XMLRPC? Next message (by thread): [Twisted-Python] Why classes in twisted.protocols.basic use "static member" to store states? Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > > def render(self, request): > self.request = request > return xmlrpc.XMLRPC.render(self, request) > > thanks, I should read
trainedmonkey by Jim Winstead Jr. Entries tagged 'Python' Using AutocompleteSelect in a Django Admin form I was building an action for a Django Admin changelist view to allow associating models to a related model. But to select the related model on the form, a regular ModelChoiceField would load all of the possibilities to populate the <select> form field, which was pretty terrible when there are thousands to tens of thousands of options. Within the change view of the model, you can just add that field to a
Python Archives (1993): Re: overflow exceptions # Re: overflow exceptions Tim Peters ([email protected]) Sat, 18 Dec 93 15:14:34 EST - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] - Next message: [email protected]: "dospath.py anyone?" - Previous message: Bruce Perens: "IRIX 5.1 ?" - Maybe in reply to: Doug Moen: "overflow exceptions" > [doug] > ... this trauma would be unnecessary if short integer operations > returned long integers if the result is too large to fit in a short
A comprehensive guide to Python's module system: best practices, common pitfalls, circular imports, and performance optimizations with real-world examples
Activity Feeds Quick search...⌘K Ask AI Python Client Side SDKs JavaScript iOS Android React React Native Flutter Server Side SDKs Node Go .NET PHP Java Python Ruby v3 — latest v3 — latest v2 — legacy Basics Quick Start Installation Architecture & Benchmark Roadmap & Changelog Client Side Client-Side Overview Feed Groups Feeds and Follows Activities Features Reactions Bookmarks Comments File Uploads User Mentions URL Previews Pins Polls Event Handling Moderation Collections Audit Logs Translation
Is ChatGPT useful for Python programmers, specifically those of us who use Python for data processing, data cleaning, and building machine learning models? Let's give it a try and find out
Open Sidebar August 07, 2013 Python-like Docstrings in Ruby! About six months ago, I watched Peter Cooper's Ruby Trickshots and learnt that Ruby has an interesting syntax that allows you to concatenate strings by simply placing them after each other. For example: "foo" "bar" # => "foobar" I quickly realised that that meant that this was valid syntax: """foo""" # => "foo" Which meant that Python-like docstrings were syntactically valid in Ruby! I hacked up a bit of code that let you read out the docstring in
Garbage Collection for Python P: 'Ello, Miss? RC: What do you mean "miss"? P: I'm sorry, I have a cold. I wish to register a complaint! RC: We're closin' for lunch. P: Never mind that, my lad. I wish to complain about this object what I allocated not half an hour ago. RC: Oh yes, the, uh, the instance...What's,uh...What's wrong with it? P: I'll tell you what's wrong with it, my lad. 'E's dead, that's what's wrong with it! RC: No, no, 'e's uh,...he's referenced. --> Portable Garbage Collection Summary Refere