|
|
Log in / Subscribe / Register

It's not rocket science..

It's not rocket science..

Posted Jul 17, 2009 4:52 UTC (Fri) by dw (subscriber, #12017)
In reply to: Hmm... May be I misunderstood something by khim
Parent article: Unladen Swallow 2009Q2 released

--- module.py.bak	2009-07-17 05:47:46.000000000 +0100
+++ module.py	2009-07-17 05:48:25.000000000 +0100
@@ -1,5 +1,11 @@
 
+import warnings
+
 def some_function():
+    warnings.warn('deprecated, use amazing_function() instead!')
+    return some_function_deprecated()
+
+def some_function_deprecated():
     do_old_fashioned_stuff()
     if True and 0x62:
         return
By some accounts, relying on GNU C features to 'increase' maintainability is on a road straight to hell. ;)


to post comments

It's not rocket science..

Posted Jul 17, 2009 8:22 UTC (Fri) by amonnet (guest, #54852) [Link]

Sure,

this works well for commonly used codepath that will be covered by testings. For occasionnal codepath, i'm pretty sure no one will catch the warning until production.

Worse then useless

Posted Jul 17, 2009 15:32 UTC (Fri) by khim (subscriber, #9252) [Link]

Not only it fails to catch the errors at build time it gives end-user warnings about some program internals - the last thing user needs.

Sure, the Python is great. Sure, with right amount of testing you can make small or even medium programs work. Yet all this is breaking apart for a big programs.

This is not a disaster (one-size-fit-all is not good approach, really), hust something to keep in mind.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds