Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47866 > unrolled thread

Re: A few questiosn about encoding

Started bySteven D'Aprano <steve+comp.lang.python@pearwood.info>
First post2013-06-13 00:13 +0000
Last post2013-06-20 19:08 +0200
Articles 20 on this page of 90 — 31 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 00:13 +0000
    Re: A few questiosn about encoding Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 09:09 +0300
      Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 07:11 +0000
        Re: A few questiosn about encoding Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 10:42 +0300
          Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-13 17:58 +1000
            Re: A few questiosn about encoding Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 11:08 +0300
              Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-13 18:20 +1000
                Re: A few questiosn about encoding Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 12:41 +0300
                  Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-13 11:49 +0000
                    Re: A few questiosn about encoding Νικόλαος Κούρας <support@superhost.gr> - 2013-06-13 17:19 +0300
                      Re: A few questiosn about encoding Cameron Simpson <cs@zip.com.au> - 2013-06-14 11:00 +1000
                        Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 09:59 +0300
                          Re: A few questiosn about encoding Cameron Simpson <cs@zip.com.au> - 2013-06-14 20:14 +1000
                            Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 16:58 +0300
                              Re: A few questiosn about encoding Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-14 11:21 -0400
                                Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 18:26 +0300
                                  Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-15 03:03 +1000
                                    Re: A few questiosn about encoding Walter Hurry <walterhurry@lavabit.com> - 2013-06-14 23:32 +0000
                              Re: A few questiosn about encoding Cameron Simpson <cs@zip.com.au> - 2013-06-15 10:26 +1000
                              Re: A few questiosn about encoding Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 06:34 +0000
                                Re: A few questiosn about encoding Grant Edwards <invalid@invalid.invalid> - 2013-06-15 14:44 +0000
                                  Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-15 17:49 +0300
                                    Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-15 15:30 +0000
                                  Re: A few questiosn about encoding Roy Smith <roy@panix.com> - 2013-06-15 10:59 -0400
                                    Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-15 18:14 +0300
                                      Re: A few questiosn about encoding Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-15 11:35 -0400
                              Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-15 22:26 +0300
                                Re: A few questiosn about encoding Benjamin Schollnick <benjamin@schollnick.net> - 2013-06-15 16:35 -0400
                                Re: A few questiosn about encoding Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-06-16 15:45 +0200
              Re: A few questiosn about encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 09:36 +0200
                Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 10:49 +0300
                  Re: A few questiosn about encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 10:22 +0200
                    Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 11:37 +0300
                      Don't feed the troll... (was: Re: A few questiosn about encoding) Heiko Wundram <modelnine@modelnine.org> - 2013-06-14 11:06 +0200
                        Re: Don't feed the troll... Nick the Gr33k <support@superhost.gr> - 2013-06-14 12:32 +0300
                          Re: Don't feed the troll... Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 13:09 +0200
                            Re: Don't feed the troll... Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:36 +0300
                              Re: Don't feed the troll... Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-14 08:44 -0400
                              Re: Don't feed the troll... Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 15:25 +0200
                                Re: Don't feed the troll... Neil Cerutti <neilc@norwich.edu> - 2013-06-14 15:54 +0000
                          Re: Don't feed the troll... Heiko Wundram <modelnine@modelnine.org> - 2013-06-14 12:15 +0200
                          Re: Don't feed the troll... Guy Scree <nobody@nowhere.com> - 2013-06-14 18:50 -0400
                          Re: Don't feed the troll... Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 06:31 +0000
                            Re: Don't feed the troll... Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-15 13:04 -0400
                          Re: Don't feed the troll... Guy Scree <nobody@nowhere.com> - 2013-06-17 16:15 -0400
                            Re: Don't feed the troll... Chris Angelico <rosuav@gmail.com> - 2013-06-18 07:46 +1000
                      Re: A few questiosn about encoding Cameron Simpson <cs@zip.com.au> - 2013-06-14 20:19 +1000
                        Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:41 +0300
                      Re: Don't feed the troll... (was: Re: A few questiosn about encoding) Fábio Santos <fabiosantosart@gmail.com> - 2013-06-14 11:20 +0100
                        Re: Don't feed the troll... (was: Re: A few questiosn about encoding) rusi <rustompmody@gmail.com> - 2013-06-14 04:51 -0700
                          Re: Don't feed the help-vampire rusi <rustompmody@gmail.com> - 2013-06-14 05:09 -0700
                            Re: Don't feed the help-vampire Heiko Wundram <modelnine@modelnine.org> - 2013-06-14 14:31 +0200
                            Re: Don't feed the help-vampire Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-14 10:51 -0600
                          Re: Don't feed the troll... Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:50 +0300
                            Re: Don't feed the troll... Zero Piraeus <schesis@gmail.com> - 2013-06-14 09:33 -0400
                        Re: Don't feed the troll... Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:45 +0300
                          Re: Don't feed the troll... Heiko Wundram <modelnine@modelnine.org> - 2013-06-14 14:58 +0200
                          Re: Don't feed the troll... Fábio Santos <fabiosantosart@gmail.com> - 2013-06-14 14:25 +0100
                          Re: Don't feed the troll... Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-14 17:12 +0100
                      Re: A few questiosn about encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 12:50 +0200
                        Re: A few questiosn about encoding Nick the Gr33k <support@superhost.gr> - 2013-06-14 15:59 +0300
                          Re: A few questiosn about encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-14 15:52 +0200
                          Re: A few questiosn about encoding Cameron Simpson <cs@zip.com.au> - 2013-06-15 10:28 +1000
                          Re: A few questiosn about encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-17 08:49 +0200
                      Re: Don't feed the troll... Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-14 12:57 +0100
                      Re: Don't feed the troll... (was: Re: A few questiosn about encoding) "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-06-14 13:13 -0400
                      Re: Don't feed the troll... (was: Re: A few questiosn about encoding) Chris Angelico <rosuav@gmail.com> - 2013-06-15 03:31 +1000
                        Re: Don't feed the troll... (was: Re: A few questiosn about encoding) Grant Edwards <invalid@invalid.invalid> - 2013-06-14 19:40 +0000
                      Re: Don't feed the troll "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-06-14 13:56 -0400
                      Re: Don't feed the troll Tim Chase <python.list@tim.thechases.com> - 2013-06-14 14:00 -0500
                      Re: Don't feed the troll "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-06-14 15:17 -0400
                      Re: Don't feed the troll... Ben Finney <ben+python@benfinney.id.au> - 2013-06-15 10:42 +1000
        Re: A few questiosn about encoding Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-19 18:46 -0700
          Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-20 06:26 +0000
            Re: A few questiosn about encoding MRAB <python@mrabarnett.plus.com> - 2013-06-20 12:43 +0100
              Re: A few questiosn about encoding wxjmfauth@gmail.com - 2013-06-20 09:27 -0700
                Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-21 02:37 +1000
                Re: A few questiosn about encoding MRAB <python@mrabarnett.plus.com> - 2013-06-20 18:17 +0100
                  Re: A few questiosn about encoding wxjmfauth@gmail.com - 2013-06-23 08:51 -0700
                    Re: A few questiosn about encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-23 16:30 +0000
                      Re: A few questiosn about encoding wxjmfauth@gmail.com - 2013-06-25 13:16 -0700
                Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-21 03:21 +1000
                Re: A few questiosn about encoding Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-20 20:43 +0100
            Re: A few questiosn about encoding Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 06:40 -0700
              Re: A few questiosn about encoding Andrew Berg <robotsondrugs@gmail.com> - 2013-06-20 09:04 -0500
                Re: A few questiosn about encoding Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 08:12 -0700
                  Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-21 01:26 +1000
                  Re: A few questiosn about encoding Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-20 20:25 +0300
              Re: A few questiosn about encoding Chris Angelico <rosuav@gmail.com> - 2013-06-21 01:28 +1000
              Re: A few questiosn about encoding Andreas Perstinger <andipersti@gmail.com> - 2013-06-20 19:08 +0200

Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#48303

