?
Solved

b before some variables in winpdb

Posted on 2014-07-28
7
Medium Priority
?
218 Views
Last Modified: 2014-07-29
why is there numerous
b
before variables

I underline in red

b before variable (underlined in red)
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 40225866
Based on past experience with other dictionary objects, my guess is that it represents an internal binary storage format for these dictionary keys.  So, comparisons with these keys can only be done in a case-sensitive mode.

It might also be the result of a mix of string and float keys.
0
 
LVL 46

Expert Comment

by:aikimark
ID: 40225869
0
 
LVL 29

Assisted Solution

by:pepr
pepr earned 800 total points
ID: 40226143
As aikimark pointed out... Python 3 separates bytes from strings. In Python 2, strings were actually what Python 3 bytes are. I do not know Winpdb, but it could be the case that Python 2 strings may be shown using the Python 3 representation.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:rgb192
ID: 40227891
So bytes are b?
But i do not see s for string?
0
 
LVL 46

Accepted Solution

by:
aikimark earned 1200 total points
ID: 40227942
You are seeing the ASCII characters within the string.  I would expect to see non-printable characters once the byte values exceed 127
0
 

Author Closing Comment

by:rgb192
ID: 40228122

You are seeing the ASCII characters within the string.  I would expect to see non-printable characters once the byte values exceed 127

So now I know why I only see 'b'

Thanks
0
 
LVL 29

Expert Comment

by:pepr
ID: 40228511
What you see is the representation of the object. There is the built-in function repr() that returns the representation. The representation is a string that--when copy/pasted into a source code--would produce the object with the same value. (This is ideal case, it is not possible for more complex objects. But this is the idea.)

In Python 3, strings literals are written as 'some string', or in single or in double quotes. There is nothing like an s prefix. Because of that, the representation is 'some string'. The bytes type was not present in Python 2. In Python 3, b'some characters' is the way how to type-in the sequence of characters that will not be interpreted as Unicode string. If the source code is written (using editor) in some 8-bit encoding, when looping through the bytes sequence, you get integers for each byte.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Strings in Python are the set of characters that, once defined, cannot be changed by any other method like replace. Even if we use the replace method it still does not modify the original string that we use, but just copies the string and then modif…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question