Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content
Stack Overflow
  1. About
  2. For Teams
Loading…
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Timeline forHidden features of Python

Current License: CC BY-SA 2.5

16 events
when toggle formatwhatbylicensecomment
Feb 23, 2012 at 17:31commentadded Adam Parkin Decorators are extremely handy, but they can be a PITA to write. There's so many variations -- class based vs not class based, decorators which can decorate methods vs functions (or both), adding descriptors, decorators which take arguments, etc. So while the simple example above may not be a "hidden" feature of Python, I'd say consider it a starting point for learning about a rather beefy topic in the language, and should be in the list.
Feb 16, 2012 at 7:39commentadded XTL As for useful (arguable), some more common ones: @ property, @ classmethod, @ staticmethod, @ coroutine, @ _o (monocle)
Jan 15, 2012 at 7:45commentadded Casey Rodarmor Decorating a decorator with the decorator decorator? We must go deeper.
Feb 7, 2011 at 16:29commentadded Dzinx @Dexter: Because that decorator may be universal -- it can be attached to any function for a short moment, e.g. when you need to debug it, and then very easily removed. Besides, there are many uses of decorators other than debugging.
Feb 3, 2011 at 21:49commentadded Stellar Sword why would this be useful except in the very rare situations? Why not just redefine the function and add optional parameters?
Jan 23, 2011 at 20:49commentadded Kamil Szot I thought we were supposed to list hidden features of python not the awesome features of python. ;-)
Jul 25, 2010 at 23:08commentadded Jesse Dhillon If the standard is whether or not a feature is documented, then this question should be closed.
May 28, 2010 at 15:26commentadded Justin Hidden? this is a documented featurepython.org/dev/peps/pep-0318
Apr 15, 2010 at 16:18historyeditedPersonmanCC BY-SA 2.5
added 14 characters in body
Apr 6, 2010 at 15:33commentadded Humphrey Bogart @vetler Most of the thing here are hardly "hidden".
May 23, 2009 at 21:14commentadded Johnd vetler, the questions asks for "lesser-known but useful features of the Python programming language." How do you measure 'lesser-known but useful features'? I mean how are any of these responses hidden features?
Oct 3, 2008 at 6:51commentadded Dzinx Well, it's not present in most simple Python tutorials, and I stumbled upon it a long time after I started using Python. That is what I would call a hidden feature, just about the same as other top posts here.
Oct 2, 2008 at 13:52commentadded Vetle How is this a hidden feature?
Sep 22, 2008 at 15:53commentadded sirwart When defining decorators, I'd recommend decorating the decorator with @decorator. It creates a decorator that preserves a functions signature when doing introspection on it. More info here:phyast.pitt.edu/~micheles/python/documentation.html
Sep 21, 2008 at 15:00history made wikiPost Made Community Wiki byCommunityBot
Sep 19, 2008 at 12:32history answeredDzinxCC BY-SA 2.5
toggle format

[8]ページ先頭

©2009-2025 Movatter.jp