Coding standard: Prefixing variables to indicate datatype

Terry Reedy tjreedy at udel.edu
Mon Jan 20 18:58:26 CET 2003


"Hans Nowak" <wurmy at earthlink.net> wrote in message
news:Z2DW9.1203$Sv3.158990 at newsread1.prod.itd.earthlink.net...
> Terry Reedy wrote:
>
> [join method]
> > And likewise, admitting that it is a bit ugly, at least to some,
> > is no exclusion to thinking that it is very handy to have it
> > directly available, just like its quasi-inverse, .split(),
> > and with the same syntax.
>
> If the join operation is done by calling a method on the separator,
I would
> expect the same on the split operation:
>
>    " ".split("a b c")
>    # should yield ["a", "b", "c"]
>
> ...but for some reason, that didn't make it into the design. ;-)

When I wrote the above, I though about that possibility, but having
written enough for one day, refrained from opening a new can of worms.
The problem is that 'whitespace', the most commonly desired separator
(tho never a joiner - which is why I said 'quasi-'), is a concept or
pattern, rather than a specific string (much like 'iterable' is not a
specific type).  Aside from this, I would prefer that join and split
be more inverse-like, so the s == sep.join(sep.split(s)).  But of
course, sep.split(sep.join(seq)) could not equal seq in type unles seq
were a list to start with.

Terry J. Reedy






More information about the Python-list mailing list