Re: Recursive problem

2014-02-12 Thread Jussi Piitulainen
ahmed writes: > So we had to do a project for our python class and we came across a > recursive problem. The code we had to write was as follows: > > T(n) > if n == 1 > return 1 > else > for any number(k) between 1 and n - 1 > 2 * T(n-k) + 2^i - 1 > > from this we need to get the minimum number

Recursive problem

2014-02-12 Thread ahmed
So we had to do a project for our python class and we came across a recursive problem. The code we had to write was as follows: T(n) if n == 1 return 1 else for any number(k) between 1 and n - 1 2 * T(n-k) + 2^i - 1 from this we need to get the minimum number which would be produced depending o

Re: Top posting and double spacing

2014-02-12 Thread Sivaram Neelakantan
On Thu, Feb 13 2014,Rustom Mody wrote: [snipped 11 lines] > What we need is something like the following self-policing rules: > > - First couple of answers, say nothing about etiquette/norms > - Then start putting a gentle footnote indicating the issue along with the > answer > - If the problem

Re: Python programming

2014-02-12 Thread Dan Sommers
On Wed, 12 Feb 2014 22:56:56 -0500, William Ray Wing wrote: > OK, and how many of you remember the original version of the > tongue-in-cheek essay "Real Programmers Don't Use Pascal" from the > back page of Datamation? And the April issue of Compubyte (or something like that) with a cover showing

Re: singleton ... again

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 3:24 PM, Steven D'Aprano wrote: > Of course it can happen by accident. It's happened to me, where I've > accidentally called NoneType() (which raises, rather than returning a new > instance). It does in 2.7, yes, but not in 3.4: >>> type(None)() is None True Definitely p

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 3:11 PM, Steven D'Aprano wrote: > Think about the difference in difficulty in confirming that > math.sin() of some value x returns the value 0.5, and confirming that > random.random() of some hidden state returns a specific value: > > py> assert math.sin(0.5235987755982989)

Re: singleton ... again

2014-02-12 Thread Steven D'Aprano
On Thu, 13 Feb 2014 14:07:55 +1100, Ben Finney wrote: > Steven D'Aprano writes: > >> On Wed, 12 Feb 2014 23:04:32 +1300, Gregory Ewing wrote: >> > If you really want to make sure nobody creates another instance by >> > accident, delete the class out of the namespace after instantiating >> > it.

Re: Working with the set of real numbers

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 2:31 PM, Steven D'Aprano wrote: > "The former South African apartheid government did not respect the > Universal Human Rights of blacks." > > Under your strict interpretation, we would have to say that even a single > example of the apartheid government respecting even a si

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-12 Thread Steven D'Aprano
On Tue, 11 Feb 2014 07:36:34 -0800, Travis Griggs wrote: > On Feb 10, 2014, at 10:30 PM, Steven D'Aprano > wrote: > > >>>1. Parenthesis should not be required for parameter- less >>>functions. >> >> Of course they should. Firstly, parameter-less functions are a code- >> smell, and ough

Re: Python programming

2014-02-12 Thread William Ray Wing
On Feb 12, 2014, at 10:04 PM, Roy Smith wrote: > In article , > Grant Edwards wrote: > >> On 2014-02-13, Dennis Lee Bieber wrote: >> >>> An S-100 wire-wrap board. >> >> Yup, been there done that! > > Never did S-100, but I did do a custom Unibus card (wirewrap). > > You know you're wor

