Solved

b before some variables in winpdb

Posted on 2014-07-28
7
196 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…

749 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