TypeError: int argument required

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Mon Jun 15 20:57:31 EDT 2009


In message <mailman.1582.1245063756.8015.python-list at python.org>, Rhodri 
James wrote:

> On Mon, 15 Jun 2009 01:33:50 +0100, Lawrence D'Oliveiro
> <ldo at geek-central.gen.new_zealand> wrote:
> 
>> Perl allows just about any printable character as a quote. I tried
>> alternative quotes for many years, and decided making that choice was a
>> waste of brain cells.
>>
>> So no, using alternative quotes does not make things more readable.
> 
> I find it odd that you consider qquoting less scalable than backslashes.

Backslashes are scalable because they can be nested to any depth, without 
having to decide beforehand which quotes to use at which level. And yes, I 
do write things like this:

out.write \
  (
    "function JSString(Str)\n"
    # /* returns a JavaScript string literal that evaluates to Str. */
    "  {\n"
    "    var Result = \"\\\"\"\n"
    "    for (var i = 0; i < Str.length; ++i)\n"
    "      {\n"
    "        var ThisCh = Str.charAt(i)\n"
    "        if (ThisCh == \"\\\\\")\n"
    "          {\n"
    "            ThisCh = \"\\\\\\\\\"\n"
    "          }\n"
    "        else if (ThisCh == \"\\\"\")\n"
    "          {\n"
    "            ThisCh = \"\\\\\\\"\"\n"
    "          }\n"
    "        else if (ThisCh == \"\\t\")\n"
    "          {\n"
    "            ThisCh = \"\\\\t\"\n"
    "          }\n"
    "        else if (ThisCh == \"\\n\")\n"
    "          {\n"
    "            ThisCh = \"\\\\n\"\n"
    "          } /*if*/\n"
    "        Result += ThisCh\n"
    "      } /*for*/\n"
    "    return Result + \"\\\"\"\n"
    "} /*JSString*/\n"
  )

> I also find it odd that you dislike two visuals stutters (at the start
> and end of string) so much that you'll put up with a dozen visual
> stutters in the string to avoid them.  Particular since my years of
> Perl-bashing lead me to the opposite conclusion.

I find it odd you should think so.




More information about the Python-list mailing list