Tuesday, February 9, 2016

Undecoratable

Decorators are one of Python's bigger success stories, and many programmers' first experience with higher-order programming. Most practiced and prolific Python programmers will find themselves making good use of them regularly.

But every feature has its limits, and here's a new one to try on for size:

>>> @x().y()
  File "<stdin>", line 1
    @x().y()
        ^
SyntaxError: invalid syntax

That's right, decoration is not an arbitrary Python expression. It doesn't matter what x and y were, or even if they were defined. You can't follow a function call with a dot. @x() works fine, @x.y() would work fine, too. But @x().y(), that's only for mad Pythonists who would take things TOO FAR.

Decorator invocations, defined at the top of the Python grammar, can only be followed by class definitions and function definitions.

Well, now we know, and now we can all say we've been there

-- Mahmoud
http://sedimental.org/
https://github.com/mahmoud
https://twitter.com/mhashemi

97 comments:

  1. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.Any coures related details learn...

    Best AWS Training Institute in Chennai | AWS Training Center in Chennai | AWS Certification Exams in Velachery | AWS Exams in OMR

    ReplyDelete
  2. Thank you for your information. I have got some important suggestions from it. Keep on sharing.Very informative blog. Helps to gain knowledge about new concepts and techniques.
    Linux Training in Velachery | Linux Training Institute in Chennai | Linux Training in Kanchipuram

    ReplyDelete
  3. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    Selenium course in Chennai | Selenium Certification in Chennai | Selenium course in Velachery

    ReplyDelete
  4. Very interesting topic. Helps to gain knowledge about lot of information. Thanks for information in this blog.
    Blue Prism course in Chennai | Blue Prism Certification in Chennai | Blue Prism course in Velachery

    ReplyDelete
  5. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
    Blue Prism Certification in Chennai | Blue Prism Exam Center in Velachery | Blue Prism Online Exam Center in Chennai | Blue Prism Exams in Velachery

    ReplyDelete
  6. This is really too useful and have more ideas from yours. Keep sharing many techniques. Eagerly waiting for your new blog and useful information. Keep doing more.
    Selenium Training Center in Chennai | Selenium Training Center in Velachery | Selenium Training Center in Kanchipuram

    ReplyDelete
  7. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
    Blue Prism Exam Center in Chennai | Blue Prism Exam Center in Velachery | Blue Prism Exam Center in Kanchipuram

    ReplyDelete
  8. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.Any coures related details learn...
    Python Training Institute in Chennai | Python Exam Center in Chennai | Python Certification in Taramani | Python Training in OMR | Python Exams in Velachery

    ReplyDelete
  9. Great post and informative blog. It was awesome to read, thanks for sharing this great content to my vision.
    Blue Prism Training in Chennai | Blue Prism Training Center in Velachery | Blue Prism Course in Chennai

    ReplyDelete
  10. Thanks for sharing information to our knowledge, it helps me plenty keep sharing….I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

    Linux Training in Velachery | Linux Training Institute in Chennai | Linux Training in Kanchipuram

    ReplyDelete
  11. All the points you described so beautiful. Every time i read your blog content and i so surprised that how you can write so well.
    Blue Prism Training in Velachery | Blue Prism Certification in Velachery | Blue Prism Exam Center in Chennai

    ReplyDelete
  12. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Selenium Certification in Chennai | Selenium Training Center in Velachery | Selenium course in Kanchipuram

    ReplyDelete
  13. Your blog is very informative with useful information, thanks a lot for sharing such a wonderful article, its very useful for me. Keep updating your creative knowledge....
    Blue Prism Training in Chennai | Blue Prism Certification in Chennai | Blue Prism Exam Center in Chennai

    ReplyDelete
  14. Your Blog is really awesome with useful and helpful content for us. Thanks for sharing…keep updating more information.
    Selenium Exam Center in Chennai | Selenium Exam Center in Velachery | Selenium Exam Center in Kanchipuram

    ReplyDelete
  15. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
    Python Training Institute in Chennai | Python Exam Center in Chennai | Python Certification in Taramani | Python Training in OMR | Python Exams in Velachery

    ReplyDelete
  16. This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
    Blue Prism Exam Center in Chennai | Blue Prism Certification in Taramani | Blue Prism Online Exam in Velachery | Blue Prism Certification in Medavakkam

    ReplyDelete
  17. This is a great inspiring article.I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post..

    Linux Training in Velachery | Linux Training Institute in Chennai | Linux Training in Kanchipuram

    ReplyDelete
  18. All the points you described so beautiful. Every time i read your blog content and i so surprised that how you can write so well.
    Blue prism Certification Centers in Taramani | Blue prism Exams in Chennai | Blue prism Certification Training in Guindy | Blue prism Training in Adyar

    ReplyDelete
  19. This blog very easily understandable. Thanks for sharing such an informative post with us. This is a nice post in an interesting line of content.
    Selenium Training Center in Chennai | Selenium Exam Center in Velachery | Selenium Online Exam in Taramani | Selenium Certification in Kanchipuram

    ReplyDelete
  20. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Blue Prism Exam Center in Chennai | Blue Prism Training in Taramani | Blue Prism Online Exam in Chennai | Blue Prism Certification in Kanchipuram

    ReplyDelete
  21. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post..
    AWS Training Institute in Chennai | AWS Training Center in Velachery | AWS Exams Center in Chennai | AWS Online Exams in Chennai

    ReplyDelete
  22. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
    Selenium Testing Course in Chennai | Selenium Testing Course in Velachery | Selenium Automation course in Chennai | Selenium Center in Velachery | Selenium Certification Center in Velachery

    ReplyDelete
  23. Thanks for sharing information to our knowledge, it helps me plenty keep sharing….I am pretty much pleased with your good work. You put really amazing and very helpful information...
    Best JAVA Training Institute in Chennai | JAVA Training in Velachery | JAVA Training in Kanchipuram

    ReplyDelete
  24. This is really too useful and have more ideas from yours. Keep sharing many techniques. Eagerly waiting for your new blog and useful information. Keep doing more.
    Selenium Training Institute in Chennai | Selenium Training Center in Velachery | Selenium Certification in Kanchipuram

    ReplyDelete
  25. Very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information in this blog..

    Python Training Institute in Chennai | Python Exam Center in Chennai | Python Certification in Taramani | Python Training in OMR | Python Exams in Velachery

    ReplyDelete
  26. Excellent information with unique content and it is very useful to know about the information based on blogs.
    Selenium Certification in Chennai | Selenium Exam Center in Chennai | Selenium Training in Velachery

    ReplyDelete
  27. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Blue Prism Training in Chennai | Blue Prism Exam Center in Velachery | Blue Prism Certification in Chennai

    ReplyDelete
  28. This blog very easily understandable. Thanks for sharing such an informative post with us. This is a nice post in an interesting line of content.
    Selenium Training Center in Chennai | Selenium Training Center in Velachery | Selenium Training in Kanchipuram

    ReplyDelete
  29. It's very great post... Really you are... done a wonderful job Keep up the good work and continue sharing like this.
    Blue Prism Training in Chennai | Blue Prism Training Center in Velachery | Blue Prism Exams in Chennai

    ReplyDelete
  30. Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
    Blue Prism Training Institute in Chennai | Blue Prism Online Exam in Chennai | Blue Prism Certification in Velachery

    ReplyDelete
  31. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    Blue Prism Training in Chennai | Blue Prism Training in Taramani | Blue Prism Training in Velachery

    ReplyDelete
  32. This is really too useful and have more ideas from yours. keep sharing many techniques and thanks for sharing the information.
    Blue Prism Training in Chennai | Blue Prism Certification in Medavakkam | Blue Prism Training Center in Velachery

    ReplyDelete
  33. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Selenium Training Institute in Chennai | Selenium Certification in Pallikaranai | Selenium Course in Velachery | Selenium Training Center in Medavakkam

    ReplyDelete
  34. This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
    Android Training in Chennai | Android Training Center in Velachery | Android Training Institute in Pallikaranai

    ReplyDelete
  35. I have read your blog. Good and more information useful for me, Thanks for sharing this information keep it up.....
    Blue Prism Training Center in Chennai | Blue Prism Training in OMR | Blue Prism Exams in Taramani

    ReplyDelete
  36. This is really too useful and have more ideas from yours. Keep sharing many techniques. Eagerly waiting for your new blog and useful information. Keep doing more.
    Selenium Training Center in Chennai | Selenium Training Center in Velachery | Selenium Training Center in Taramani | Selenium Training Center in Madipakkam | Selenium Training Center in Pallikaranai

    ReplyDelete
  37. Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
    Android Training Institute in Chennai | Android Training Institute in Velachery | Android Training Center in Taramani

    ReplyDelete
  38. Great post and informative blog. It was awesome to read, thanks for sharing this great content to my vision.
    Selenium Training Center in Chennai | Selenium Training Center in Velachery | Selenium Training Center in Kanchipuram

    ReplyDelete
  39. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Android Training Institute in Chennai | Android Training Institute in Velachery | Android Training Institute in Kanchipuram

    ReplyDelete
  40. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Java Training Institute in Chennai | Java Training Center in Velachery | Java Training in Kanchipuram

    ReplyDelete
  41. Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
    Selenium Training Center in Chennai | Selenium Training in Velachery | Selenium Exam Center in Chennai

    ReplyDelete
  42. Your blog is very informative with useful information, thanks a lot for sharing such a wonderful article it’s very useful for me. Keep updating your creative knowledge....

    Summer Camp for Kids in Chennai
    |
    Summer Camp for Kids in Velachery
    |
    Summer Course in Taramani

    ReplyDelete
  43. Very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information in this blog

    Summer Camp in Chennai | Summer Camp Training in Velachery

    ReplyDelete
  44. Good Blog....Thanks for sharing your informative and amazing blog with us, it’s very helpful for everyone.
    Summer Course Training in Chennai | Summer Course Training in Velachery | Summer Course Training in Kanchipuram

    ReplyDelete
  45. Really I enjoyed very much. And this may helpful for lot of peoples. So you are provided such a nice and great article within this.
    AWS Certification in Chennai | AWS Certification in Velachery | AWS Training in Taramani | AWS Training in Guindy | AWS Training in Pallikaranai

    ReplyDelete
  46. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    AWS Training Center in Chennai | AWS Certification in Velachery | AWS Training in Nanganallur | AWS Training in Palavanthangal | AWS Training in Medavakkam

    ReplyDelete
  47. Your blog is very informative with useful information, thanks a lot for sharing such a wonderful article, it’s very useful for me. Keep updating your creative knowledge....
    JAVA Course in Chennai | JAVA Course in Velachery | Java Course in Pallikaranai | Java Course in Taramani | Java Course in Madipakkam | Advanced Java Training in Keelkattalai

    ReplyDelete
  48. This is really too useful and have more ideas from yours. Keep sharing many techniques. Eagerly waiting for your new blog and useful information. Keep doing more.
    Python Training in Taramani | Python Training in Guindy | Python Certification Centers in Chennai | Python Training in Pallikaranai | Python Certification Training in Velachery

    ReplyDelete
  49. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
    AWS Certification in Chennai | AWS Training in Tambaram | AWS Training in Meenambakkam | AWS Training in Porur | AWS Exam Center in Velachery

    ReplyDelete
  50. Really very nice blog information for this one and more technical skill is improved, I like that kind of post.
    Python Exam Center in Chennai | Python Exams in Velachery | Python Exam Center in Taramani | Python Certification in Chennai

    ReplyDelete
  51. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    AWS Training in Chennai | AWS Training in Velachery | AWS Certification in Chennai

    ReplyDelete
  52. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Software Testing Training in Chennai | Software Testing Course in Velachery | Software Testing Training in Taramani

    ReplyDelete
  53. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
    Web Designing and Development Training in Chennai | Web Designing Course in Velachery | Web Development Course in Chennai

    ReplyDelete
  54. This is really too useful and have more ideas from yours. Keep sharing many techniques. Eagerly waiting for your new blog and useful information. Keep doing more.
    Cloud Computing Training in Chennai | Cloud Computing Training in Velachery | Cloud Computing Training in Taramani | Cloud Computing Training in Pallikaranai

    ReplyDelete