Re: I have no class

2014-11-22 Thread Rustom Mody
On Sunday, November 23, 2014 9:06:03 AM UTC+5:30, Seymore4Head wrote: > Now I am trying to add a dictionary, but it is broke too. > > How do I fix: > class RPS: > key={0:"rock", 1:"paper",2:"scissors"}; > def __init__(self): > self.throw=random.randrange(3) > self.key=key[s

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-22 Thread Rustom Mody
On Sunday, November 23, 2014 12:00:15 PM UTC+5:30, Steven D'Aprano wrote: > Rick should ask himself why virtually every single language, from compiled > languages like Ada, C, Pascal and Java, to interpreted languages like bash, > all use search paths instead of explicit paths. > > Hint: the answe

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 8:28:16 PM UTC+5:30, Ivan Evstegneev wrote: > Hello guys, > > I would like to ask you for some explanations on comprehensions. (Don't be > scared, it just some particular example ^_^) > > I found this little "find prime number" example over the internet: > > >>>

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 9:27:22 PM UTC+5:30, Roy Smith wrote: > Skip Montanaro wrote: > > > > But it breaks all the picture that I've built in my head about comps till > > > now... > > > > Note that list comprehensions are little more than syntactic sugar for for > > loops. If you're having

Re: I have no class

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 10:20:05 PM UTC+5:30, Seymore4Head wrote: > Like I have said, most of the stuff I am doing is still trial and > error. Having to specify RPS to use it inside the class seemed wrong > to me. Yes that is natural. Python is a bit odd in the OO-world in that it prioritize

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 10:15:51 PM UTC+5:30, Rustom Mody wrote: > 1. I find comprehensions are harder than for-loops -- Heh! Meant to say 'easier' of course... -- https://mail.python.org/mailman/listinfo/python-list

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Monday, November 24, 2014 10:13:04 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 23 Nov 2014 08:45:39 -0800, Rustom Mody wrote: > > First a one-line solution in haskell > > > > sieve (p:xs) =p:sieve [x | x <- xs, x `mod` p /= 0] > > Don't use tha

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Rustom Mody
On Monday, November 24, 2014 10:38:52 PM UTC+5:30, Marko Rauhamaa wrote: > Rick Johnson : > > > FINDERS KEEPERS; LOSERS WEEPERS! > > > > Contrary to your naive interpretation of history, the native > > Americans [...] > > Was this rant at least produced by a Python generator? > > Where's the Sto

Re: Ducktyping

2014-11-24 Thread Rustom Mody
On Tuesday, November 25, 2014 10:08:28 AM UTC+5:30, Steven D'Aprano wrote: > https://pbs.twimg.com/media/B3Fvg-sCYAAkLSV.jpg :-) I will use this in a class. Now to hunt a cartoon for the opposite -- static/rigorous typing -- https://mail.python.org/mailman/listinfo/python-list

Re: Can you use self in __str__

2014-11-28 Thread Rustom Mody
On Friday, November 28, 2014 6:57:23 AM UTC+5:30, Seymore4Head wrote: > def __str__(self): > s = "Hand contains " > for x in self.hand: > s = s + str(x) + " " > return s > > This is part of a Hand class. I need a hand for the dealer and a hand > for the player.

Re: Can you use self in __str__

2014-11-28 Thread Rustom Mody
On Friday, November 28, 2014 7:51:40 PM UTC+5:30, Rustom Mody wrote: > On Friday, November 28, 2014 6:57:23 AM UTC+5:30, Seymore4Head wrote: > > def __str__(self): > > s = "Hand contains " > > for x in self.hand: > > s =

Re: Question on lambdas

2014-12-08 Thread Rustom Mody
On Tuesday, December 9, 2014 5:28:49 AM UTC+5:30, Ben Finney wrote: > memilanuk writes: > > > What I'm having trouble finding a concrete answer to is the difference > > between: > > (Note that where you write “some_func” the syntax requires an > expression, not a function. I've changed your examp

Re: Do you like the current design of python.org?

2014-12-08 Thread Rustom Mody
On Friday, December 5, 2014 4:13:27 PM UTC+5:30, Steven D'Aprano wrote: > But most of all, I despise the menus that pop up covering what I am trying > to read the page just because I happened to move the mouse over a button. I > loathe the practice of stuffing content into menus instead of using li

Re: Do you like the current design of python.org?

2014-12-09 Thread Rustom Mody
On Tuesday, December 9, 2014 2:37:59 PM UTC+5:30, Peter Otten wrote: > Rustom Mody wrote: > > > On Friday, December 5, 2014 4:13:27 PM UTC+5:30, Steven D'Aprano wrote: > >> But most of all, I despise the menus that pop up covering what I am > >> trying to read

Re: Tuple of lists concatenation - function vs comprehension

2014-12-09 Thread Rustom Mody
On Monday, December 8, 2014 3:52:53 AM UTC+5:30, Terry Reedy wrote: > On 12/7/2014 10:28 AM, Ivan Evstegneev wrote: > > Hi Shiyao, > > > > Now I see, that it was kind of dumb question... > > > > x = ([1, 2], [3, 4], [5, 6]) > > L = [] > [L.extend(i) for i in x] > > [None, None, None] >

Re: When do default parameters get their values set?

2014-12-09 Thread Rustom Mody
On Wednesday, December 10, 2014 4:38:18 AM UTC+5:30, rand...@fastmail.us wrote: > On Tue, Dec 9, 2014, at 16:18, Duncan Booth wrote: > > The default parameters are actually evaluated when the 'def' statement is > > executed and the function object is created from the default arguments > > and > >

Re: When do default parameters get their values set?

2014-12-10 Thread Rustom Mody
On Thursday, December 11, 2014 12:09:10 AM UTC+5:30, rand...@fastmail.us wrote: > On Tue, Dec 9, 2014, at 21:44, Rustom Mody wrote: > > Nice example -- thanks. > > Elaborates the why of this gotcha -- a def(inition) is imperative. > > From a semantic pov very clean. > &

Re: When do default parameters get their values set?

2014-12-10 Thread Rustom Mody
On Thursday, December 11, 2014 8:05:13 AM UTC+5:30, Chris Angelico wrote: > On Thu, Dec 11, 2014 at 1:18 PM, Rustom Mody wrote: > > But I have a different question -- can this be demonstrated without the > > 'is'? > > Because to me 'is' -- equiv

Re: When do default parameters get their values set?

2014-12-10 Thread Rustom Mody
On Thursday, December 11, 2014 8:45:22 AM UTC+5:30, Steven D'Aprano wrote: > On Wed, 10 Dec 2014 18:18:44 -0800, Rustom Mody wrote: > > > > And going the other way -- no defs only lambdas its this: > > > > > >>>> f = lambda : (lambda x= {}:

regex tool in the python source tree

2014-12-19 Thread Rustom Mody
I remember seeing here (couple of weeks ago??) a mention of a regex debugging/editing tool hidden away in the python source tree. Does someone remember the name/path? There are of course dozens of online ones... Looking for a python native tool -- https://mail.python.org/mailman/listinfo/python

Re: regex tool in the python source tree

2014-12-19 Thread Rustom Mody
On Saturday, December 20, 2014 12:01:10 PM UTC+5:30, Rustom Mody wrote: > I remember seeing here (couple of weeks ago??) a mention of a regex > debugging/editing tool hidden away in the python source tree. > > Does someone remember the name/path? > > There are of course doz

Re: Hello World

2014-12-20 Thread Rustom Mody
On Saturday, December 20, 2014 6:27:19 PM UTC+5:30, Steven D'Aprano wrote: > Taken from Ben Kurtovic's blog: > > http://benkurtovic.com/2014/06/01/obfuscating-hello-world.html > > > > (lambda _, __, ___, , _, __, ___, : > getattr( > __import__(True.__class__.

Re: Hello World

2014-12-21 Thread Rustom Mody
On Monday, December 22, 2014 4:21:13 AM UTC+5:30, Steven D'Aprano wrote: > > Awww, did da widdle puddy tat get up on the wrong side of the bed this > morning? :-) > > > Obviously you don't write obfuscated code like this for production use, > except in such cases where you deliberately want to w

Re: very weird pandas behavior

2014-12-21 Thread Rustom Mody
On Monday, December 22, 2014 7:55:50 AM UTC+5:30, ryguy7272 wrote: > Sorry, but that's what drives me nuts. I install a few packages, and the > messages that I get says the package is installed...then it says it's NOT > installed...I don't know what to think... Its nice to bang the head agains

Re: code python

2014-12-21 Thread Rustom Mody
On Saturday, December 20, 2014 7:30:20 AM UTC+5:30, Khetam Yassen wrote: > Hello all > I Have problem about , How i can compute accuracy to unigram,bigram and > trigram > and how i can change the size to iteration separate from 1 to 10 in each > stage from iteration train take 90% and training 10

Re: List Comprehensions

2014-12-22 Thread Rustom Mody
On Monday, December 22, 2014 6:52:12 PM UTC+5:30, Chris Angelico wrote: > On Tue, Dec 23, 2014 at 12:07 AM, Roy Smith wrote: > > def init_thread(opt): > >opt['result'] = Queue.Queue() > >thread = pause.Thread(opt) > >thread.start() > >return thread > > > > threads = [init_thread(opt

Re: List Comprehensions

2014-12-22 Thread Rustom Mody
On Monday, December 22, 2014 8:37:50 PM UTC+5:30, Chris Angelico wrote: > On Tue, Dec 23, 2014 at 1:58 AM, Rustom Mody wrote: > > If you consider side-effecting comprehensions as kosher, > > then a next conclusion is naturally going to be that > > multiple generator compreh

Re: Hello World

2014-12-22 Thread Rustom Mody
On Monday, December 22, 2014 3:04:52 PM UTC+5:30, Marko Rauhamaa wrote: > Steven D'Aprano : > > > Steve Hayes wrote: > >> But what if I had run it and it reformatted my hard disk? > >> > >> How would I have known that it would or wouldn't do that? > > > > That's why I didn't run it myself :-) >

Re: OFF TOPIC Snow Crash [was Re: Hello World]

2014-12-23 Thread Rustom Mody
On Tuesday, December 23, 2014 9:50:22 PM UTC+5:30, Grant Edwards wrote: > > And even _with_ all the technical jibber-jabber, none of it explained > or justified the whole "writing a virus to infect the brain through > the optic nerve" thing which might just have well been magick and > witches. Yo

Re: what is wrong with d.clear()?

2014-12-24 Thread Rustom Mody
On Tuesday, December 23, 2014 6:30:30 PM UTC+5:30, shawool wrote: > Thank you for answering my query. > > Fonts and colors are reset to defaults now. Sorry for the inconvenience > caused. > > Regards, > Shawool Sorry for the peevishness Are you using gmail? If so when you compose a message The

Re: what is wrong with d.clear()?

2014-12-24 Thread Rustom Mody
On Wednesday, December 24, 2014 8:53:54 PM UTC+5:30, shawool wrote: > I was unable to find an option to disable HTML mode. > Thanks for letting me know how to enable plain text mode. > I just followed the steps and hopefully this message is in plain text format. Your headers show Content-Type: t

Re: learning to use iterators

2014-12-24 Thread Rustom Mody
On Wednesday, December 24, 2014 8:42:32 PM UTC+5:30, Vito De Tullio wrote: > Seb wrote: > > def n_grams(a, n): > > ... z = (islice(a, i, None) for i in range(n)) > > ... return zip(*z) > > ... > > > > I'm impressed at how succinctly this islice helps to build a list of > > tuples wit

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Rustom Mody
On Friday, January 2, 2015 10:45:17 PM UTC+5:30, Rick Johnson wrote: > On Friday, January 2, 2015 8:01:50 AM UTC-6, Chris Angelico wrote: > > I'm not sure that I'd want to. Handling case insensitivity is fine > > when you're restricting everything to ASCII, but it's rather harder > > when you allow

Re: Help with finding tutors for Python, Linux, R, Perl, Octave, MATLAB and/or Cytoscape for yeast microarray analysis, next generation sequencing and constructing gene interaction networks

2015-01-03 Thread Rustom Mody
On Sunday, January 4, 2015 8:45:08 AM UTC+5:30, thomas hahn wrote: > > > > > Help with finding tutors > for Python, Linux, R, Perl, Octave, MATLAB and/or Cytoscape for yeast > microarray > analysis, next generation sequencing and constructing gene interaction > networks Hi Thomas This is a

Can numpy do better than this?

2015-01-08 Thread Rustom Mody
Given a matrix I want to shift the 1st column 0 (ie leave as is) 2nd by one place, 3rd by 2 places etc. This code works. But I wonder if numpy can do it shorter and simpler. - def transpose(mat): return([[l[i] for l in mat]for i in range(0,len(mat[0]))]) def rotate(mat):

Re: Can numpy do better than this?

2015-01-08 Thread Rustom Mody
On Friday, January 9, 2015 at 12:58:52 AM UTC+5:30, Ian wrote: > On Thu, Jan 8, 2015 at 10:56 AM, Rustom Mody wrote: > > Given a matrix I want to shift the 1st column 0 (ie leave as is) > > 2nd by one place, 3rd by 2 places etc. > > > > This code works. > > But I

Re: Can numpy do better than this?

2015-01-08 Thread Rustom Mody
On Friday, January 9, 2015 at 6:43:45 AM UTC+5:30, Rustom Mody wrote: > On Friday, January 9, 2015 at 12:58:52 AM UTC+5:30, Ian wrote: > > On Thu, Jan 8, 2015 at 10:56 AM, Rustom Mody wrote: > > > Given a matrix I want to shift the 1st column 0 (ie leave as is) > > >

Re: Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a)

2015-01-08 Thread Rustom Mody
On Friday, January 9, 2015 at 6:42:18 AM UTC+5:30, Ben Finney wrote: > Steven D'Aprano writes: > > > Is there a good tutorial to learn about pip? > > I'll answer what I think is the correct question: where to learn about > the current best Python packaging practices. In order to attain to full I

Re: Can numpy do better than this?

2015-01-08 Thread Rustom Mody
On Friday, January 9, 2015 at 7:07:26 AM UTC+5:30, Ian wrote: > On Thu, Jan 8, 2015 at 6:13 PM, Rustom Mody wrote: > > With that I came up with the expression > > > > transpose(array([list(roll(mat[:,i],i,0)) for i in range(mat.shape[1])])) > > > > Not exactly

Re: Why do the URLs of posts here change?

2015-01-09 Thread Rustom Mody
On Friday, January 9, 2015 at 4:26:58 PM UTC+5:30, Steven D'Aprano wrote: > I have come across this in the past, but today it annoyed me enough that I'm > asking for an explanation. > > Posts on this newsgroup/mailing list are archived on the web, but the URLs > seem to change, which leaves dead l

Re: Why do the URLs of posts here change?

2015-01-09 Thread Rustom Mody
On Friday, January 9, 2015 at 7:46:42 PM UTC+5:30, Skip Montanaro wrote: > On Fri, Jan 9, 2015 at 8:09 AM, Rustom Mody wrote: > > Theres a new app/service that should solve your problem: > > Its from google... and called groups > It solves one problem (moving archive

Re: Why do the URLs of posts here change?

2015-01-09 Thread Rustom Mody
On Friday, January 9, 2015 at 10:27:53 PM UTC+5:30, Chris Angelico wrote: > On Sat, Jan 10, 2015 at 3:52 AM, Rustom Mody wrote: > > Is it? > > Ok lets test that. > > This is posted from google-groups. > > After posting I shall remove it > > Remove it from GG, mayb

Re: PyWart: Poor Documentation Examples

2015-01-10 Thread Rustom Mody
On Sunday, January 11, 2015 at 8:02:50 AM UTC+5:30, Steven D'Aprano wrote: > Rick Johnson wrote: > > > > > > EXAMPLE 1: "Reducing Comprehension" > > https://docs.python.org/2/howto/doanddont.html#using-the-batteries > >

Re: PyWart: Poor Documentation Examples

2015-01-11 Thread Rustom Mody
On Sunday, January 11, 2015 at 10:56:11 AM UTC+5:30, Devin Jeanpierre wrote: > On Sat, Jan 10, 2015 at 6:32 PM, Steven D'Aprano wrote: > > At the point you are demonstrating reduce(), if the reader doesn't > > understand or can't guess the meaning of "n = 4", "n+1" or range(), they > > won't unders

Re: PyWart: Poor Documentation Examples

2015-01-11 Thread Rustom Mody
On Sunday, January 11, 2015 at 10:49:11 PM UTC+5:30, Chris Angelico wrote: > On Mon, Jan 12, 2015 at 4:11 AM, Michael Torrie wrote: > > The last post by RR helping someone with a tk problem was very helpful, > > and rather elucidating, as are most of his post on tk. ... > > Now perhaps there are

Re: Python 3 regex?

2015-01-14 Thread Rustom Mody
On Tuesday, January 13, 2015 at 10:06:50 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 12 Jan 2015 19:48:18 +, Ian wrote: > > > My recommendation would be to write a recursive decent parser for your > > files. > > > > That way will be easier to write, > > I know that writing parsers is a sol

Re: Python 3 regex?

2015-01-14 Thread Rustom Mody
On Tuesday, January 13, 2015 at 10:06:50 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 12 Jan 2015 19:48:18 +, Ian wrote: > > > My recommendation would be to write a recursive decent parser for your > > files. > > > > That way will be easier to write, > > I know that writing parsers is a sol

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Rustom Mody
On Thursday, January 15, 2015 at 11:25:11 AM UTC+5:30, Yawar Amin wrote: > Hi all, > > First off, to each reader--if you believe that 'multi-line' lambdas are > no good and we can just use functions, decorators, &c. to accomplish > everything in Python, advance warning: this post will annoy you. >

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Rustom Mody
On Friday, January 16, 2015 at 7:48:20 AM UTC+5:30, Yawar Amin wrote: > Hi, > > On Thursday, January 15, 2015 at 12:19:31 PM UTC-5, Rustom Mody wrote: > > [...] > > Looked at your suggestions... > > And then got distracted by your other project > > https://git

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Rustom Mody
On Friday, January 16, 2015 at 8:33:14 AM UTC+5:30, Mark Lawrence wrote: > On 16/01/2015 02:48, Rustom Mody wrote: > > > > The more forks the merrier! > > > > When counting them, or more specifically handles, thou shalt not stop > counting at three, but thou sh

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Rustom Mody
On Friday, January 16, 2015 at 9:46:30 AM UTC+5:30, Steven D'Aprano wrote: > Rustom Mody wrote: > > > Let there be a hundred different versions, then people will > > begin to clamor against the non-necessity of the penury-of-ASCII: > > > > http://blo

Re: Comparisons and sorting of a numeric class....

2015-01-16 Thread Rustom Mody
On Friday, January 16, 2015 at 7:20:13 AM UTC+5:30, Andrew Robinson wrote: Disclaimers 1. Ive not really read the above 542 lines and earlier 2. I am not a fan of OOP Still some thoughts... Electrical engineering (EE) and computer science (CS) may seem related but are quite different disciplin

Re: How to "wow" someone new to Python

2015-01-16 Thread Rustom Mody
On Friday, January 16, 2015 at 8:34:20 PM UTC+5:30, Chris Angelico wrote: > Scenario: You're introducing someone to Python for the first time. > S/he may have some previous programming experience, or may be new to > the whole idea of giving a computer instructions. You have a couple of > minutes to

Re: How to "wow" someone new to Python

2015-01-16 Thread Rustom Mody
On Friday, January 16, 2015 at 10:51:52 PM UTC+5:30, Mirage Web Studio wrote: > On 01/16/2015 08:33 PM, Chris Angelico wrote: > > Scenario: You're introducing someone to Python for the first time. > > S/he may have some previous programming experience, or may be new to > > the whole idea of giving

Re: recursive function: use a global or pass a parameter?

2015-01-16 Thread Rustom Mody
On Friday, January 16, 2015 at 11:26:46 PM UTC+5:30, Chris Angelico wrote: > On Sat, Jan 17, 2015 at 4:49 AM, Tim wrote: > > I want to get a union of all the values that any 'things' key may have, > > even in a nested dictionary (and I do not know beforehand how deep the > > nesting might go): >

Re: Attribute error

2015-01-18 Thread Rustom Mody
On Monday, January 19, 2015 at 5:02:01 AM UTC+5:30, Steven D'Aprano wrote: > Mahendra Prajapati wrote: > > > Hello, > > I'm facing this problem with python class, while practising the python > > programming language.It creates an attribute error. I use windows 7 OS. i > > don't why.I just need to

Re: Random ALL CAPS posts on this group

2015-01-19 Thread Rustom Mody
On Tuesday, January 20, 2015 at 5:52:54 AM UTC+5:30, Chris Angelico wrote: > On Tue, Jan 20, 2015 at 11:15 AM, Luke Tomaneng wrote: > > Has anyone noticed these? There have been about three of them recently and > > they don't seem to have anything to do with Python at all. Does anyone know > > i

Re: Trees

2015-01-20 Thread Rustom Mody
On Tuesday, January 20, 2015 at 11:38:27 AM UTC+5:30, Terry Reedy wrote: > On 1/19/2015 5:06 PM, Zachary Gilmartin wrote: > > Why aren't there trees in the python standard library? > > Sequences nested withing sequences can be regarded as trees, and Python > has these. I regard Lisp as a tree pr

Re: Trees

2015-01-20 Thread Rustom Mody
On Tuesday, January 20, 2015 at 7:03:56 PM UTC+5:30, Rustom Mody wrote: > On Tuesday, January 20, 2015 at 11:38:27 AM UTC+5:30, Terry Reedy wrote: > > On 1/19/2015 5:06 PM, Zachary Gilmartin wrote: > > > Why aren't there trees in the python standard library? > >

Re: Trees

2015-01-20 Thread Rustom Mody
On Tuesday, January 20, 2015 at 7:46:02 PM UTC+5:30, Marko Rauhamaa wrote: > Rustom Mody : > > > Yeah python has trees alright. > > Does Python balance them for you? No Does python support a menagerie of lists like C - singly linked, doubly linked, with header, without head

Re: Trees

2015-01-20 Thread Rustom Mody
On Tuesday, January 20, 2015 at 10:51:13 PM UTC+5:30, Ian wrote: > On Tue, Jan 20, 2015 at 6:33 AM, Rustom Mody wrote: > > from enum import Enum > > class TreeTag(Enum): > > I = 0 # An internal node > > L = 1 # A leaf node > > def __repr__(s

Re: Trees

2015-01-20 Thread Rustom Mody
On Tuesday, January 20, 2015 at 11:46:11 PM UTC+5:30, Rustom Mody wrote: > On Tuesday, January 20, 2015 at 10:51:13 PM UTC+5:30, Ian wrote: > > On Tue, Jan 20, 2015 at 6:33 AM, Rustom Mody wrote: > > > # Converting to generators is trivial > > > =

Re: Trees

2015-01-20 Thread Rustom Mody
On Wednesday, January 21, 2015 at 3:18:03 AM UTC+5:30, Mario wrote: > rustompmody says... > > > > Yeah python has trees alright. > > > > Heres' some simple tree-code > > Didn't you just demonstrate that Python has no trees and instead you > have to implement them yourself (or use a third-party

Re: Trees

2015-01-20 Thread Rustom Mody
On Wednesday, January 21, 2015 at 7:19:39 AM UTC+5:30, Paul Rubin wrote: > Rustom Mody writes: > > ## The depth first algorithm > > dfs (L x) = [x] > > dfs (B x lst rst) = [x] ++ dfs lst ++ dfs rst > > Cute. I can't resist posting the similar breadth first

Re: Trees

2015-01-21 Thread Rustom Mody
On Wednesday, January 21, 2015 at 1:27:39 PM UTC+5:30, Stephen Hansen wrote: > On Tue, Jan 20, 2015 at 1:45 AM, Marko Rauhamaa wrote: > Terry Reedy : > > > > > Others have answered as to why other special-purpose > > > constrained-structure trees have not been added to the stdlib. > > > > O

Re: Trees

2015-01-21 Thread Rustom Mody
On Wednesday, January 21, 2015 at 6:06:06 PM UTC+5:30, Chris Angelico wrote: > On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote: > > I would like a set to be {1,2,3} or at worst ⦃1,2,3⦄ > > and a bag to be ⟅1,2,3⟆ > > > > Apart from the unicode niceness that

Re: Trees

2015-01-21 Thread Rustom Mody
On Thursday, January 22, 2015 at 3:57:50 AM UTC+5:30, Paul Rubin wrote: > Rustom Mody writes: > > Thats not bfs. That's inorder traversal > > Oops, you're right. How's this: > > bfs x = go [x] where > go [] = [] > go (L x:ts) = x:go ts >

Re: Trees

2015-01-21 Thread Rustom Mody
On Thursday, January 22, 2015 at 4:25:03 AM UTC+5:30, Ian wrote: > On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote: > > The Haskell is bullseye¹ in capturing the essense of a tree because > > conceptually a tree of type t is recursive in the sense that it can contain > > 2

Re: Trees

2015-01-22 Thread Rustom Mody
On Thursday, January 22, 2015 at 12:46:22 PM UTC+5:30, Paul Rubin wrote: > Ian Kelly writes: > > How do you create a tree containing an even number of elements under > > this constraint? > > That's a good point, I've usually seen different definitions of trees, > e.g. > >data Tree a = Leaf |

Re: Python is DOOMED! Again!

2015-01-22 Thread Rustom Mody
On Friday, January 23, 2015 at 2:55:38 AM UTC+5:30, Ian wrote: > On Thu, Jan 22, 2015 at 7:16 AM, Steven D'Aprano wrote: > >> Meanwhile, there's the strange decision to implement type hints for > >> local variables # comment lines. I have an hard time wrapping my head > >> around this one. Really,

Re: Python is DOOMED! Again!

2015-01-22 Thread Rustom Mody
On Friday, January 23, 2015 at 3:50:38 AM UTC+5:30, Ian wrote: > On Thu, Jan 22, 2015 at 3:08 PM, Ian Kelly wrote: > > On Thu, Jan 22, 2015 at 2:56 PM, Emile van Sebille wrote: > >> I've been lightly scanning and following the PEP 484 discussion, and one > >> point I don't think I've seen mention

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-22 Thread Rustom Mody
On Friday, January 23, 2015 at 6:45:39 AM UTC+5:30, Rick Johnson wrote: > Note: This is the closest you're going to get to a PEP from me! > > Okay, i have found a solution to the type hinting problem > that will appease both sides. On one side we have those who > are proposing type hinting anno

Re: Python is DOOMED! Again!

2015-01-22 Thread Rustom Mody
On Friday, January 23, 2015 at 9:23:11 AM UTC+5:30, Chris Angelico wrote: > On Fri, Jan 23, 2015 at 2:11 PM, Rustom Mody wrote: > > 1. [1,2,3] + [4,5,6] > > uses the same symbol for an unrelated operation > > 1 + 4 > > They're not unrelated operations. Maybe in the

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 5:18:32 PM UTC+5:30, Andrew Robinson wrote: > On 01/15/2015 09:05 AM, Ian Kelly wrote: > > On Thu, Jan 15, 2015 at 12:23 AM, Andrew Robinson wrote: > >> Can you name any other language that *does* allow subclassing of > >> booleans or creation of new boolean values? >

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 10:22:06 PM UTC+5:30, Ian wrote: > On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote: > > Can you tell me what of the following code does not satisfy your > > requirements? > > [Needs python 3.4] > > > > > >>>>

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 10:22:06 PM UTC+5:30, Ian wrote: > On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote: > > Can you tell me what of the following code does not satisfy your > > requirements? > > [Needs python 3.4] > > > > > >>>>

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 10:54:06 PM UTC+5:30, Chris Angelico wrote: > On Sat, Jan 24, 2015 at 4:03 AM, Rustom Mody wrote: > > The only workaround I have been able to come up with is: > > > > class B4(IntEnum): > >> F1 = 0 > >> F2 = &

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 11:07:48 PM UTC+5:30, Chris Angelico wrote: > On Sat, Jan 24, 2015 at 4:22 AM, Rustom Mody wrote: > > Strikes me that making enumerations is-equal rather than just > > =-equal is a bit heavy-handed and unnecessary > > What do you think? &g

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 11:35:49 PM UTC+5:30, Ian wrote: > On Fri, Jan 23, 2015 at 10:03 AM, Rustom Mody wrote: > > On Friday, January 23, 2015 at 10:22:06 PM UTC+5:30, Ian wrote: > >> On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote: > >> > Can you tell me w

Re: Comparisons and sorting of a numeric class....

2015-01-23 Thread Rustom Mody
On Friday, January 23, 2015 at 11:35:49 PM UTC+5:30, Ian wrote: > On Fri, Jan 23, 2015 at 10:03 AM, Rustom Mody wrote: > > On Friday, January 23, 2015 at 10:22:06 PM UTC+5:30, Ian wrote: > >> On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody wrote: > >> > Can you tell

Re: kivy secret of mana game

2015-01-23 Thread Rustom Mody
On Thursday, January 22, 2015 at 10:43:30 PM UTC+5:30, Automn wrote: > Hello, > > I am programming a "Secret of Mana" (Seiken Densetsu) game in kivy, it runs > on a phone with kivy launcher. > > Features for now are : movement by swiping, polygon collision and image state > changes with resource

Re: kivy secret of mana game

2015-01-23 Thread Rustom Mody
On Saturday, January 24, 2015 at 9:36:56 AM UTC+5:30, Rustom Mody wrote: > On Thursday, January 22, 2015 at 10:43:30 PM UTC+5:30, Automn wrote: > > Hello, > > > > I am programming a "Secret of Mana" (Seiken Densetsu) game in kivy, it runs > > on a phone with

Re: Python is DOOMED! Again!

2015-01-24 Thread Rustom Mody
On Sunday, January 25, 2015 at 12:15:28 AM UTC+5:30, Tim Chase wrote: > On 2015-01-25 04:31, Steven D'Aprano wrote: > > Of course we don't have $1/3 dollar coins, but I do have a pair of > > tin-snips and can easily cut a $1 coin into three equal pieces. > > I'm impressed that you can use tin-snip

Re: Hello World in Python

2015-01-24 Thread Rustom Mody
On Sunday, January 25, 2015 at 5:36:02 AM UTC+5:30, Chris Angelico wrote: > One thing that I really like doing with my Python students (full > disclosure: I'm a mentor with www.thinkful.com and am thus at times > paid to help people learn Python) is some form of screen-sharing, so I > can watch hi

Re: Idiomatic backtracking in Python

2015-01-25 Thread Rustom Mody
On Monday, January 26, 2015 at 2:21:34 AM UTC+5:30, Ian Foote wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I think a very idiomatic way to implement backtracking is using a > recursive generator (python 3): > > def backtrack_solver(data=None): > if data is None: >

Re: Idiomatic backtracking in Python

2015-01-25 Thread Rustom Mody
On Monday, January 26, 2015 at 12:52:04 PM UTC+5:30, Jussi Piitulainen wrote: > Rustom Mody writes: > > > To add to Ian: > > > > The classic way of doing it in a functional framework is called: > > "Replace failure by list of successes" > > &

Re: Is there a more elegant way to spell this?

2015-01-27 Thread Rustom Mody
On Tuesday, January 27, 2015 at 6:45:41 PM UTC+5:30, Neal Becker wrote: > Is there a more elegant way to spell this? > > for x in [_ for _ in seq if some_predicate]: Depends on what follows the ':' In the trivial case all thats outside the comprehension can be dropped: >>> [x for x in [y for y

kivy: python on android

2015-01-27 Thread Rustom Mody
Following some posts here I thought I'd try python on android via kivy. Followed the tutorials -- involved a couple of GBs(!!) of downloads using something called buildozer Finally got a hello world running on a phone -- Yay! Now when I try to go from hello world to something a more (kivy-exampl

Re: An object is an instance (or not)?

2015-01-27 Thread Rustom Mody
On Wednesday, January 28, 2015 at 1:42:47 AM UTC+5:30, Mario Figueiredo wrote: > This is a follow up from a previous discussion in which it is argued > that the following code produces the correct error message terminology, > considering that in Python an object is also an instance. > > >>>

Re: An object is an instance (or not)?

2015-01-27 Thread Rustom Mody
On Wednesday, January 28, 2015 at 7:55:12 AM UTC+5:30, Ned Batchelder wrote: > On 1/27/15 7:17 PM, Mario Figueiredo wrote: > > Ned Batchelder says... > >> > >> A common mistake is to believe that "OOP" is a well-defined term. It's > >> not it's a collection of ideas that are expressed slightly dif

Re: An object is an instance (or not)?

2015-01-27 Thread Rustom Mody
On Wednesday, January 28, 2015 at 10:18:07 AM UTC+5:30, alex23 wrote: > On 28/01/2015 10:24 AM, Mario Figueiredo wrote: > > In other words, the object know as "Sub class" is not an instance > > object. True, it is an instance of the object 'type'. > > >>> class Foo: > ... pass >

Re: An object is an instance (or not)?

2015-01-27 Thread Rustom Mody
On Wednesday, January 28, 2015 at 10:55:32 AM UTC+5:30, Marko Rauhamaa wrote: > Python itself has answers to your questions: > >>>> isinstance(3, int) >True >>>> isinstance("3", int) >False >>>> isinstance(int, type) >True >>>> isinstance(type, int) >False >>>>

Re: An object is an instance (or not)?

2015-01-27 Thread Rustom Mody
On Wednesday, January 28, 2015 at 11:31:46 AM UTC+5:30, random wrote: > On Wed, Jan 28, 2015, at 00:43, Devin Jeanpierre wrote: > > On Tue, Jan 27, 2015 at 9:37 PM, random832 wrote: > > > Sub itself is not a Sub object, it is a type object. "instance" is > > > implicit in the phrase "foo object".

Re: An object is an instance (or not)?

2015-01-28 Thread Rustom Mody
On Wednesday, January 28, 2015 at 10:39:34 PM UTC+5:30, rand...@fastmail.us wrote: > On Wed, Jan 28, 2015, at 01:59, Ben Finney wrote: > > You have no justification to claim that, and it's hostile and dismissive > > to claim it so assertively. > > Sorry about that - I was tired and had just read

Re: [OT] fortran lib which provide python like data type

2015-01-29 Thread Rustom Mody
On Friday, January 30, 2015 at 4:09:19 AM UTC+5:30, beli...@aol.com wrote: > On Thursday, January 29, 2015 at 10:01:00 AM UTC-5, Liu Zhenhai wrote: > > Hi, > > I am not sure here is the right place to ask this question, but I want to > > give it a shot:) > > are there fortran libs providing python

Re: Sort of Augmented Reality

2015-01-29 Thread Rustom Mody
On Friday, January 30, 2015 at 7:52:58 AM UTC+5:30, Dennis Lee Bieber wrote: > On Thu, 29 Jan 2015 14:38:20 +0100, franssoa > declaimed the following: > > >Hello, > > > >(please excuse my english as is not my primary language) > > > >- I own a webcam that take a picture of outside of my house once

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 1:03:03 PM UTC+5:30, Christian Gollwitzer wrote: > Am 30.01.15 um 02:40 schrieb Rustom Mody: > > FORTRAN > > > > use dictionary > > type(dictionary), pointer :: d > > d=>dict_new() > > call set(d//'toto',1) &g

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 10:39:12 PM UTC+5:30, Michael Torrie wrote: > On 01/30/2015 09:27 AM, Rustom Mody wrote: > > ... if I restate that in other words it says that sufficiently > > complex data structures will be beyond the reach of the standard > > RAII infras

RAII vs gc (was fortran lib which provide python like data type)

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 11:01:50 PM UTC+5:30, Rustom Mody wrote: > On Friday, January 30, 2015 at 10:39:12 PM UTC+5:30, Michael Torrie wrote: > > On 01/30/2015 09:27 AM, Rustom Mody wrote: > > > ... if I restate that in other words it says that sufficiently > > &

Re: [OT] fortran lib which provide python like data type

2015-01-31 Thread Rustom Mody
On Saturday, January 31, 2015 at 5:52:58 PM UTC+5:30, Marko Rauhamaa wrote: > Esthetically, I'm most impressed with Scheme. One day it might give > Python a run for its money. > > > Marko Aren't you getting this backwards? http://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to

<    3   4   5   6   7   8   9   10   11   12   >