Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by JamesCherrill Iterable would be a good thing so you can use the enhanced for/each loop with your data structure. For the absolute pinnacle of professionalism implement the whole Collection interface. Frankly I think your code is very good. syntax for adding to a Iterable integer linked list Programming by Roger_2 …;The method add(int, int) is undefined for the type Iterable<Integer>" } } } return adj[v]; } package edu…n"); } return sb.toString(); } //vertices adjacent to v public Iterable<Integer> adj(int v) { return adj[v]; } @SuppressWarnings… Re: syntax for adding to a Iterable integer linked list Programming by JamesCherrill Line 2: you define adj (or whatever) as an Iterable<etc>. Later you assign a LinkedList to that. …That's OK because LinkedList implements Iterable. However later on you try to call add(etc), which… the compiler knows is that you call it on an Iterable, and Iterable does not include an add method. Re: syntax for adding to a Iterable integer linked list Programming by JamesCherrill … solution. Can I assume the method has to return an Iterable? Inside your method you need to construct and populate an… Iterable. You have decided that a LinkedList is an appropriate data … return the LinkedList because that is a class that implements Iterable. Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by somjit{} … data-structure used here is an array , which is itself iterable via `for-each()` , i'm wondering how much benefit implementing… `Iterable` will provide here. I would appreciate if someone could review … Re: To sort iterable with heapq Programming Software Development by aragonnette can we use it in iterable objects , i have tried but not works ... i want to use in django queryset result which is iterable Error: "TypeError: argument of type 'int' is not iterable" Programming Software Development by wotthe2000 … getting the error TypeError: argument of type 'int' is not iterable when i run my program and don't know where… not iterable? Programming Software Development by leegeorg07 … it, it raises the error that "utext is not iterable" here is the code: [code=python] morse_code={ "a… TypeError: 'NoneType' object is not iterable Programming Software Development by jeffery12109 … not sure what this means... TypeError: 'NoneType' object is not iterable here's the code [CODE]day, season, help4, myGame = karidInn… Object Not Iterable Error Programming Software Development by kinto …: [CODE]for node in network: TypeError: 'function' object is not iterable[/CODE] Any thoughts would be greatly appreciated To sort iterable with heapq Programming Software Development by aragonnette hi , i want to sort my two merged iterable with heapq. everything is good but in result which starts with Turkish character locate end of all result. exm: Ö,Ş,İ ... locate end of result how can i solve this problem? Re: To sort iterable with heapq Programming Software Development by aragonnette i am using below code merging two iterable , everything is good but some words which starts with Ö - Örnek, Ş - Ş… Re: To sort iterable with heapq Programming Software Development by aragonnette thnks for your code i havent tried yet but in my code i have two merged iterable object... i suppose it works.. Re: To sort iterable with heapq Programming Software Development by TrustyTony Post code, working data file (Attach it to post in Advanced Editor) and post exsact error messages. Can't you just make list from iterable? Like (don't know django, but as principle): [CODE]results = sorted(django.queryset(), key=locale.strxfrm)[/CODE] 'float' object is not iterable Programming Software Development by LagunaGTO … to collect total prices paid TypeError: 'float' object is not iterable >>> [/CODE] TypeError: 'module' object is not iterable Programming Software Development by booicu … getting back the awful " TypeError: 'module' object is not iterable I am sure it is something I completely overlooking but… Re: TypeError: 'module' object is not iterable Programming Software Development by TrustyTony module numbers you import seems not to be iterable. Re: Adapt an iterable to look like a file. Programming Software Development by Gribouillis …a file opened for reading """ return IterableAsFileAdapter(iterable) def adapt_as_opener(func): """Decorator to adapt a… standard library class IterableAsFileAdapter(object): def __init__(self, iterable): self.source = filter(None, iterable) self.start = self.pos = self.end = 0 … Re: Adapt an iterable to look like a file. Programming Software Development by Gribouillis …a file opened for reading """ return IterableAsFileAdapter(iterable) def adapt_as_opener(func): """Decorator to adapt a… standard library class IterableAsFileAdapter(object): def __init__(self, iterable): self.source = filter(None, iterable) self.start = self.pos = self.end = 0 … Re: Adapt an iterable to look like a file. Programming Software Development by Gribouillis …a file opened for reading """ return IterableAsFileAdapter(iterable) def adapt_as_opener(func): """Decorator to adapt… 0 encoding = None errors = None def __init__(self, iterable): self.source = filter(None, iterable) self.start = self.pos = self.end = 0 … Re: Averaging iterable without making copy of values Programming Software Development by Gribouillis … add_pairs((a, b), (c, d)): return (a + c, b + d) iterable = xrange(10,20) total, size = reduce(add_pairs, itt.izip…(iterable, itt.repeat(1))) print float(total) / size # prints 14.5 [/… Re: Averaging iterable without making copy of values Programming Software Development by TrustyTony …: raise ValueError(n) [/code][/QUOTE] Dropping cStringIO in favour of iterable: [CODE]valid_tokens = set([tokenize.OP, tokenize.NUMBER, tokenize.ENDMARKER, tokenize… Re: syntax for adding to a Iterable integer linked list Programming by JamesCherrill Having a method and a data member with the same name `adj` is bound to lead to confusion. Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by ~s.o.s~ Minor comments: head = 0; tail = head + (size - 1); `head` is unnecessary in the second statement. > throw new java.lang.IllegalArgumentException `java.lang` is always imported; remove the full qualification. if (size == 0) throw new java.lang.NullPointerException("size = 0"); NPE is … Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by somjit{} > implement the whole Collection interface 1. i dont know how to do that 2. i dont really know what that will result in. If you could provide some examples , would be great. > Frankly I think your code is very good. Thank you ! :) Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by JamesCherrill The Collection interface is documented in the API doc, so you can read the definitions of methods that it includes. What it gives you is the capability to use your ResizingCircularArray just like you can use ArrayList or LinkedList etc as in Collection<String> myData = new ArrayList<>(); (etc) change to Collection<String> myData … Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by somjit{} @ ~s.o.s~ > head is unnecessary in the second statement. I kept that extra head to make it easier to understand later on , or for someone else viewing my code. > maybe NoSuchElementException? Eclipse auto generation :| i intended it to be NSEE. > Your sample method is missing a check wherein head+offset can go beyond tail. … Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by somjit{} > Collection<String> myData = new ResizingCircularArray<>{}; So i can pass it anywhere a Collection<E> is expected .... nice ! Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by JamesCherrill Yes, exactly that. It's really nice. OK, it's not necessary, but if I were marking this as an assignment I would give a whole heap of bonus points for doing that. Re: Generic Resizing Circular Array . Do i need to implement iterable ? Programming Software Development by somjit{} An update : As sos pointed out , although i call it a *circular* buffer , its really a linear one. But lets compare what i do , and what a *circular* array would have done : **Similarities:** A cicular array would keep check of size via the difference between the location of Head and tail , I'm doing basically the same i think , perhaps in a …