FromGrant Edwards <invalid@invalid.invalid>
Date2013-06-15 14:44 +0000
Message-ID<kphul7$74q$1@reader1.panix.com>
In reply to#48256
On 2013-06-15, Denis McMahon <denismfmcmahon@gmail.com> wrote:
> On Fri, 14 Jun 2013 16:58:20 +0300, Nick the Gr33k wrote:
>
>> On 14/6/2013 1:14 ????, Cameron Simpson wrote:
>>> Normally a character in a b'...' item represents the byte value
>>> matching the character's Unicode ordinal value.
>
>> The only thing that i didn't understood is this line.
>> First please tell me what is a byte value
>
> Seriously? You don't understand the term byte? And you're the support 
> desk for a webhosting company?

Well, we haven't had this thread for a week or so...

There is some ambiguity in the term "byte".  It used to mean the
smallest addressable unit of memory (which varied in the past -- at
one point, both 20 and 60 bit "bytes" were common).  These days the
smallest addressable unit of memory is almost always 8 bits on desktop
and embedded processors (but often not on DSPs).  That's why when IEEE
stadards want to refer to an 8-bit chunk of data they use the term
"octet".

:)

[toc] | [prev] | [next] | [standalone]


#48304

FromNick the Gr33k <support@superhost.gr>
Date2013-06-15 17:49 +0300
Message-ID<kphut9$n5$1@news.ntua.gr>
In reply to#48303
On 15/6/2013 5:44 μμ, Grant Edwards wrote:

