[Tutor] understanding pydoc try

John Maclean jayeola at gmail.com
Thu Aug 30 18:21:44 CEST 2012


On 08/30/2012 05:15 PM, Alan Gauld wrote:
> On 30/08/12 15:43, John Maclean wrote:
>
>> Thanks. This is a heck of a lot more clearer to me! BNF, huh? Another
>> set TLA that I don't need to know ;-)
>
> Actually, BNF is one of those useful skills for any programmer because 
> almost every language is 'formally' described using it - at least 
> since the days of Algol, for which it was invented.
>
> A simplified version of it is also used to define most command line 
> tools and their arguments so its definitely worth learning, at least 
> the basics. It can save a lot of typing when you want to precisely 
> specify the allowed grammar in a problem.
>
> There are tools which can translate BNF like text into something close 
> to code, which is useful if you ever have to define your own 
> programming language. Admittedly not something most programmers ever 
> need to do, but it does happen occasionally that its the easiest way 
> to solve a problem. (The so-called mini-language design pattern)
>
>

My main issue is that I am a sysadmin and not a programmer. I am aware 
of pydoc but not of BNF. So I was a bit taken aback when I saw the BNF 
syntax. It was obvious to me that syntax of the try statements were not 
python syntax but had no clue how to parse it. BTW - where in pydoc is 
it mentioned, (or anywhere else for that matter), to refer to BNF?






More information about the Tutor mailing list