Stack implementation in Python3

I'm learning Python by implementing the commonly used data structures. Here's my Stack implementation,

class Node:     def __init__(self, value=None, next=None):         self.value = value = next  from node import Node   class Stack:     def __init__(self): = None         self.size = 0      def push(self, item):         curr = Node(item)         self.size += 1         if is None:    = curr         else:    =    = curr      def peek(self):         return      def pop(self):         if is None:             raise Exception("Nothing to pop.")         curr = =         self.size -= 1         return curr      def __sizeof__(self):         return self.size      def is_empty(self):         return self.size == 0;      def __str__(self):         curr =         while curr:             print(curr.value, end=' ')             curr = 

Invite comments. My primary language is Java, thus would like to know if I'm being Pythonic enough. Any means to better up will be appreciated.


Category: python Time: 2016-07-29 Views: 0
Tags: python stack

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.208 (s). 12 q(s)