[issue12390] urllib.parse.urlencode encoding lists as strings

2011-06-23 Thread Joesph

Joesph someone...@gmail.com added the comment:

Hrm, yes. 'Tis what I get for working while sick.

--
resolution: invalid - accepted

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12390
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12390] urllib.parse.urlencode encoding lists as strings

2011-06-22 Thread Joesph

New submission from Joesph someone...@gmail.com:


Per the documentation urlencode is supposed to encode a structure returned by 
parse_qs back to a query string. However, urlencode appears to not be 
processing the lists associated with each key.
Example:

import urllib.parse
dictQuery = urllib.parse.parse_qs('a=bb=cc=dc=e',
  strict_parsing=True,
  encoding='iso8859-1')
assert isinstance(dictQuery,dict)
assert isinstance(dictQuery['a'],list)
strQuery = urllib.parse.urlencode(dictQuery, encoding='iso8859-1')
print(strQuery)
 
Outputs: a=%5B%27b%27%5Dc=%5B%27d%27%2C+%27e%27%5Db=%5B%27c%27%5D
Which means: a=['b']c=['d', 'e']b=['c']
Expected: a=bc=dc=eb=c


--
components: Library (Lib)
messages: 138850
nosy: someone3x7
priority: normal
severity: normal
status: open
title: urllib.parse.urlencode encoding lists as strings
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12390
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph

Joesph someone...@gmail.com added the comment:

And much sense is made. If there is a generic instance test that I have
missed I'd be willing to work around this minor flaw. That the definition is
an instance of 'object' is a case that should be handled by the function
though.
On May 28, 2011 6:19 PM, Benjamin Peterson rep...@bugs.python.org wrote:

 Benjamin Peterson benja...@python.org added the comment:

 Everything is an instance of object.

 --
 nosy: +benjamin.peterson
 resolution: - invalid
 status: open - closed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue12203
 ___

--
Added file: http://bugs.python.org/file22184/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203
___pAnd much sense is made. If there is a generic instance test that I have 
missed I#39;d be willing to work around this minor flaw. That the definition 
is an instance of #39;object#39; is a case that should be handled by the 
function though./p

div class=gmail_quoteOn May 28, 2011 6:19 PM, quot;Benjamin Petersonquot; 
lt;a href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt; 
wrote:br type=attributiongt; brgt; Benjamin Peterson lt;a 
href=mailto:benja...@python.org;benja...@python.org/agt; added the 
comment:br
gt; brgt; Everything is an instance of object.brgt; brgt; 
--brgt; nosy: +benjamin.petersonbrgt; resolution:  -gt; 
invalidbrgt; status: open -gt; closedbrgt; brgt; 
___br
gt; Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;brgt; 
lt;a 
href=http://bugs.python.org/issue12203;http://bugs.python.org/issue12203/agt;brgt;
 ___br
/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph

Joesph someone...@gmail.com added the comment:

It only fails when checking for 'object'. To think classes are instances is
absurd. Its like saying the chicken is the egg. I can understand that
classes are an instance of object in the interpreter, but, that isn't the
case in the interpreted. Thus this is an unhandled case.

To accept your answer would mean it is a pointless function that should be
removed altogether. But that is not the case as this example works as
expected:

class A(object):
pass

class B(A):
pass

C = B()

print([isinstance(B,A),isinstance(C,A)])

# outputs: [False, True]

You did make it obvious to me why the object case was failing and for that I
am grateful. It will make it easier to work around when I get back to that
part of the code.

On Sun, May 29, 2011 at 7:14 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray rdmur...@bitdance.com added the comment:

 Everything in python is an instance of something.  Objects all the way
 down...

  isinstance(object, object)
 True

 So, there is no function you are overlooking because there is nothing that
 is not an instance.

 --
 nosy: +r.david.murray

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue12203
 ___


