Message11674
| Author |
jamesmudd |
| Recipients |
jamesmudd |
| Date |
2017年11月22日.18:58:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1511377130.71.0.213398074469.issue2645@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
pop should return the last item in the list (https://docs.python.org/2/tutorial/datastructures.html#more-on-lists) which works correctly with ArrayList but fails with LinkedList e.g.
>>> stack = [1,2,3]
>>> stack.pop()
3 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Correct
>>> from java.util import ArrayList
>>> jl = ArrayList([1,2,3])
>>> jl.pop()
3 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Correct
>>> from java.util import LinkedList
>>> jll = LinkedList([1,2,3])
>>> jll.pop()
1 <<<<<<<<<<<<<<<< First entry not last?
I think this is because LinkedList implements Deque with defines the pop method to return the first item not the last. This might not be fixable as both results are "correct" depending on what you define pop to do. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年11月22日 18:58:50 | jamesmudd | set | recipients:
+ jamesmudd |
| 2017年11月22日 18:58:50 | jamesmudd | set | messageid: <1511377130.71.0.213398074469.issue2645@psf.upfronthosting.co.za> |
| 2017年11月22日 18:58:50 | jamesmudd | link | issue2645 messages |
| 2017年11月22日 18:58:50 | jamesmudd | create |
|