Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Seeking Best Practices - does your company follow a standard?

by meraxes (Friar)
on May 05, 2010 at 04:24 UTC ( [id://838444]=note: print w/replies, xml ) Need Help??


in reply to Re: Seeking Best Practices - does your company follow a standard?
in thread Seeking Best Practices - does your company follow a standard?

Some yes, some no. But mostly the selling point for Python is that there is a standard (PEP 8) and everyone (seems to) use it and it's easy to know what modules to use because Python comes batteries included.

Directly answering your questions: Python is growing a testing culture from what I've seen and the Python guys at my work are good with writing tests. Don't know much about the actual infrastructure though. My Python-Fu is in its infancy for the most part. Python really doesn't need a perltidy since their rules are mostly enforced by the significant leading whitespace.

Python doesn't have a Perl::Critic kinda thing that I'm aware of but we're not using that at work (yet) so it's a non-issue. Besides which, running Perl::Critic on old code is going to dishearten folk, not make them happier. It'd make me happier. That being said, the lack of use strict I see as a really bad thing not to have. One Pythonista told me today that it's a non-issue for him because he writes his code in Netbeans which highlights such things.

In the end, it's PEP 8 and the "clean syntax" that's winning hearts and minds.

--
meraxes
  • Comment on Re^2: Seeking Best Practices - does your company follow a standard?
  • Download Code

Replies are listed 'Best First'.
Re^3: Seeking Best Practices - does your company follow a standard?
by GrandFather (Saint) on May 05, 2010 at 05:27 UTC

    I've just had a read through PEP 8 and about 85% of it applies just as well to Perl (and many other languages) as it does to Python. Adopting PEP 8 with appropriate adjustments for Perl may be all that's required especially as then essentially the same coding standard can be used across languages (although that may not be what you want to hear).

    True laziness is hard work
Re^3: Seeking Best Practices - does your company follow a standard?
by Herkum (Parson) on May 05, 2010 at 19:23 UTC

    Besides which, running Perl::Critic on old code is going to dishearten folk, not make them happier

    Take a look at Test::Perl::Critic::Progressive. It addresses the issue with having to maintain legacy code without it having to fail critic policies. Of course if someone goes in and starts changing that code the test will look at it and fail it if the new code does not support current coding standards.

    It is a good bridge between legacy and new code.

Re^3: Seeking Best Practices - does your company follow a standard?
by cdarke (Prior) on May 08, 2010 at 20:05 UTC
    everyone (seems to) use it

    I beg to differ. It was mentioned at a Python conference I went to last year and hardly anyone had heard of it, let alone actually used it. Don't believe all the hype.

    "The Zen of Python" (import this) is often quoted. The line "There should be one-- and preferably only one --obvious way to do it." (obviously a stab at Perl) is broken so often in Python 2.6 and 3.1 that it is getting to be a TMTOWTDI language. The "cleaness" is an illusion, is using triple quotes clean? Perl is honest about using sigils, but Python uses them as well, leading underscores mean different things, depending on how many and where they are in the variable name. It uses @ as a decorator sigil - different to Perl's use and Ruby's use. Of course without mandatory sigils you cannot have interpolation, so Python does not have that. The lack of curley braces means you cannot define a variable just for a conditional block, and you can't have a case statement. Actually, come to think of it, there is no way to just define a variable (see the requirement for Python 3 function nonlocal and the discussion in PEP 3104). Anyone who thinks the new format syntax is clear and clean has never tried to teach it to novices. Sorry, I'm ranting...

    Superficially Python is a clean language, its just that when you stretch it then it is as dirty as the rest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://838444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found