Re: Wait... WHAT?

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 2:29 PM, Tim Chase wrote: > My original point (though > perhaps not conveyed as well as I'd intended) was that only bytes get > written to the disk, and that some encoding must take place. It can > be done implicitly using some defaults which may break (as demoed), > where

Re: Working with the set of real numbers

2014-02-12 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 12 Feb 2014 21:07:04 +1100, Ben Finney wrote: > > > You've done it again: by saying that “computers *do not* work with > > real numbers”, that if I find a real number – e.g. the number 4 – > > your position is that, since it's a real number, computers don't > > w

Re: Working with the set of real numbers

2014-02-12 Thread Steven D'Aprano
On Wed, 12 Feb 2014 21:07:04 +1100, Ben Finney wrote: > Chris Angelico writes: > >> On Wed, Feb 12, 2014 at 7:56 PM, Ben Finney >> wrote: >> > So, if I understand you right, you want to say that you've not found >> > a computer that works with the *complete* set of real numbers. Yes? >> >> Corr

Re: Wait... WHAT?

2014-02-12 Thread Tim Chase
On 2014-02-13 00:59, Mark Lawrence wrote: > s = "\u3141" # HANGUL LETTER MIEUM > f = open('test.txt', 'w') > f.write("\u3141") > > Traceback (most recent call last): > >File "", line 1, in > > UnicodeEncodeError: 'ascii' codec can't encode character '\u3141' > > in position 0:

Re: Python programming

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 2:04 PM, Roy Smith wrote: > You know you're working with a Real Computer (tm) when the +5V power > supply can deliver as much current as an arc welder. That'd run a reasonable number of devices. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-12 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 12 Feb 2014 23:04:32 +1300, Gregory Ewing wrote: > > If you really want to make sure nobody creates another instance by > > accident, delete the class out of the namespace after instantiating > > it. > > That does not work. It is trivial to get the type from an i

Re: Python programming

2014-02-12 Thread Roy Smith
In article , Grant Edwards wrote: > On 2014-02-13, Dennis Lee Bieber wrote: > > > An S-100 wire-wrap board. > > Yup, been there done that! Never did S-100, but I did do a custom Unibus card (wirewrap). You know you're working with a Real Computer (tm) when the +5V power supply can deli

Re: Python programming

2014-02-12 Thread Grant Edwards
On 2014-02-13, Dennis Lee Bieber wrote: > An S-100 wire-wrap board. Yup, been there done that! I had a second-hand, off-the-shelf S-100 Z80 CPU board, a second-hand S-100 memory board with 4KB of DRAM (eight 4Kx1 chips) and 2KB of ROM (eight 256x8 Intel 1702A EPROMS), a home made backplac

Re: singleton ... again

2014-02-12 Thread Steven D'Aprano
On Wed, 12 Feb 2014 23:04:32 +1300, Gregory Ewing wrote: > Roy Smith wrote: >> It looks to me like he's trying to implement a classic Gang of Four >> singleton pattern. > > Which I've never really seen the point of in Python, or any other > language for that matter. Just create one instance of th

Re: Top posting and double spacing

2014-02-12 Thread Rustom Mody
On Wednesday, February 12, 2014 10:41:36 PM UTC+5:30, larry@gmail.com wrote: > My personal rule is that I will give people 1 or 2 chances after they > are asked. If they continue to top post or send double space posts, I > simply ignore everything from them until they get with the program. If >

Re: Top posting and double spacing

2014-02-12 Thread Roy Smith
In article , Larry Martell wrote: > My personal rule is that I will give people 1 or 2 chances after they > are asked. If they continue to top post or send double space posts, I > simply ignore everything from them until they get with the program. If > we all did that maybe they'd get the messag

Re: singleton ... again

2014-02-12 Thread Roy Smith
In article <9785668d-6bea-4382-8a0c-c1258f2e2...@googlegroups.com>, Asaf Las wrote: > On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: > > > > Perhaps if you would state your actual goal, we could judge > > whether this code is an effective way to accomplish > > it. > > Da

Re: How does python know?

2014-02-12 Thread Roy Smith
In article , Tobiah wrote: > I do this: > > a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' > b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' > > print > print id(a) > print id(b) > > > And get this: > > True > 140329184721376 > 140329184721376 > > > This works for longer strings. Does

Re: Working with the set of real numbers

2014-02-12 Thread Rustom Mody
On Thursday, February 13, 2014 2:15:28 AM UTC+5:30, Ian wrote: > On Wed, Feb 12, 2014 at 7:11 AM, Rustom Mody wrote: > > On Wednesday, February 12, 2014 3:37:04 PM UTC+5:30, Ben Finney wrote: > >> Chris Angelico writes: > >> > On Wed, Feb 12, 2014 at 7:56 PM, Ben Finney wrote: > >> > > So, if I u

Re: singleton ... again

2014-02-12 Thread Asaf Las
On Wednesday, February 12, 2014 11:57:02 PM UTC+2, Gregory Ewing wrote: > > If you want to hide the distinction between using > call syntax and just accessing a global, then > export a function that returns the global instance. > > That function can even lazily create the instance > the first tim

Re: singleton ... again

2014-02-12 Thread Asaf Las
On Wednesday, February 12, 2014 11:34:34 PM UTC+2, Ned Batchelder wrote: > Not all patterns are useful. Just because it's been enshrined in the > GoF patterns book doesn't mean that it's good for Python. Yes, i understand up to some extend usefulness of patterns. i did not read the GoF book. ye

Re: Wait... WHAT?

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 11:44 AM, Tim Chase wrote: > Yep: > s = "\u3141" # HANGUL LETTER MIEUM f = open('test.txt', 'w') f.write("\u3141") > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'ascii' codec can't encode character '\u3141' in > position

Re: Top down Python

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 11:26 AM, Cousin Stanley wrote: >> >> 3) Create terminal window with size 64x20 >> (which, IMO, is tiny) >> > > Maybe > > 64 characters x 20 lines Yes, but still tiny. Normal minimum would be 80x25 (maybe 80x24). I like to go a lot larger. When I'm com

