Solved

b before some variables in winpdb

Posted on 2014-07-28
7
180 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
  • 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 28

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 28

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 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 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 …

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now