Hi ,

I observe the code compiles with four spaces after a "if" or "for "  , but
it fails to compile if by mistake we give a "tab"(equivalent to four
spaces). I am able to work fine , my code compiles fine.


Do suggest any other tips for indentation.


Regards

On Tue, Aug 18, 2009 at 5:12 PM, Sangram Bakshi <san...@gmail.com> wrote:

> Hi ,
>
> I was coding python in staf stax job.  I follow  basic python indentation.
>
>
> For e.g:
>
>   nodeList = document.getElementsByTagName("machine_name")
>   x = nodeList.getLength()
>   if nodeList.getLength():
>       nodeList = document.getElementsByTagName("machine_name")
>       for i in range(nodeList.getLength()):
>           node = nodeList.item(i)
>
> I give four spaces after a if or for .
>
> The code compiles sometimes , it does'nt compiles sometimes if i disturb it
> it a little bit and gain maintain the space indentation.
>
> Any simple rule to follow while coding to keep proper indentation.
>
> I feel the env is very sensitive.
>
>
> For e.g:
>
> <script>
>      machname = []
>      vmware_value = []
>      vmware_attr = []
>      sangram = 'None'
>
>      nodeList = document.getElementsByTagName("machine_name")
>      x = nodeList.getLength()
>      if nodeList.getLength():
>          nodeList = document.getElementsByTagName("machine_name")
>          for i in range(nodeList.getLength()):
>              node = nodeList.item(i)
>              if node.getNodeType() == Node.ELEMENT_NODE:
>                  children = node.getChildNodes()
>                  for j in range(children.getLength()):
>                      thisChild = children.item(j)
>                      if (thisChild.getNodeType() == Node.TEXT_NODE):
>                          machname.append( thisChild.getNodeValue())
>
> Till yellow highlighted it compiles fine : after that the following does
> not compiles.
>
>      nodeList = document.getElementsByTagName("vmware")
>      if nodeList.getLength():
>          nodeList = document.getElementsByTagName("vmware")
>   #for i in range(nodeList.getLength()):
>       #node = nodeList.item(i)
>          #  id = ""
>           # attrList = node.getAttributes()
>            #for k in range(attrList.getLength()):
>          #   thisAttr = attrList.item(k)
>           #  if thisAttr.getNodeName() == "id":
>         #     id = thisAttr.getNodeValue()
>          #    vmware_attr.append(id)
>           #if node.getNodeType() == Node.ELEMENT_NODE:
>           # children = node.getChildNodes()
>            #for j in range(children.getLength()):
>           #  thisChild = children.item(j)
>            # if (thisChild.getNodeType() == Node.TEXT_NODE):
>          #    vmware_value.append(thisChild.getNodeValue())
>
>   </script>
>
> Kinldy suggest a easy technique to follow indentation.
>
>
> Regards
> Sangram
>
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to