Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104935 > unrolled thread

Python Advanced Help

Started byLuke Charlton <lcharlton@vldbsolutions.com>
First post2016-03-15 11:35 +0000
Last post2016-03-15 19:27 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Python Advanced Help Luke Charlton <lcharlton@vldbsolutions.com> - 2016-03-15 11:35 +0000
    Re: Python Advanced Help Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-15 19:27 +0100

#104935 — Python Advanced Help

FromLuke Charlton <lcharlton@vldbsolutions.com>
Date2016-03-15 11:35 +0000
SubjectPython Advanced Help
Message-ID<mailman.159.1458042507.12893.python-list@python.org>
Okay, So basically I created a python script around 1 year ago to grab an explain_plan from a Greenplum system (Normal SQL) and change it around and explain each step/section, the thing is, I've came back to the python code and I don't understand anything of what it's doing (the code specifically). The Script does work but I just want to explain each section to myself and understand it a bit more as I've forgot Python. This means putting comments/notes in next to each section to explain it but hidden so it doesn't show up when ran, so using the # commenting out #.


The aim of the script is to make the explain_plan understandable because it comes out all garbled, so i've turned it upside down because thats how you read it, it goes from bottom to top instead of the default top to bottom. I've put step 1/2 in etc... but I want to know in the code what does what and where etc so I can then expand on the explanation of the explain_plan.

Code (Python) - http://pastebin.com/sVhW34fc (This is the one I'm trying to understand)
Before & After of an Explain_Plan in SQL Greenplum - http://pastebin.com/81kNWVcy

What we're aiming for (Teradatas Explain_Plan) - http://pastebin.com/Nm4g12B3


Regards,

Luke Charlton
Technical Consultant

[cid:4BEA1319-4F97-4ED8-96FE-1A3EDF7DEC22]
lcharlton@vldbsolutions.com<mailto:lcharlton@vldbsolutions.com>
Mobile : +44 (0) 773 431 3140

[toc] | [next] | [standalone]


#104950

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-03-15 19:27 +0100
Message-ID<9472462.AbmyeGU04E@PointedEars.de>
In reply to#104935
Luke Charlton wrote:

> Okay, So basically I created a python script around 1 year ago to grab an
> explain_plan from a Greenplum system (Normal SQL) and change it around and
> explain each step/section, the thing is, I've came back to the python code
> and I don't understand anything of what it's doing (the code
> specifically).

OK, so, basically, RTFM and STFW.  Also, you can print($object.__doc__) for 
each $object that you do not understand.

> The Script does work but I just want to explain each section to myself and
> understand it a bit more as I've forgot Python. This means putting
> comments/notes in next to each section to explain it but hidden so it
> doesn't show up when ran, so using the # commenting out #.

It is sufficient for Python single-line comments if the line starts with “#” 
(optionally preceded by whitespace).  Everything else is decoration.
I use leading “##” and “###” to tell documentation comments (other than 
docstrings) from comment lines that disable code (lines starting with “#” 
only) before it is cleaned up.  (WFM.  There might be a PEP about this that 
recommends otherwise.)
 
> […]
> Code (Python) - http://pastebin.com/sVhW34fc (This is the one I'm trying
> to understand) Before & After of an Explain_Plan in SQL Greenplum -
> http://pastebin.com/81kNWVcy
> 
> What we're aiming for (Teradatas Explain_Plan) -
> http://pastebin.com/Nm4g12B3

<http://www.catb.org/esr/faqs/smart-questions.html>

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web