Re: Tabs As Syntax

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: Tabs As Syntax
De : nospam (at) *nospam* dfs.com (DFS)
Groupes : comp.os.linux.advocacy
Date : 26. Mar 2024, 16:39:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <utumm9$1s41o$2@dont-email.me>
References : 1 2 3
User-Agent : Betterbird (Windows)
On 3/20/2024 7:53 PM, Lawrence D'Oliveiro wrote:

Python does away with that redundancy, by making the indentation serve
as statement-bracketing as well. I think this is a mistake. However, I
restore the redundancy by adding “#end” lines (which the compiler
ignores). E.g.
      def parse_headers() :
         nonlocal content_type, content_type_opts
         for keyword, value in scope["headers"] :
             keyword = keyword.decode().lower()
             if keyword == "content-type" :
                 content_type = value.decode()
             elif keyword == "cookie" :
                 for item in value.decode().split(";") :
                     name, val = item.strip().replace(" ", "").split("=", 1)
                     cookies[name] = val
                 #end for
             #end if
         #end for
         if content_type != None :
             content_type, content_type_opts = \
                 multipart.multipart.parse_options_header(content_type)
             content_type = content_type.decode()
             content_type_opts = dict((k.decode(), v) for k, v in content_type_opts.items())
         #end if
     #end parse_headers
Let me fix that back for you:
  def parse_headers() :
         nonlocal content_type, content_type_opts
         for keyword, value in scope["headers"] :
             keyword = keyword.decode().lower()
             if keyword == "content-type" :
                 content_type = value.decode()
             elif keyword == "cookie" :
                 for item in value.decode().split(";") :
                     name, val = item.strip().replace(" ", "").split("=", 1)
                     cookies[name] = val
         if content_type != None :
             content_type, content_type_opts = \
                 multipart.multipart.parse_options_header(content_type)
             content_type = content_type.decode()
             content_type_opts = dict((k.decode(), v) for k, v in content_type_opts.items())
much better

Date Sujet#  Auteur
20 Mar 24 * Tabs As Syntax51Nuxxie
20 Mar 24 +* Re: Tabs As Syntax48Chris Ahlstrom
20 Mar 24 i+* Re: Tabs As Syntax32DFS
20 Mar 24 ii+* Re: The more spastic the code, the greater the whitespace & comments.2DFS
20 Mar 24 iii`- Best Practice.1Relf
21 Mar 24 ii+- Re: Tabs As Syntax1Lawrence D'Oliveiro
21 Mar 24 ii`* Re: Tabs As Syntax28rbowman
21 Mar 24 ii +* Re: Tabs As Syntax3Lawrence D'Oliveiro
22 Mar 24 ii i`* Re: Tabs As Syntax2rbowman
22 Mar 24 ii i `- Re: Tabs As Syntax1Lawrence D'Oliveiro
21 Mar 24 ii +* Re: Tabs As Syntax7DFS
22 Mar 24 ii i`* Re: Tabs As Syntax6rbowman
22 Mar 24 ii i +- Re: Tabs As Syntax1Lawrence D'Oliveiro
22 Mar 24 ii i +* Re: Tabs As Syntax3candycanearter07
22 Mar 24 ii i i`* Re: Tabs As Syntax2Chris Ahlstrom
23 Mar 24 ii i i `- Re: Tabs As Syntax1rbowman
22 Mar 24 ii i `- Re: Tabs As Syntax1DFS
21 Mar 24 ii `* Re: Tabs As Syntax17Chris Ahlstrom
22 Mar 24 ii  +* Re: Tabs As Syntax14rbowman
22 Mar 24 ii  i+* Re: Tabs As Syntax11Chris Ahlstrom
22 Mar 24 ii  ii+* Re: Tabs As Syntax2candycanearter07
22 Mar 24 ii  iii`- Re: Tabs As Syntax1Chris Ahlstrom
23 Mar 24 ii  ii`* Re: Tabs As Syntax8Lawrence D'Oliveiro
23 Mar 24 ii  ii `* Re: Tabs As Syntax7Chris Ahlstrom
23 Mar 24 ii  ii  +* Re: Tabs As Syntax5DFS
23 Mar 24 ii  ii  i+- Re: Tabs As Syntax1rbowman
24 Mar 24 ii  ii  i+- Re: Tabs As Syntax1Lawrence D'Oliveiro
24 Mar 24 ii  ii  i`* Re: Tabs As Syntax2Chris Ahlstrom
24 Mar 24 ii  ii  i `- Re: Tabs As Syntax1Physfitfreak
23 Mar 24 ii  ii  `- Re: Tabs As Syntax1rbowman
27 Mar 24 ii  i`* Re: Tabs As Syntax2DFS
28 Mar 24 ii  i `- Re: Tabs As Syntax1rbowman
22 Mar 24 ii  `* Re: Tabs As Syntax2Lawrence D'Oliveiro
22 Mar 24 ii   `- Re: Tabs As Syntax1Chris Ahlstrom
21 Mar 24 i`* Re: Tabs As Syntax15Lawrence D'Oliveiro
26 Mar 24 i `* Re: Tabs As Syntax14DFS
3 Apr 24 i  `* Re: Tabs As Syntax13Lawrence D'Oliveiro
3 Apr 24 i   `* Re: Tabs As Syntax12DFS
5 Apr 24 i    `* Re: Tabs As Syntax11Lawrence D'Oliveiro
5 Apr 24 i     +* Re: Tabs As Syntax6DFS
5 Apr 24 i     i`* Re: Tabs As Syntax5Lawrence D'Oliveiro
5 Apr 24 i     i `* Re: Tabs As Syntax4DFS
6 Apr 24 i     i  `* Re: Tabs As Syntax3Lawrence D'Oliveiro
6 Apr 24 i     i   `* Re: Tabs As Syntax2DFS
6 Apr 24 i     i    `- Re: Tabs As Syntax1Lawrence D'Oliveiro
5 Apr 24 i     `* Re: Tabs As Syntax4Chris Ahlstrom
5 Apr 24 i      `* Re: Tabs As Syntax3candycanearter07
5 Apr 24 i       `* Re: Tabs As Syntax2Chris Ahlstrom
6 Apr 24 i        `- Re: Tabs As Syntax1candycanearter07
20 Mar 24 +- Re: Tabs As Syntax1DFS
21 Mar 24 `- Re: Tabs As Syntax1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal