Converting a string to the most probable type

castironpi at gmail.com castironpi at gmail.com
Mon Mar 17 02:22:08 CET 2008


> > > The trick in the case of when you do not want to guess, or the choices
> > > grow too much, is to ask the user to tell you in what format they want
> > > it and format according to their wishes.
>
> > > Neatly avoids too much guessing and isn't much extra to add.
>
> > The plot is about understanding input, not formatting output.
>
> And what he meant is simply to make an agreement with the user on how
> he/she would format his/her input and to disallow input from formats
> that haven't been agreed to avoid guessing. That is the cleanest and
> most polite solution, although I'd suspect it would be considered less
> user friendly by regular user although power user would be most happy
> with that.

This one comes from signal theory, actually.  With no information
about the signal's transmitter, there's no way to guess what language/
customs/manners/convention/protocol he's using.  That is, for every
protocol, there exists a second protocol which mimics it for the first
n bits with a different meaning.

There's the Gettysburg Compression Method which transmits a '1' to
send the Gettysburg Address, and prepends a 0 to every other message.

Of course, there is already an agreed convention.  You can tell if you
speak a stranger's language once you start interacting-- that is,
enter a verbal context with him.  There aren't any two -existing-
languages which overlap for long at all.  'Can you buy me beer?' does
not mean anything in anything but English-- it's gibberish in every
other.

When it comes to computers, the bandwidth and context mass might be so
tiny so far that there's much ambiguity.  "Is 11/30 a fraction, a
month, or a date?"  -"Fraction."  "Please proceed."

Outside of those two factors, there is not much difference between
"natural" and formal systems.

Bandwidth is easy enough to increase-- just add a camera, a mic,
chemovoltaic, tactilevoltaic, or some specialization of one.  Context
is the hard thing to grow.

"Or, is there another protocol I can look up?"
-"Yeah, I know the bartender."
"Your statement changed context-determined probabilities.  Your own
context has been forked."
"Your statements have suggested that you have adopted a new convention
which I recognize.  Is APR 03 a month or a finance model?  (You nor
the convention neither use statements with the form Apr 03 to mean
days.)"
-"*plonk*"
"You seem to maintain that there are no other users and/or that you
have unlimited property right."
-"*crowbar*"
"This action will void the warranty.  Continue?"
-"*incendiaries*"
"We're just glad you're not organize enough to boycott."
-"*boycotts*"
"Your usage of that term is inconsistent.  Please purchase higher
bandwidth."
-"*speechless*"
"What are you doing, Dave?"
-"I won't stand for this."
"What are you saying?"



More information about the Python-list mailing list