473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: Why gives "k = 09" a syntax error ?

Stef Mientki wrote:
hello,

Why gives "k = 09" a syntax error ?
You have gotten the 2.x answer. In 3.0, 0b,0o,0x prefixes are valid and
required for binary, octal, and hexadecimal literals. 0digits is invalid.

tjr

Oct 29 '08 #1
3 989
On Oct 29, 4:25*pm, Terry Reedy <tjre...@udel.eduwrote:
Stef Mientki wrote:
hello,
Why gives "k = 09" *a syntax error ?

You have gotten the 2.x answer. *In 3.0, 0b,0o,0x prefixes are valid and
required for binary, octal, and hexadecimal literals. *0digits is invalid.

tjr
Is it documented? :-)
Oct 29 '08 #2
Mensanator wrote:
On Oct 29, 4:25 pm, Terry Reedy <tjre...@udel.eduwrote:
>Stef Mientki wrote:
>>hello,
Why gives "k = 09" a syntax error ?
You have gotten the 2.x answer. In 3.0, 0b,0o,0x prefixes are valid and
required for binary, octal, and hexadecimal literals. 0digits is invalid.

tjr

Is it documented? :-)
Yes.

http://www.python.org/dev/peps/pep-3127/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Oct 29 '08 #3
Mensanator wrote:
On Oct 29, 4:25 pm, Terry Reedy <tjre...@udel.eduwrote:
>Stef Mientki wrote:
>>hello,
Why gives "k = 09" a syntax error ?
You have gotten the 2.x answer. In 3.0, 0b,0o,0x prefixes are valid and
required for binary, octal, and hexadecimal literals. 0digits is invalid.
except 00, 000, etc.

Is it documented? :-)
Very clearly.

Integer literals
Integer literals are described by the following lexical definitions:

integer ::= decimalinteger | octinteger | hexinteger | bininteger
decimalinteger ::= nonzerodigit digit* | "0"+
nonzerodigit ::= "1"..."9"
digit ::= "0"..."9"
octinteger ::= "0" ("o" | "O") octdigit+
hexinteger ::= "0" ("x" | "X") hexdigit+
bininteger ::= "0" ("b" | "B") bindigit+
octdigit ::= "0"..."7"
hexdigit ::= digit | "a"..."f" | "A"..."F"
bindigit ::= "0" | "1"

Oct 29 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: eje | last post by:
IsNumeric(value) should return false if value "can not be successfully converted to a Double." Instead I get the following error message: "Input string was not in a correct format." I use the...
6
by: vips | last post by:
Page_Load datagrid1.datasource=dataset1 //I am filling the datagrid and it works fine when page is displayed end ---------------
0
by: Pixie | last post by:
We are successfully getting a handle to a drive using createfile then using that handle to query the change journal using DeviceIOControl with the paramter FSCTL_QUERY_USN_DATA. However when we try...
12
by: arnuld | last post by:
in C++ Primer 4/3 Lippman says in chapter 3, section 3.3.1: vector<stringsvec(10); // 10 elements, each an empty string here is the the code output & output from my Debian box running "gcc...
4
by: rukkie | last post by:
Hi, I have some problems with a PHP reference in a <SCRIPTtag, but only with the Internet Explorer, which gives a "Error on page" message in the Status Bar. The code is as follows : <script>...
3
by: mohammadazim | last post by:
Hi guys I wrote a socket program in c++ and used blocking system call read () for receiving data on socket. But it gives following error while compilation g++ -Wall -g -I`pwd`/../include...
6
by: ranesmitas | last post by:
Hi ,I am using Visual Basic Backend SQL I create form in which i create Command button NEW ,MODIFY, VIEW,SAVE,EXIT all my programme is running but when i add new record and save and then i...
1
by: Stef Mientki | last post by:
hello, Why gives "k = 09" a syntax error ? thanks, Stef Mientki
0
by: Guilherme Polo | last post by:
On 10/29/08, Stef Mientki <stef.mientki@gmail.comwrote: 09 is not a valid octal number. Instead use 011. Ok, I guess you were not aware that prefixing a number with a '0' would cause python to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.