> There is some ambiguity in the term "byte".  It used to mean the
> smallest addressable unit of memory (which varied in the past -- at
> one point, both 20 and 60 bit "bytes" were common).  These days the
> smallest addressable unit of memory is almost always 8 bits on desktop
> and embedded processors (but often not on DSPs).  That's why when IEEE
> stadards want to refer to an 8-bit chunk of data they use the term
> "octet".

What the difference between a byte and a byte's value?


-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48309

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-06-15 15:30 +0000
Message-ID<51bc888a$0$29997$c3e8da3$5496439d@news.astraweb.com>
In reply to#48304
On Sat, 15 Jun 2013 17:49:13 +0300, Nick the Gr33k wrote:

> What the difference between a byte and a byte's value?

Nothing.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#48305

FromRoy Smith <roy@panix.com>
Date2013-06-15 10:59 -0400
Message-ID<roy-9D3FB9.10593215062013@news.panix.com>
In reply to#48303
In article <kphul7$74q$1@reader1.panix.com>,
 Grant Edwards <invalid@invalid.invalid> wrote:

> There is some ambiguity in the term "byte".  It used to mean the
> smallest addressable unit of memory (which varied in the past -- at
> one point, both 20 and 60 bit "bytes" were common).

I would have defined it more like, "some arbitrary collection of 
adjacent bits which hold some useful value".  Doesn't need to be 
addressable, nor does it need to be the smallest such thing.

For example, on the pdp-10 (36 bit word), it was common to treat a word 
as either four 9-bit bytes, or five 7-bit bytes (with one bit left 
over), depending on what you were doing.  And, of course, a nybble was 
something smaller than a byte!

And, yes, especially in networking, everybody talks about octets when 
they want to make sure people understand what they mean.

[toc] | [prev] | [next] | [standalone]


#48308

FromNick the Gr33k <support@superhost.gr>
Date2013-06-15 18:14 +0300
Message-ID<kpi0bp$n5$2@news.ntua.gr>
In reply to#48305
On 15/6/2013 5:59 μμ, Roy Smith wrote:

> And, yes, especially in networking, everybody talks about octets when
> they want to make sure people understand what they mean.

1 byte = 8 bits

in networking though since we do not use encoding schemes with variable 
lengths like utf-8 is, how do we separate when a byte value start and 
when it stops?