--
Added file: http://bugs.python.org/file22185/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203
___It only fails when checking for #39;object#39;. To think classes are 
instances is absurd. Its like saying the chicken is the egg. I can understand 
that classes are an instance of object in the interpreter, but, that isn#39;t 
the case in the interpreted. Thus this is an unhandled case. br
brTo accept your answer would mean it is a pointless function that should be 
removed altogether. But that is not the case as this example works as 
expected:brbrclass A(object):br    passbrbrclass B(A):br    
passbr
brC = B()brbrprint([isinstance(B,A),isinstance(C,A)])brbr# outputs: 
[False, True]brbrYou did make it obvious to me why the object case was 
failing and for that I am grateful. It will make it easier to work around when 
I get back to that part of the code.br
brdiv class=gmail_quoteOn Sun, May 29, 2011 at 7:14 PM, R. David Murray 
span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;
br
R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
br
Everything in python is an instance of something.  Objects all the way 
down...br
br
gt;gt;gt; isinstance(object, object)br
Truebr
br
So, there is no function you are overlooking because there is nothing that is 
not an instance.br
br
--br
nosy: +r.david.murraybr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue12203; 
target=_blankhttp://bugs.python.org/issue12203/agt;br
___br
/div/div/blockquote/divbrdiv style=visibility: hidden; left: 
-5000px; position: absolute; z-index: ; padding: 0px; margin-left: 0px; 
margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; 
font-size: 10px; text-align: left; line-height: 130%; id=avg_ls_inline_popup
/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph

Joesph someone...@gmail.com added the comment:

Beautiful, thank you. This should be in the isinstance documentation for
clarity.
On May 29, 2011 9:28 PM, R. David Murray rep...@bugs.python.org wrote:

 R. David Murray rdmur...@bitdance.com added the comment:

 You are correct, B is not an instance of A. But both B and A are instances
of 'type':

 class A:
 ... pass
 ...
 class B(A):
 ... pass
 ...
 isinstance(A, type)
 True
 isinstance(B, type)
 True


 And type is a subclass of object. isinstance is correct, because Python is
consistent. As we said, *everything* is an object.

 If you want to know if something is a class, you can check isinstance(X,
type):

 a = A()
 isinstance(a, type)
 False

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue12203
 ___

--
Added file: http://bugs.python.org/file22186/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203
___pBeautiful, thank you. This should be in the isinstance documentation for 
clarity./p
div class=gmail_quoteOn May 29, 2011 9:28 PM, quot;R. David Murrayquot; 
lt;a href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt; 
wrote:br type=attributiongt; brgt; R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
gt; brgt; You are correct, B is not an instance of A.  But both B and A are 
instances of #39;type#39;:brgt; brgt;gt;gt;gt; class A:brgt; ...  
 passbrgt; ...brgt;gt;gt;gt; class B(A):brgt; ...passbr
gt; ...brgt;gt;gt;gt; isinstance(A, type)brgt; 
Truebrgt;gt;gt;gt; isinstance(B, type)brgt; Truebrgt;gt;gt;gt; 
brgt; brgt; And type is a subclass of object.  isinstance is correct, 
because Python is consistent.  As we said, *everything* is an object.br
gt; brgt; If you want to know if something is a class, you can check 
isinstance(X, type):brgt; brgt;gt;gt;gt; a = A()brgt;gt;gt;gt; 
isinstance(a, type)brgt; Falsebrgt; brgt; --brgt; br
gt; ___brgt; Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;brgt; 
lt;a 
href=http://bugs.python.org/issue12203;http://bugs.python.org/issue12203/agt;br
gt; ___br/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12203] isinstance not functioning as documented

2011-05-28 Thread Joesph

New submission from Joesph someone...@gmail.com:

#Example:
class a(object):
pass

b = a()

print([isinstance(a,object), isinstance(b,object)])

'''
outputs: [True, True]
expected: [False, True]

As class a is not instantiated it should return false. As-is isinstance is just 
a synonym for issubclass.
'''

--
components: Interpreter Core
messages: 137160
nosy: someone3x7
priority: normal
severity: normal
status: open
title: isinstance not functioning as documented
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com