Re: singleton ... again

2014-02-12 Thread Asaf Las
On Wednesday, February 12, 2014 8:57:09 PM UTC+2, Mark Lawrence wrote: > > For more data on python patterns search for > python+patterns+Alex+Martelli. He's forgotten more on the subject than > many people on this list will ever know :) > > My fellow Pythonistas, ask not what our language can

Re: Wait... WHAT?

2014-02-12 Thread Mark Lawrence
On 13/02/2014 00:44, Tim Chase wrote: On 2014-02-12 23:36, Mark Lawrence wrote: On 12/02/2014 22:14, Tim Chase wrote: To be pedantic, you can only write *bytes* to files, so you need to serialize your lists (or other objects) to strings and then encode those to bytes; or skip the string and en

Re: Wait... WHAT?

2014-02-12 Thread Tim Chase
On 2014-02-12 23:36, Mark Lawrence wrote: > On 12/02/2014 22:14, Tim Chase wrote: > > > > To be pedantic, you can only write *bytes* to files, so you need > > to serialize your lists (or other objects) to strings and then > > encode those to bytes; or skip the string and encode your > > list/object

Re: Top down Python

2014-02-12 Thread Cousin Stanley
> > 3) Create terminal window with size 64x20 > (which, IMO, is tiny) > Maybe 64 characters x 20 lines -- Stanley C. Kitching Human Being Phoenix, Arizona -- https://mail.python.org/mailman/listinfo/python-list

Re: Wait... WHAT?

2014-02-12 Thread Ian Kelly
On Wed, Feb 12, 2014 at 3:14 PM, Tim Chase wrote: > On 2014-02-12 14:35, Ian Kelly wrote: >> You can't write lists directly to files. You can only write strings >> to files. To write and read a list, you'll need to first serialize >> it and later deserialize it. > > To be pedantic, you can only

Re: [RELEASED] Python 3.4.0 release candidate 1

2014-02-12 Thread Terry Reedy
On 2/12/2014 2:42 PM, Bob Hanson wrote: [32-bit Windows XP-SP2] On Tue, 11 Feb 2014 12:11:49 -0500, Terry Reedy wrote: [problems installing rc1] On 2/11/2014 10:42 AM, Duncan Booth wrote: Does it put any useful messages in logfile.txt? 'error' occurs on 40. most are like the following MS

Re: Wait... WHAT?

2014-02-12 Thread Mark Lawrence
On 12/02/2014 22:14, Tim Chase wrote: To be pedantic, you can only write *bytes* to files, so you need to serialize your lists (or other objects) to strings and then encode those to bytes; or skip the string and encode your list/object directly to bytes. Really? >>> f = open('test.txt', 'w')