do we need a start bit and a stop bit for that?



-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48311

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-06-15 11:35 -0400
Message-ID<mailman.3381.1371310527.3114.python-list@python.org>
In reply to#48308

[Multipart message — attachments visible in raw view] — view raw

On Sat, Jun 15, 2013 at 11:14 AM, Nick the Gr33k <support@superhost.gr>wrote:

> On 15/6/2013 5:59 μμ, Roy Smith wrote:
>
>  And, yes, especially in networking, everybody talks about octets when
>> they want to make sure people understand what they mean.
>>
>
> 1 byte = 8 bits
>
> in networking though since we do not use encoding schemes with variable
> lengths like utf-8 is, how do we separate when a byte value start and when
> it stops?
>
> do we need a start bit and a stop bit for that?
>
>

> And this is specific to python how?
>


>
>
> --
> What is now proved was at first only imagined!
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>



-- 
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [next] | [standalone]


#48351

FromNick the Gr33k <support@superhost.gr>
Date2013-06-15 22:26 +0300
Message-ID<kpif50$3kp$2@news.ntua.gr>
In reply to#48150
On 14/6/2013 4:58 μμ, Nick the Gr33k wrote:
> On 14/6/2013 1:14 μμ, Cameron Simpson wrote:
>> Normally a character in a b'...' item represents the byte value
>> matching the character's Unicode ordinal value.
>
> The only thing that i didn't understood is this line.
> First please tell me what is a byte value
>
>> \x1b is a sequence you find inside strings (and "byte" strings, the
>> b'...' format).
>
> \x1b is a character(ESC) represented in hex format
>
> b'\x1b' is a byte object that represents what?
>
>
>  >>> chr(27).encode('utf-8')
> b'\x1b'
>
>  >>> b'\x1b'.decode('utf-8')
> '\x1b'
>
> After decoding it gives the char ESC in hex format
> Shouldn't it result in value 27 which is the ordinal of ESC ?
>
>  > No, I mean conceptually, there is no difference between a code-point
>  > and its ordinal value. They are the same thing.
>
> Why Unicode charset doesn't just contain characters, but instead it
> contains a mapping of (characters <--> ordinals) ?
>
> I mean what we do is to encode a character like chr(65).encode('utf-8')
>
> What's the reason of existence of its corresponding ordinal value since
> it doesn't get involved into the encoding process?
>
> Thank you very much for taking the time to explain.

Can someone please explain these questions too?

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48366

FromBenjamin Schollnick <benjamin@schollnick.net>
Date2013-06-15 16:35 -0400
Message-ID<mailman.3406.1371328560.3114.python-list@python.org>
In reply to#48351

[Multipart message — attachments visible in raw view] — view raw

Nick,

>> The only thing that i didn't understood is this line.
>> First please tell me what is a byte value
>> 
>>> \x1b is a sequence you find inside strings (and "byte" strings, the
>>> b'...' format).
>> 
>> \x1b is a character(ESC) represented in hex format
>> 
>> b'\x1b' is a byte object that represents what?
>> 
>> 
>> >>> chr(27).encode('utf-8')
>> b'\x1b'
>> 
>> >>> b'\x1b'.decode('utf-8')
>> '\x1b'
>> 
>> After decoding it gives the char ESC in hex format
>> Shouldn't it result in value 27 which is the ordinal of ESC ?

I'm sorry are you not listening?

1b is a HEXADECIMAL Number.  As a so-called programmer, did you seriously not consider that?

Try this:

1) Open a Web browser
2) Go to Google.com
3) Type in "Hex 1B" 
4) Click on the first link
5) In the Hexadecimal column find 1B.

Or open your favorite calculator, and convert Hexadecimal 1B to Decimal (Base 10).

		- Benjamin


[toc] | [prev] | [next] | [standalone]


