[Tutor] Fwd: Difference between types

Citizen Kant citizenkant at gmail.com
Fri May 24 18:52:59 CEST 2013


When I say "coding", anyone can think about what coding is
in his own daily work, but that's not my way.
I'll try to refine the concept: right now I'm learning,
if I say "coding" I refer to what I type inside
my file named learningpythoncode.py that,
believe it or not, starts with:

# """After the hash can go my comment.
That's the first thing I've learned, and it's useful since
this way I don't feel like as don't knowing any language
at all. This is part of the code that Python doesn't
compute, but this isn't less code.

Since I am using the triple quotation, I can continue:
On the left side of the hash will go some code, not like
this one, but one that Python can in fact compute.
It seems useful to know first what am I trying to accomplish,
so first I must find out what does Python is expecting from me.
I understand that Python works with values,
so on the left side of the hash, whatever one codes, must be VALUE.

Writing code that Python can compute depends entire on:
VALUE having a somehow useful definition.
This definition will help me to look at my own code, recognize
the value in it (correctness), and let me know that I'm doing well.
I can always rely on Python spiting an error message but I
prefer the understanding way.

I think I've found a definition for value and it seems to say
that is a *normal form* or element of the system which cannot be
reduced by rewriting any further."""

9 # """ Is my first attempt on the left side of the hash. 9 is a value
since it cannot be reduced by rewriting any further.
Same goes for the other integers 0 1 2 3 4 5 6 7 8.
They are values since they cannot be reduced by rewriting any further.
Then I consider to code another value, like A, that looks like if
cannot be reduced by rewriting any further but I arrived
to the fact that Python doesn't consider those characters like A
as able to take part in its computations until I put them between
apostrophes or quotation marks."""

'A' # """ I put A between apostrophes and it suddenly turned to something
that cannot be reduced by rewriting any further,
or unless that seems to me.
I thought: if one can turn to value anything by putting it between
apostrophes or quotation marks, then the trick must be in the
pair of apostrophes or quotation marks.

That's how I came to the conclusion that the pair of apostrophes
are, in fact, the value, and that Python treats that kind of delimiter
"" as a value, no matter what one puts inside it.

Seems like if 0 1 2 3 4 5 6 7 8 9 were values which cannot be
reduced by rewriting any further.

And that "" was another type of value since cannot be
reduced by rewriting any further

This [] is value since cannot be reduced by rewriting any further.

This {} is value since cannot be reduced by rewriting any further.

This """"""  is another value is value since cannot be reduced
by rewriting any further.

Then seem that those customized and customizable
delimited values were like a bunch of new numbers with
a void that one can fill if necessary.

Then seems that there are some other cases of value
that doesn't match with those above.

Cases like my_variable (not int, nor str) maybe values
only if they are assigned to one of the above values,
or assigned to a name that was previously assigned
to one of the above values.

Then True and False as bool, are somehow names that are
assigned to a value like the ones above.

Then any other Python keyword, (def for example) comes to be a
built-in value since it's (so to speak) built-in
assigned to one of the above values, or assigned to a name
that was previously assigned to one of the above values.

This way, everything one can code in Python remains
value and Python doesn't spit its error messages.

Then remains the fact that I have + - * / and other values that "act" as
operators.
According to Python they don't have a defined type, since if I type

type(+)

leads to an error."""

Is it possible to draw a line like this (that goes all along Python)
and grasp at least "one complete aspect" of the language?



2013/5/24 Steven D'Aprano <steve at pearwood.info>

> Citizen Kant,
>
> will you please fix your email quoting? As it is, you are plagiarizing me,
> by quoting me word for word without attribution or any hint that you are
> quoting me.
>
> Do you notice that everyone else quotes people by name, and prefixes their
> words with > quote marks? This is the normal standard on email. If you are
> using something that breaks that standard (possibly Gmail?) and cannot set
> it to follow the normal rules for quoting, then you are going to frustrate
> and annoy people, possibly to the point that they banish your emails to the
> "kill-file" and stop answering your questions. Harsh, but a fact of life.
>
> If you ask, I'm sure people who know more about Gmail will help you fix
> your settings.
>
> Thanks,
>
>
>
>
> --
> Steven
>
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130524/d451a663/attachment-0001.html>


More information about the Tutor mailing list