Solved

b before some variables in winpdb

Posted on 2014-07-28
7
208 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 45

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 45

Expert Comment

by:aikimark
ID: 40225869
0
 
LVL 29

Assisted Solution

by:pepr
pepr earned 200 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
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 

Author Comment

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

Accepted Solution

by:
aikimark earned 300 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

"The time has come," the Walrus said, "To talk of many things: Of sets--and lists--and dictionaries-- Of variable kinks-- And why you see it changing not-- And why so strange are strings." This part describes how variables and references (see …
Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

691 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