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

98 comments:

  1. I have read your blog. It’s very informative and your useful blog. You have done really great job. Keep update your blog.
    Cloud Computing Training Institute in Chennai | Cloud Computing Training Institute in Keelkattalai

    ReplyDelete
  2. Very informative and interesting blog, it was so good to read and useful to improve my knowledge as updated one,keep updating..This Concepts is very nice Thanks for sharing.
    ISTQB Certification in Chennai | ISTQB Exam Centers in Chennai | Best ISTQB Exams in Velachery

    ReplyDelete
  3. Very informative and interesting blog, it was so good to read and useful to improve my knowledge as updated one,keep updating..This Concepts is very nice Thanks for sharing.
    ISTQB Certification in Chennai | ISTQB Exam Centers in Chennai | Best ISTQB Exams in Velachery

    ReplyDelete
  4. 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.
    Java Training Institute in Chennai | Java Training in Velachery | Java Training in OMR | Java Course in Taramani | Java Training in Madipakkam | Java Training in Keelkattalai

    ReplyDelete

  5. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Linux Training in Chennai | Linux Training in OMR

    ReplyDelete
  6. It is really very awesome and wonderful to visit your site.Thanks for sharing your informative blog with us.keep updating such a wonderful post..
    MicroSoft Azure Certification in Chennai | Azure Exam Centers in Velachery | Azure Exam Centers in Madipakkam

    ReplyDelete
  7. It is really very awesome and wonderful to visit your site.Thanks for sharing your informative blog with us.keep updating such a wonderful post..
    MicroSoft Azure Certification in Chennai | Azure Exam Centers in Velachery | Azure Exam Centers in Madipakkam

    ReplyDelete
  8. Your Blog is really amazing with useful and helpful content for us.Thanks for sharing.keep updating more information.
    Embedded System Training Institute in Chennai | Embedded Training in Velachery | Embedded System Training in Guindy

    ReplyDelete
  9. Your Blog is really amazing with useful and helpful content for us.Thanks for sharing.keep updating more information.
    Embedded System Training Institute in Chennai | Embedded Training in Velachery | Embedded System Training in Guindy

    ReplyDelete
  10. I have read your blog it’s very attractive and impressive. I like it your blog...Thanks for posting this useful content, Good to know about new things here, Keep updating your blog...
    Selenium Training Institute in Chennai | Selenium Training in Velachery | Selenium Training in Adyar | Selenium Training in Keelkattalai | Selenium Training in Guindy

    ReplyDelete
  11. 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 Training Institute in Chennai | Blue Prism Training in Perungudi | Blue Prism Training in Pallavaram | Blue Prism Training in Chrompet

    ReplyDelete
  12. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    Embedded Systems Training in Chennai | Embedded Systems Training in Taramani | Embedded Systems Training in Keelkattalai

    ReplyDelete


  13. Good Blog....Thanks for sharing your informative and amazing blog with us,its very helpful for everyone..
    Cloud Computing Training in Chennai | Cloud Computing Training in Guindy | Cloud Computing Training in Adyar

    ReplyDelete
  14. Really it was an awesome article. Very useful & Informative..Thanks for sharing..Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge. Good info..Kindly post more updates regarding this topics...
    Python Training in Chennai | Python Training in Velachery | Python Training in OMR

    ReplyDelete
  15. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog...
    Java Training institute in Chennai | Java Certification Training Center in Velachery | Java Training in Pallikaranai

    ReplyDelete
  16. Very informative blog. Thanks for sharing such good information and keep on updating.This is a nice post in an interesting line of content.Thanks for sharing this article.
    VMware Training in Chennai | VMware Training in Velachery | VMware Training in Pallikaranai

    ReplyDelete
  17. Nice blog.. Thanks for sharing informative blog.. its very useful to me.Thanks its Great Article... I love to read your articles because your writing style is too good, its is very very helpful for all of us.
    Java Training in Chennai | Java Training in Velachery | Java Training in Madipakkam

    ReplyDelete

  18. 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 Institute in Chennai | Cloud Computing Training in Keelkattalai

    ReplyDelete
  19. Very interesting content which helps me to get the in depth knowledge about the technology.
    Android Training in Chennai | Android Training in Velachery | Android Training in Tambaram

    ReplyDelete
  20. 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.
    Java Training in Chennai | Java Training in Velachery | Java Training in Tambaram

    ReplyDelete
  21. This is really too useful and have more ideas from yours. keep sharing many techniques and thanks for sharing the information.
    Microsoft Azure Training in ChennaiMicrosoft Azure Training in VelacheryMicrosoft Azure Training in Taramani

    ReplyDelete
  22. Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
    Linux Training Institute in Chennai | Linux Certification Training in Velachery

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

    ReplyDelete
  24. 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 Training in Chennai | Web Designing Training in Velachery | Web Designing Training in Taramani | Web Designing Training in OMR

    ReplyDelete
  25. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Python Training in Chennai|Python Training in Chennai|Python Training in Chennai

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

    ReplyDelete
  27. 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...
    Java Training Institute in Chennai | Java Training in Velachery | Java Training in Guindy

    ReplyDelete
  28. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it…
    Web Design Training Institute in Chennai | Web Design Training Institute in Guindy

    ReplyDelete
  29. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    Tally Training in Chennai | Tally Training in Velachery | Selenium Training in Guindy

    ReplyDelete
  30. I have read your blog its very attractive and impressive. I like it your blog.Your blog is really amazing with smart and cute content.keep updating such an excellent article..
    Embedded System Training in Chennai | Embedded System Training in Velachery | Embedded System Training in Tambaram

    ReplyDelete
  31. 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.
    Python Training in Chennai | Python Training in Velachery | Python Training in Pallikaranai

    ReplyDelete

  32. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Selenium Training in Chennai | Selenium Training in Taramani

    ReplyDelete
  33. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Selenium Training Institute in Chennai | Selenium Training in Velachery | Selenium Training in Taramani

    ReplyDelete
  34. 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 Training in Chennai | Blue Prism Exam Center in Chennai | Blue Prism Training in Medavakkam | Blue Prism Exams in Chennai

    ReplyDelete
  35. Thanks for posting this useful content, Good to know about new things here,Keep updating your blog...
    Web Design training in Chennai| Web Design training in Velachery| Web Design training in medavakkam.

    ReplyDelete
  36. Excellent Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    Java Training Institute in Chennai | Java Certification Training in Velachery

    ReplyDelete
  37. 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 in Velachery | Java Training in Taramani

    ReplyDelete
  38. 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.
    Python Training in Chennai | Python Training in Velachery | Python Training in Adyar

    ReplyDelete
  39. very interesting topic.Helps to gain knowledge about lot of information. Thanks for posting information in this blog.
    Java Training in Chennai | Java Training in Velachery | Java Training in Perungudi

    ReplyDelete
  40. Thanks for sharing your wonderful information..Its really impressive and informative content..
    AWS Certification Training in Chennai | AWS Training Institute in Chennai | AWS Exam Center in Velachery

    ReplyDelete
  41. Thanks for sharing your wonderful information..Its really impressive and informative content..
    AWS Certification Training in Chennai | AWS Training Institute in Chennai | AWS Exam Center in Velachery

    ReplyDelete
  42. very interesting topic.Helps to gain knowledge about lot of information. Thanks for posting information in this blog.
    Python Training in Chennai | Python Training in Velachery | Python Training in Pallavaram

    ReplyDelete
  43. Excellent information with unique content and it is very useful to know about the information based on blogs...
    Dotnet Training in Chennai | Dotnet Training in Velachery | Dotnet Training in Pallavaram

    ReplyDelete
  44. This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
    Hardware & Networking Training in Chennai | Hardware & Networking Training in Velachery | Hardware & Networking Training in OMR

    ReplyDelete
  45. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    Cloud Computing Training in Chennai | Cloud Computing Training in Velachery | Cloud Computing Training in OMR

    ReplyDelete
  46. Excellent Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    Embedded System Training in Chennai | Embedded Training in Velachery | Embedded Courses in Pallikaranai

    ReplyDelete
  47. Excellent Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    Embedded System Training in Chennai | Embedded Training in Velachery | Embedded Courses in Pallikaranai

    ReplyDelete
  48. 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 Robotic Automation in Chennai | Blue Prism Robotic Automation in Velachery | Blue Prism Robotic Automation in Pallikaranai

    ReplyDelete
  49. Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
    PCB Training in Velachery | PCB Training in Pallikaranai .

    ReplyDelete
  50. This is useful post for me. I learn lot of new information from your article. keep sharing. thank you for share us.
    MCSE Training Institute in Chennai | MCSE Training in Velachery | MCSE Training Center in Chrompet

    ReplyDelete
  51. This is useful post for me. I learn lot of new information from your article. keep sharing. thank you for share us.
    MCSE Training Institute in Chennai | MCSE Training in Velachery | MCSE Training Center in Chrompet

    ReplyDelete
  52. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
    Embeded training in Chennai|Embeded training in Velachery|Embeded training in chromepet

    ReplyDelete
  53. Thanks for giving nice information from your blog...It's really an amazing post..
    Selenium Training Institute in Chennai | Selenium Training Center in Velachery

    ReplyDelete
  54. Thanks for giving nice information from your blog...It's really an amazing post..
    Selenium Training Institute in Chennai | Selenium Training Center in Velachery

    ReplyDelete