#48451

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2013-06-16 15:45 +0200
Message-ID<mailman.3443.1371390373.3114.python-list@python.org>
In reply to#48351
On Sat, Jun 15, 2013 at 10:35 PM, Benjamin Schollnick
<benjamin@schollnick.net> wrote:
> Nick,
>
> The only thing that i didn't understood is this line.
> First please tell me what is a byte value
>
> \x1b is a sequence you find inside strings (and "byte" strings, the
> b'...' format).
>
>
> \x1b is a character(ESC) represented in hex format
>
> b'\x1b' is a byte object that represents what?
>
>
>>>> chr(27).encode('utf-8')
> b'\x1b'
>
>>>> b'\x1b'.decode('utf-8')
> '\x1b'
>
> After decoding it gives the char ESC in hex format
> Shouldn't it result in value 27 which is the ordinal of ESC ?
>
>
> I'm sorry are you not listening?
>
> 1b is a HEXADECIMAL Number.  As a so-called programmer, did you seriously
> not consider that?
>
> Try this:
>
> 1) Open a Web browser
> 2) Go to Google.com
> 3) Type in "Hex 1B"
> 4) Click on the first link
> 5) In the Hexadecimal column find 1B.
>
> Or open your favorite calculator, and convert Hexadecimal 1B to Decimal
> (Base 10).
>
> - Benjamin
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Better: a programmer should know how to convert hexadecimal to decimal.

0x1B = (0x1 * 16^1) + (0xB * 16^0) = (1 * 16) + (11 * 1) = 16 + 11 = 27

It’s that easy, and a programmer should be able to do that in their
brain, at least with small numbers.  Or at least know that:
http://lmgtfy.com/?q=0x1B+in+decimal

