Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:134': 0.05; 'string.': 0.05; 'binary': 0.07; 'string': 0.09; 'strings.': 0.09; 'subject:few': 0.09; 'python': 0.11; 'integers.': 0.16; 'language)': 0.16; 'nick': 0.16; 'notation': 0.16; 'notations': 0.16; 'number?': 0.16; 'octal': 0.16; 'seperate': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'normally': 0.19; 'seems': 0.21; '>>>': 0.22; 'programming': 0.22; 'saying': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; 'integer': 0.24; '(or': 0.24; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; "skip:' 10": 0.31; 'decimal': 0.31; 'prints': 0.31; 'problem': 0.35; 'problem.': 0.35; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'should': 0.36; 'so,': 0.37; 'being': 0.38; 'expected': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'numbers': 0.61; 'become': 0.64; 'here': 0.66; 'dont': 0.67; '8bit%:100': 0.72; 'confusing': 0.84; 'embraced': 0.84; 'pardon': 0.84; 'careful': 0.91; 'numbers:': 0.91 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqEEAGHSulGGuA9G/2dsb2JhbABahwG4WoMCgRyDFwEBBAEjDwFFBgsJAhgCAgUWCwICCQMCAQIBRRMIAogEBo1smz2JRogHgSaOKRaCNoEUA5dBhgyLNoMR Date: Fri, 14 Jun 2013 10:22:31 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: A few questiosn about encoding References: <6dfa3707-80f4-407a-a109-66dbb0130513@googlegroups.com> <51b83e5a$0$29998$c3e8da3$5496439d@news.astraweb.com> <51b90ead$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b9708b$0$29872$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 59 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371198179 news.xs4all.nl 15998 [2001:888:2000:d::a6]:55281 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48082 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