Re: Working with the set of real numbers

2014-02-12 Thread Grant Edwards
On 2014-02-12, Gregory Ewing wrote: > Chris Angelico wrote: > >> Of course a computer can work with _some_ real numbers; but only >> some. (An awful lot of them, of course. A ridiculously huge number of >> numbers. More numbers than you could read in a lifetime! While the >> number is extremely la

Re: Combination Function Help

2014-02-12 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > def choices(n, k): > if k == 1: > return n > if n == k: > return 1 > if k == 0: > return 1 > return choices(n - 1, k) + choices(n - 1, k - 1) > > comb = choices(n, k) > print comb > > print ("Total number of ways of c

Re: Combination Function Help

2014-02-12 Thread Mark Lawrence
On 12/02/2014 22:59, kjaku...@gmail.com wrote: def choices(n, k): if k == 1: return n if n == k: return 1 if k == 0: return 1 return choices(n - 1, k) + choices(n - 1, k - 1) comb = choices(n, k) print comb print ("Total number of ways of choosing

Re: Wait... WHAT?

2014-02-12 Thread Grant Edwards
On 2014-02-12, eneskri...@gmail.com wrote: > One to write in the file, and one to read it. And one to bind them all! -- Grant Edwards grant.b.edwardsYow! I'm in direct contact at with many advanced fun

Re: singleton ... again

2014-02-12 Thread Tim Delaney
On 13 February 2014 08:34, Ned Batchelder wrote: > On 2/12/14 12:50 PM, Asaf Las wrote: > >> On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: >> >>> >>> Perhaps if you would state your actual goal, we could judge >>> whether this code is an effective way to accomplish >>>

Top posting and double spacing

2014-02-12 Thread Larry Martell
My personal rule is that I will give people 1 or 2 chances after they are asked. If they continue to top post or send double space posts, I simply ignore everything from them until they get with the program. If we all did that maybe they'd get the message (but probably not). -- https://mail.python

Re: Combination Function Help

2014-02-12 Thread kjakupak
def choices(n, k): if k == 1: return n if n == k: return 1 if k == 0: return 1 return choices(n - 1, k) + choices(n - 1, k - 1) comb = choices(n, k) print comb print ("Total number of ways of choosing %d out of %d courses: " % (n, k)) n = int(input("Number

Re: Python programming

2014-02-12 Thread Tim Delaney
On 13 February 2014 08:02, Tim Delaney wrote: > I received a copy of "The Beginners Computer Handbook: Understanding & > programming the micro" (Judy Tatchell and Bill Bennet, edited by Lisa Watts > - ISBN 0860206947) > I should have noted that the examples were all BASIC (with details for how t

Re: Top down Python

2014-02-12 Thread Gregory Ewing
John Allsup wrote: I'm still minimalist, so I guess we want xmlrpc and a python server, with a bit of javascript in the browser to sort out the drawing end. This now seems way simpler than trying to play with Gtk or Qt. Depends on what you mean by "simpler". You've just mentioned about 3 addi

Re: Working with the set of real numbers

2014-02-12 Thread Dave Angel
Gregory Ewing Wrote in message: > Chris Angelico wrote: >> Sure, but nobody said the text file had to be _stored_ anywhere :) >> Computers are quite capable of working with streams of incoming data >> that are potentially infinite in size. > > However, they *can't* work with arbitrary real numbe

Re: Working with the set of real numbers

2014-02-12 Thread Gregory Ewing
Chris Angelico wrote: Of course a computer can work with _some_ real numbers; but only some. (An awful lot of them, of course. A ridiculously huge number of numbers. More numbers than you could read in a lifetime! While the number is extremely large, it still falls pitifully short of infinity.[1]

Re: Simple Object assignment giving me errors

2014-02-12 Thread Nir
Thank you Jerry. And thank you to the rest of you. You all have been tremendously helpful. PS Chris, next time I will do just that. -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with the set of real numbers

2014-02-12 Thread Gregory Ewing
Chris Angelico wrote: Sure, but nobody said the text file had to be _stored_ anywhere :) Computers are quite capable of working with streams of incoming data that are potentially infinite in size. However, they *can't* work with arbitrary real numbers in an exact way, even if they are represent

Re: Wait... WHAT?

2014-02-12 Thread Tim Chase
On 2014-02-12 14:35, Ian Kelly wrote: > You can't write lists directly to files. You can only write strings > to files. To write and read a list, you'll need to first serialize > it and later deserialize it. To be pedantic, you can only write *bytes* to files, so you need to serialize your list

Re: Working with the set of real numbers

2014-02-12 Thread Gregory Ewing
Ben Finney wrote: That's why I think you need to be clear that your point isn't “computers don't work with real numbers”, but rather “computers work only with a limited subset of real numbers”. They actually work with a subset of *rational* numbers. All floats representable by a computer are ra

Re: Simple Object assignment giving me errors

2014-02-12 Thread Jerry Hill
On Wed, Feb 12, 2014 at 4:42 PM, Nir wrote: > If this makes sense to you, great. I am trying to break it down so that I can > make sense of it. As you mentioned self["name"] = filename doesn't work > unless I built a class to handle it. I guess my question then, is how is the > class handling i

Re: singleton ... again

2014-02-12 Thread Michael Torrie
On 02/11/2014 09:34 PM, Asaf Las wrote: > playing a bit with subject. > > pros and cons of this approach? did i create bicycle again? :-) I always thought sticking an object in a module is the simplest form of singleton. -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-12 Thread Gregory Ewing
Asaf Las wrote: There is another one. Once object passes through singletonizator there wont be any other object than first one. Then object constructor can freely be used in every place of code. You're still making things far more complicated than they need to be. *Why* do you want to be a

Re: How does python know?

2014-02-12 Thread Dave Angel
Tobiah Wrote in message: > On 02/12/2014 12:17 PM, Tobiah wrote: >> I do this: >> >> a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' >> b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' >> >> print >> print id(a) >> print id(b) >> >> >> And get this: >> >> True >> 140329184721376 >> 1403291847213

Re: Simple Object assignment giving me errors

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 8:42 AM, Nir wrote: > Also, UserDict is a built in module. I just typed it out so as to give > reference or any clue as to why I cant instantiate jeez. Recommendation for next time: Don't type it out, copy and paste it. Show the actual code you ran, and the actual error m

Re: Simple Object assignment giving me errors

2014-02-12 Thread Nir
Those two classes are from this code here(pasted below). Quite frankly, I don't understand this code. Also, UserDict is a built in module. I just typed it out so as to give reference or any clue as to why I cant instantiate jeez.

Re: Wait... WHAT?

2014-02-12 Thread Michael Torrie
On 02/12/2014 01:21 PM, eneskri...@gmail.com wrote: > I think of it as a bit strange. Should I report it as a bug? I was trying to incorporate a save/load, and this happened. What happened? I'm not seeing any exception information. I do see code that doesn't quite make sense. > def save():

Re:Simple Object assignment giving me errors

2014-02-12 Thread Dave Angel
Nir Wrote in message: > This is from the book 'dive into python'. I am trying to define jeez as being > an instance of FileInfo. > > class UserDict(object): > def __init__(self, dict = None): > self.data = {} > if dict is not None: self.update(dict) > > class

Re: Wait... WHAT?

2014-02-12 Thread Ian Kelly
On Wed, Feb 12, 2014 at 1:21 PM, wrote: > I think of it as a bit strange. Should I report it as a bug? I was trying to > incorporate a save/load, and this happened. > def save(): > target = open ("save.swroc", 'w') > target.write([counter, loop, number_of_competitors, competi

Re: singleton ... again

2014-02-12 Thread Ned Batchelder
On 2/12/14 12:50 PM, Asaf Las wrote: On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: Perhaps if you would state your actual goal, we could judge whether this code is an effective way to accomplish it. DaveA Thanks! There is no specific goal, i am in process of buildi

Re: Python programming

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 8:02 AM, Tim Delaney wrote: > I received a copy of "The Beginners Computer Handbook: Understanding & > programming the micro" (Judy Tatchell and Bill Bennet, edited by Lisa Watts > - ISBN 0860206947) for Christmas of 1985 (I think - I would have been 11 > years old). As you

Simple Object assignment giving me errors

2014-02-12 Thread Nir
This is from the book 'dive into python'. I am trying to define jeez as being an instance of FileInfo. class UserDict(object): def __init__(self, dict = None): self.data = {} if dict is not None: self.update(dict) class FileInfo(UserDict): def __in

Re: Simple Object assignment giving me errors

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 8:18 AM, Nir wrote: > class FileInfo(UserDict): > def __init__(self, filename=None): > UserDict.__init__(self) > self["name"] = filename > > I get a TypeError: 'FileInfo' object doesn't support item assignment . > > Am I missing somet

Re: Wait... WHAT?

2014-02-12 Thread Mark Lawrence
On 12/02/2014 20:59, eneskri...@gmail.com wrote: I am sorry then. So what's the problem, and if it is a bug, should I report it? Report what, you keep sending us one liners with no context? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our langua

Re: Newcomer Help

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 8:07 AM, Tim Delaney wrote: > On 13 February 2014 02:17, Grant Edwards wrote: >> I've always worked in corporations where the email "culture" is the >> Microsoft-induced "lazy and stupid" style as you describe. And yet >> when I respond with editted quotes and interleaved

Re: Wait... WHAT?

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 7:59 AM, wrote: > I am sorry then. So what's the problem, and if it is a bug, should I report > it? As Mark said, we need a bit of context in your emails. This on its own carries no information. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Newcomer Help

2014-02-12 Thread Tim Delaney
On 13 February 2014 02:17, Grant Edwards wrote: > On 2014-02-12, Ben Finney wrote: > > > >> In other contexts eg corporates, often the culture is the opposite: > >> top-posting with strictly NO trimming. > > > > I've never found a corporation that objects to the sensible > > conversation-style,

Re: How does python know?

2014-02-12 Thread Gary Herron
On 02/12/2014 12:17 PM, Tobiah wrote: I do this: a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' print print id(a) print id(b) And get this: True 140329184721376 140329184721376 This works for longer strings. Does python compare a new stri

Re: [RELEASED] Python 3.4.0 release candidate 1

2014-02-12 Thread Bob Hanson
[32-bit Windows XP-SP2] On Tue, 11 Feb 2014 12:11:49 -0500, Terry Reedy wrote: > [problems installing rc1] > > On 2/11/2014 10:42 AM, Duncan Booth wrote: > > > Does it put any useful messages in logfile.txt? > > 'error' occurs on 40. most are like the following > > MSI (s) (40:08) [11:57:25:973

Re: Python programming

2014-02-12 Thread Tim Delaney
On 13 February 2014 00:55, Larry Martell wrote: > On Tue, Feb 11, 2014 at 7:21 PM, ngangsia akumbo > wrote: > > Please i have a silly question to ask. > > > > How long did it take you to learn how to write programs? > > My entire life. > > I started in 1975 when I was 16 - taught myself BASIC an

Re: Wait... WHAT?

2014-02-12 Thread eneskristo
I am sorry then. So what's the problem, and if it is a bug, should I report it? -- https://mail.python.org/mailman/listinfo/python-list

Re: Wait... WHAT?

2014-02-12 Thread Mark Lawrence
On 12/02/2014 20:43, eneskri...@gmail.com wrote: One to write in the file, and one to read it. Nice to know, but please place this in context. Many people who partake in this group are smart, but we're not mind readers :) -- My fellow Pythonistas, ask not what our language can do for you,

Re: Working with the set of real numbers

2014-02-12 Thread Ian Kelly
On Wed, Feb 12, 2014 at 7:11 AM, Rustom Mody wrote: > On Wednesday, February 12, 2014 3:37:04 PM UTC+5:30, Ben Finney wrote: >> Chris Angelico writes: > >> > On Wed, Feb 12, 2014 at 7:56 PM, Ben Finney wrote: >> > > So, if I understand you right, you want to say that you've not found >> > > a com

Re: Wait... WHAT?

2014-02-12 Thread eneskristo
One to write in the file, and one to read it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Wait... WHAT?

2014-02-12 Thread Mark Lawrence
On 12/02/2014 20:21, eneskri...@gmail.com wrote: I think of it as a bit strange. Should I report it as a bug? I was trying to incorporate a save/load, and this happened. def save(): target = open ("save.swroc", 'w') target.write([counter, loop, number_of_competitors, compe

Re: How does python know?

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 7:17 AM, Tobiah wrote: > This works for longer strings. Does python > compare a new string to every other string > I've made in order to determine whether it > needs to create a new object? No, it doesn't; but when you compile a module (including a simple script like that

Re: How does python know?

2014-02-12 Thread Tobiah
On 02/12/2014 12:17 PM, Tobiah wrote: I do this: a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' print print id(a) print id(b) And get this: True 140329184721376 140329184721376 This works for longer strings. Does python compare a new stri

Re: Wait... WHAT?

2014-02-12 Thread eneskristo
I think of it as a bit strange. Should I report it as a bug? I was trying to incorporate a save/load, and this happened. def save(): target = open ("save.swroc", 'w') target.write([counter, loop, number_of_competitors, competitors]) def load(): target = open("save.

How does python know?

2014-02-12 Thread Tobiah
I do this: a = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' b = 'lasdfjlasdjflaksdjfl;akjsdf;kljasdl;kfjasl' print print id(a) print id(b) And get this: True 140329184721376 140329184721376 This works for longer strings. Does python compare a new string to every other string I've made in o

Re: Wait... WHAT?

2014-02-12 Thread Ian Kelly
On Wed, Feb 12, 2014 at 12:43 PM, wrote: > http://postimg.org/image/rkm9lhj8n/ > > So, I was doing some cx freeze stuff. If you cant understand everything from > the pic, I'll give extra info. Please help me. It would be preferable if you would please copy and paste the exception along with the

Wait... WHAT?

2014-02-12 Thread eneskristo
http://postimg.org/image/rkm9lhj8n/ So, I was doing some cx freeze stuff. If you cant understand everything from the pic, I'll give extra info. Please help me. -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-12 Thread Mark Lawrence
On 12/02/2014 17:50, Asaf Las wrote: On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: Perhaps if you would state your actual goal, we could judge whether this code is an effective way to accomplish it. DaveA Thanks! There is no specific goal, i am in process of buildi

Re: pip3.x error using LIST instead of list

2014-02-12 Thread Pete Forman
Dave Angel writes: > Mark Lawrence Wrote in message: >> >> >> No matter what I try I can't get the subcommands in lower-case when I >> have caps lock on, is there a simple work-around for this as well? :) >> > > You could do what I've done for my own DOS, Windows, and Linux > computers for ye

Re: Flag control variable

2014-02-12 Thread Dave Angel
luke.gee...@gmail.com Wrote in message: > Deleting all the obnoxious doublespaced googlegroups nonsense. .. > > then i keep getting IndexError: list index out of range > anyway to prevent it and just set the value to 0? > My car makes a funny noise. What kind of coat should I wear to the da

Re: pip3.x error using LIST instead of list

2014-02-12 Thread Neil Cerutti
On 2014-02-11, Dave Angel wrote: > Mark Lawrence Wrote in message: >> No matter what I try I can't get the subcommands in lower-case >> when I have caps lock on, is there a simple work-around for >> this as well? :) > > You could do what I've done for my own DOS, Windows, and Linux > computers

Re: Combination Function Help

2014-02-12 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > def choices(n, k): > if k == 1: > return n > if n == k: > return 1 > if k == 0: > return 1 > return choices(n - 1, k) + choices(n - 1, k - 1) > print ("Total number of ways of choosing %d out of %d courses: " % (n,

Re: Top down Python

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 4:57 AM, Michael Torrie wrote: > It's unclear of what you are really trying to do, though. Doing as you > propose to have a python server communicating with a web front-end is > going to be a lot harder than you think. ... > Some kind of CGI system. Or roll your own with T

Re: singleton ... again

2014-02-12 Thread Asaf Las
mistake, object constructor - to class constructor -- https://mail.python.org/mailman/listinfo/python-list

Re: Top down Python

2014-02-12 Thread Michael Torrie
On 02/12/2014 09:40 AM, John Allsup wrote: > I've realised that the best way to do this is to use a web browser for > the graphical front end: high end graphics are simply not a necessity > here, so one does not need to leave the confines of the browser. Thus > we need a simple server script.

Re: singleton ... again

2014-02-12 Thread Asaf Las
There is another one. Once object passes through singletonizator there wont be any other object than first one. Then object constructor can freely be used in every place of code. Curious if there could be any impact and applicability of this to builtin types. p.s. learned today that object

Re: Newcomer Help

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 2:17 AM, Grant Edwards wrote: > On 2014-02-12, Ben Finney wrote: >> >>> In other contexts eg corporates, often the culture is the opposite: >>> top-posting with strictly NO trimming. >> >> I've never found a corporation that objects to the sensible >> conversation-style, m

Re: singleton ... again

2014-02-12 Thread Asaf Las
On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: > > Perhaps if you would state your actual goal, we could judge > whether this code is an effective way to accomplish > it. > DaveA Thanks! There is no specific goal, i am in process of building pattern knowledge in python b

Re: Working with the set of real numbers

2014-02-12 Thread Chris Angelico
On Thu, Feb 13, 2014 at 1:13 AM, Marko Rauhamaa wrote: > Text files suffer from the same caveat as integers: there's a limit to > how much you can store on the physical computer. Sure, but nobody said the text file had to be _stored_ anywhere :) Computers are quite capable of working with streams

Re: Flag control variable

2014-02-12 Thread luke . geelen
Op woensdag 12 februari 2014 17:10:36 UTC+1 schreef Alain Ketterlin: > luke.gee...@gmail.com writes: > > > > > Can I make it that if > > > C = int(sys.argv[3]) > > > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > > > > C = int(sys.argv[3]) if len(sys.argv) > 3 e

Re: Top down Python

2014-02-12 Thread Ben Finney
John Allsup writes: > Hi, (John, please don't top-post. Instead, retain only the quoted material you're responding to, and interleave your responses after the points like a conversation. See https://en.wikipedia.org/wiki/Posting_style#Interleaved_style>.) > I'm trying to figure out where 'simp

Re: Top down Python

2014-02-12 Thread John Allsup
Hi, I'm trying to figure out where 'simpler' stops and 'too simplistic' begins. That's what I call 'absolute simplicity'. It is a necessity in some areas of learning where even a jot of inefficiency can be costly (consider a superconducting magnet just below the critical frequency with massive

Re: Top down Python

2014-02-12 Thread John Allsup
Hi, Current software development methods make things way more complex than they need to be. I am trying to get an idea for how simple things can be from final product down to low level implementation, hoping to recover the code density miracles that the old school Forthers turned out ages ago.

Re: Top down Python

2014-02-12 Thread Mark Lawrence
On 12/02/2014 16:40, John Allsup wrote: I've realised that the best way to do this is to use a web browser for the graphical front end: high end graphics are simply not a necessity here, so one does not need to leave the confines of the browser. Thus we need a simple server script. I'm still mi

Re: Combination Function Help

2014-02-12 Thread Mark Lawrence
On 12/02/2014 15:56, kjaku...@gmail.com wrote: def choices(n, k): if k == 1: return n if n == k: return 1 if k == 0: return 1 return choices(n - 1, k) + choices(n - 1, k - 1) print ("Total number of ways of choosing %d out of %d courses: " % (n,

Re: Python programming

2014-02-12 Thread Larry Martell
On Wed, Feb 12, 2014 at 9:13 AM, Roy Smith wrote: > In article , > Larry Martell wrote: > >> On Tue, Feb 11, 2014 at 7:21 PM, ngangsia akumbo wrote: >> > Please i have a silly question to ask. >> > >> > How long did it take you to learn how to write programs? >> >> My entire life. >> >> I start

  1   2   >