Or at least `hex(27)`; or '`{:X}'.format(27)`; or `'%X' % 27`.  (I
despise hex numbers with lowercase letters, but that’s my personal
opinion.)

--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail                | always bottom-post
http://asciiribbon.org        | http://caliburn.nl/topposting.html

[toc] | [prev] | [next] | [standalone]


#48074

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-06-14 09:36 +0200
Message-ID<mailman.3258.1371195459.3114.python-list@python.org>
In reply to#47921
Op 13-06-13 10:08, Νικόλαος Κούρας schreef:
> On 13/6/2013 10:58 πμ, Chris Angelico wrote:
>> On Thu, Jun 13, 2013 at 5:42 PM, �������� ������
>> <support@superhost.gr> wrote:
>>> On 13/6/2013 10:11 ��, Steven D'Aprano wrote:
>>>> No! That creates a string from 16474 in base two:
>>>> '0b100000001011010'
>>>
>>> I disagree here.
>>> 16474 is a number in base 10. Doing bin(16474) we get the binary
>>> representation of number 16474 and not a string.
>>> Why you say we receive a string while python presents a binary number?
>>
>> You can disagree all you like. Steven cited a simple point of fact,
>> one which can be verified in any Python interpreter. Nikos, you are
>> flat wrong here; bin(16474) creates a string.
>
> Indeed python embraced it in single quoting '0b100000001011010' and
> not as 0b100000001011010 which in fact makes it a string.
>
> But since bin(16474) seems to create a string rather than an expected
> number(at leat into my mind) then how do we get the binary
> representation of the number 16474 as a number?

You don't. You should remember that python (or any programming language)
doesn't print numbers. It always prints string representations of
numbers. It is just so that we are so used to the decimal representation
that we think of that representation as being the number.

Normally that is not a problem but it can cause confusion when you are
working with mulitple representations.

-- 
Antoon Pardon

[toc] | [prev] | [next] | [standalone]


#48076

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 10:49 +0300
Message-ID<kpehuv$p37$6@news.ntua.gr>
In reply to#48074
On 14/6/2013 10:36 πμ, Antoon Pardon wrote:
> Op 13-06-13 10:08, Νικόλαος Κούρας schreef:
>> On 13/6/2013 10:58 πμ, Chris Angelico wrote:
>>> On Thu, Jun 13, 2013 at 5:42 PM, �������� ������
>>> <support@superhost.gr> wrote:
>>>> On 13/6/2013 10:11 ��, Steven D'Aprano wrote:
>>>>> No! That creates a string from 16474 in base two:
>>>>> '0b100000001011010'
>>>>
>>>> I disagree here.
>>>> 16474 is a number in base 10. Doing bin(16474) we get the binary
>>>> representation of number 16474 and not a string.
>>>> Why you say we receive a string while python presents a binary number?
>>>
>>> You can disagree all you like. Steven cited a simple point of fact,
>>> one which can be verified in any Python interpreter. Nikos, you are
>>> flat wrong here; bin(16474) creates a string.
>>
>> Indeed python embraced it in single quoting '0b100000001011010' and
>> not as 0b100000001011010 which in fact makes it a string.
>>
>> But since bin(16474) seems to create a string rather than an expected
>> number(at leat into my mind) then how do we get the binary
>> representation of the number 16474 as a number?
>
> You don't. You should remember that python (or any programming language)
> doesn't print numbers. It always prints string representations of
> numbers. It is just so that we are so used to the decimal representation
> that we think of that representation as being the number.
>
> Normally that is not a problem but it can cause confusion when you are
> working with mulitple representations.
Hold on!
Youa re basically saying here that:


 >>> 16474
16474

is nto a number as we think but instead is string representation of a 
number?

I dont think so, if it were a string representation of a number that 
would print the following:

 >>> 16474
'16474'

Python prints numbers:

 >>> 16474
16474
 >>> 0b100000001011010
16474
 >>> 0x405a
16474

it prints them all to decimal format though.
but when we need a decimal integer to be turned into bin() or hex() we 
can bin(number) hex(number) and just remove the pair of single quoting.

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48082

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-06-14 10:22 +0200
Message-ID<mailman.3266.1371198179.3114.python-list@python.org>
In reply to#48076
Op 14-06-13 09:49, Nick the Gr33k schreef:
> On 14/6/2013 10:36 πμ, Antoon Pardon wrote:
>> Op 13-06-13 10:08, Νικόλαος Κούρας schreef:
>>>
>>> Indeed python embraced it in single quoting '0b100000001011010' and
>>> not as 0b100000001011010 which in fact makes it a string.
>>>
>>> But since bin(16474) seems to create a string rather than an expected
>>> number(at leat into my mind) then how do we get the binary
>>> representation of the number 16474 as a number?
>>
>> You don't. You should remember that python (or any programming language)
>> doesn't print numbers. It always prints string representations of
>> numbers. It is just so that we are so used to the decimal representation
>> that we think of that representation as being the number.
>>
>> Normally that is not a problem but it can cause confusion when you are
>> working with mulitple representations.
> Hold on!
> Youa re basically saying here that:
>
>
> >>> 16474
> 16474
>
> is nto a number as we think but instead is string representation of a
> number?
Yes, or if you prefer what python prints is the decimal notation of the number.  

>
> I dont think so, if it were a string representation of a number that
> would print the following:
>
> >>> 16474
> '16474'

No it wouldn't, You are confusing representation in the everyday meaning
with representation as python jargon.


> Python prints numbers:
No it doesn't, numbers are abstract concepts that can be represented in
various notations, these notations are strings. Those notaional strings
end up being printed. As I said before we are so used in using the
decimal notation that we often use the notation and the number interchangebly
without a problem. But when we are working with multiple notations that
can become confusing and we should be careful to seperate numbers from their
representaions/notations.


> but when we need a decimal integer

There are no decimal integers. There is only a decimal notation of the number.
Decimal, octal etc are not characteristics of the numbers themselves.

-- 

Antoon Pardon

[toc] | [prev] | [next] | [standalone]


#48088

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 11:37 +0300
Message-ID<kpekne$spl$1@news.ntua.gr>
In reply to#48082
On 14/6/2013 11:22 πμ, Antoon Pardon wrote:

>> Python prints numbers:
> No it doesn't, numbers are abstract concepts that can be represented in
> various notations, these notations are strings. Those notaional strings
> end up being printed. As I said before we are so used in using the
> decimal notation that we often use the notation and the number interchangebly
> without a problem. But when we are working with multiple notations that
> can become confusing and we should be careful to seperate numbers from their
> representaions/notations.

How do we separate a number then from its represenation-natation?

What is a notation anywat? is it a way of displayment? but that would be 
a represeantion then....

Please explain this line as it uses both terms.

No it doesn't, numbers are abstract concepts that can be represented in
various notations

>> but when we need a decimal integer
>
> There are no decimal integers. There is only a decimal notation of the number.
> Decimal, octal etc are not characteristics of the numbers themselves.

So everything we see like:

16474
nikos
abc123

everything is a string and nothing is a number? not even number 1?

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48099 — Don't feed the troll... (was: Re: A few questiosn about encoding)

FromHeiko Wundram <modelnine@modelnine.org>
Date2013-06-14 11:06 +0200
SubjectDon't feed the troll... (was: Re: A few questiosn about encoding)
Message-ID<mailman.3278.1371201160.3114.python-list@python.org>
In reply to#48088
Am 14.06.2013 10:37, schrieb Nick the Gr33k:
> So everything we see like:
>
> 16474
> nikos
> abc123
>
> everything is a string and nothing is a number? not even number 1?

Come on now, this is _so_ obviously trolling, it's not even remotely 
funny anymore. Why doesn't killfiling work with the mailing list version 
of the python list? :-(

-- 
--- Heiko.

[toc] | [prev] | [next] | [standalone]


#48102 — Re: Don't feed the troll...

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 12:32 +0300
SubjectRe: Don't feed the troll...
Message-ID<kpeo07$spl$5@news.ntua.gr>
In reply to#48099
On 14/6/2013 12:06 μμ, Heiko Wundram wrote:
> Am 14.06.2013 10:37, schrieb Nick the Gr33k:
>> So everything we see like:
>>
>> 16474
>> nikos
>> abc123
>>
>> everything is a string and nothing is a number? not even number 1?
>
> Come on now, this is _so_ obviously trolling, it's not even remotely
> funny anymore. Why doesn't killfiling work with the mailing list version
> of the python list? :-(
>

I'mm not trolling man, i just have hard time understanding why numbers 
acts as strings.

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48115 — Re: Don't feed the troll...

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-06-14 13:09 +0200
SubjectRe: Don't feed the troll...
Message-ID<mailman.3294.1371208145.3114.python-list@python.org>
In reply to#48102
Op 14-06-13 11:32, Nick the Gr33k schreef:

> I'mm not trolling man, i just have hard time understanding why numbers 
> acts as strings.
They don't. No body claimed numbers acted like strings. What was explained,
was that when numbers are displayed, they are converted into a notational
string, which is then displayed. This to clear you of your confusion between
numerals and numbers which you displayed by writing something like "the
binary representation as a number"

-- 
Antoon Pardon

[toc] | [prev] | [next] | [standalone]


#48130 — Re: Don't feed the troll...

FromNick the Gr33k <support@superhost.gr>
Date2013-06-14 15:36 +0300
SubjectRe: Don't feed the troll...
Message-ID<kpf2nq$spl$10@news.ntua.gr>
In reply to#48115
On 14/6/2013 2:09 μμ, Antoon Pardon wrote:
> Op 14-06-13 11:32, Nick the Gr33k schreef:
>
>> I'mm not trolling man, i just have hard time understanding why numbers
>> acts as strings.
> They don't. No body claimed numbers acted like strings. What was explained,
> was that when numbers are displayed, they are converted into a notational
> string, which is then displayed. This to clear you of your confusion between
> numerals and numbers which you displayed by writing something like "the
> binary representation as a number"
>
Hold on.

number = an abstract sense
numeral = ?
notation = ?
represenation = ?

-- 
What is now proved was at first only imagined!

[toc] | [prev] | [next] | [standalone]


#48134 — Re: Don't feed the troll...

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-06-14 08:44 -0400
SubjectRe: Don't feed the troll...
Message-ID<mailman.3301.1371213854.3114.python-list@python.org>
In reply to#48130

[Multipart message — attachments visible in raw view] — view raw

go away Nick.  Go far away.  You are not a good person.  You are not even a
good Troll.  You are just nick the *ick.  You should take up something you
can do better than this.. like maybe sleeping


On Fri, Jun 14, 2013 at 8:36 AM, Nick the Gr33k <support@superhost.gr>wrote:

> On 14/6/2013 2:09 μμ, Antoon Pardon wrote:
>
>> Op 14-06-13 11:32, Nick the Gr33k schreef:
>>
>>  I'mm not trolling man, i just have hard time understanding why numbers
>>> acts as strings.
>>>
>> They don't. No body claimed numbers acted like strings. What was
>> explained,
>>
>> was that when numbers are displayed, they are converted into a notational
>> string, which is then displayed. This to clear you of your confusion
>> between
>> numerals and numbers which you displayed by writing something like "the
>> binary representation as a number"
>>
>>  Hold on.
>
> number = an abstract sense
> numeral = ?
> notation = ?
> represenation = ?
>
>
> --
> What is now proved was at first only imagined!
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>



-- 
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [next] | [standalone]


#48144 — Re: Don't feed the troll...

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-06-14 15:25 +0200
SubjectRe: Don't feed the troll...
Message-ID<mailman.3305.1371216328.3114.python-list@python.org>
In reply to#48130
Op 14-06-13 14:36, Nick the Gr33k schreef:

> On 14/6/2013 2:09 μμ, Antoon Pardon wrote:
>> Op 14-06-13 11:32, Nick the Gr33k schreef:
>>> I'mm not trolling man, i just have hard time understanding why numbers
>>> acts as strings.
>> They don't. No body claimed numbers acted like strings. What was explained,
>> was that when numbers are displayed, they are converted into a notational
>> string, which is then displayed. This to clear you of your confusion between
>> numerals and numbers which you displayed by writing something like "the
>> binary representation as a number"
> Hold on.
> number = an abstract sense
> numeral = ?
> notation = ?
> represenation = ?
I already explained these in previous responses. I am not going to repeat
myself. IMO you are out of place here. You belong in a tutor class about
basical computing concepts. There you can aquire the knowledge that is
more or less expected of those who want to contribute here. I don't mind
the occasional gap in knowledge but with you it seems more there is an
occasional grain of knowledge in a sea of ignorance. To remedy the former
a single explanation is mostly sufficient. To remedy the latter you need
a tutorial course.

Now there is nothing wrong in being ignorant. The question is how do you
proceed from there. The answer is not by starting a project that is far
above your ability and pestering the experts in the hope they will spoon
feed you.

[toc] | [prev] | [next] | [standalone]


#48168 — Re: Don't feed the troll...

FromNeil Cerutti <neilc@norwich.edu>
Date2013-06-14 15:54 +0000
SubjectRe: Don't feed the troll...
Message-ID<b20skuFt22jU1@mid.individual.net>
In reply to#48144
On 2013-06-14, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote:
> Now there is nothing wrong in being ignorant. The question is
> how do you proceed from there. The answer is not by starting a
> project that is far above your ability and pestering the
> experts in the hope they will spoon feed you.

A major issue is this: the spoon-feeding he does receive is
unefficacious. Smart, well-meaning, articulate people's time is
getting squandered.

I read the responses. I've learned things from them. But Nikos
has not. And once a discussion devolves to reitteration even that
value is lost.

And perhaps worst of all, there's none of the closure or
vicarious catharsis that usually comes from a well-designed
educational transaction.

-- 
Neil Cerutti

[toc] | [prev] | [next] | [standalone]


Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →

Back to top | Article view | comp.lang.python


csiph-web