Re: [Tutor] Understanding Classes

2014-01-20 Thread Christian Alexander
I would first like to state two things, those being that I am a horrible writer as well as explaining things, but Ill try my absolute best. Everything python is an object. Strings, integers, lists, so on and so forth. In regards to classes and their relativity towards objects, I am at complete s

Re: [Tutor] string indexing

2014-01-20 Thread rahmad akbar
Spir and Peter, thanks for the specifics, super helpful. Alan, super thanks for the general advice, you guys are awesome!! On Mon, Jan 20, 2014 at 5:34 AM, wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit

[Tutor] 4.7.5

2014-01-20 Thread Doug and Riekie Dorman
I think I may have found a bug: pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')] Should be: pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key

Re: [Tutor] Understanding Classes

2014-01-20 Thread Alan Gauld
On 20/01/14 00:55, Christian Alexander wrote: I would first like to state two things, those being that I am a horrible writer as well as explaining things, but Ill try my absolute best. Everything python is an object. Strings, integers, lists, so on and so forth. In regards to classes and the

Re: [Tutor] string indexing

2014-01-20 Thread Alan Gauld
On 20/01/14 07:37, rahmad akbar wrote: Spir and Peter, thanks for the specifics, super helpful. Alan, super thanks for the general advice, you guys are awesome!! You are welcome, but please don't post an entire digest just to say thanks. It uses up bandwidth and storage unnecessarily and some

Re: [Tutor] 4.7.5

2014-01-20 Thread Mark Lawrence
On 20/01/2014 01:16, Doug and Riekie Dorman wrote: I think I may have found a bug: pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')] Should be: pairs = [(1, 'one'), (2, '

Re: [Tutor] Python as Teaching Language

2014-01-20 Thread Oscar Benjamin
On Sun, Jan 19, 2014 at 02:18:54PM -0500, Keith Winston wrote: > On Sun, Jan 19, 2014 at 11:55 AM, Alan Gauld > wrote: > > It has reached the point that I'm back to looking for a new teaching > > language. In Python 3 the decision has clearly been made to focus on > > supporting Python's role as

[Tutor] when is "pythondontwritebytecode" useful?

2014-01-20 Thread Albert-Jan Roskam
Hi, When is setting a PYTHONDONTWRITEBYTECODE environment variable useful? Or set sys.dont_write_bytecode to True? Or start Python with the -B option? I know what it does (http://docs.python.org/2/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE), i.e. no pyc or pyo fiules are written, but WH

Re: [Tutor] 4.7.5

2014-01-20 Thread Alan Gauld
On 20/01/14 01:16, Doug and Riekie Dorman wrote: I think I may have found a bug: pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')] Should be: pairs = [(1, 'one'), (2, 'tw

Re: [Tutor] Understanding Classes

2014-01-20 Thread David
On 20 January 2014 20:33, Alan Gauld wrote: > On 20/01/14 00:55, Christian Alexander wrote: >> >> I would first like to state two things, those being that I am a horrible >> writer as well as explaining things, but Ill try my absolute best. >> Everything python is an object. Strings, integers,

Re: [Tutor] when is "pythondontwritebytecode" useful?

2014-01-20 Thread Oscar Benjamin
On Mon, Jan 20, 2014 at 02:42:57AM -0800, Albert-Jan Roskam wrote: > Hi, > > > When is setting a PYTHONDONTWRITEBYTECODE environment variable useful? Or set > sys.dont_write_bytecode to True? Or start Python with the -B option? > I know what it does > (http://docs.python.org/2/using/cmdline.htm

Re: [Tutor] string indexing -- side note, rather OT

2014-01-20 Thread spir
On 01/20/2014 01:19 AM, Keith Winston wrote: On Sun, Jan 19, 2014 at 3:50 PM, Alan Gauld wrote: How would Python know whether you want find for gettext, mmap, str, xml.etree.ElementTree.Element or xml.etree.ElementTree.ElementTree? Absolutely, but a newbie doesn't even guess that more than o

Re: [Tutor] ValueError: could not convert string to float: '13,2'

2014-01-20 Thread Pierre Dagenais
Not very elegant, but it'll work. I don't suppose there is a >> function for determining the number of digits after the decimal, is it? > > It looks like you are trying to avoid rounding errors in decimal arithmetic. > You might be interested in Python's decimal.Decimal type then. That's right,

Re: [Tutor] Understanding Classes

2014-01-20 Thread spir
On 01/19/2014 10:59 PM, Christian Alexander wrote: Hello Tutorians, Looked all over the net for class tutorials Unable to understand the "self" argument Attempting to visual classes I have searched high and low, for easy to follow tutorials regarding classes. Although I grok the general concep

Re: [Tutor] when is "pythondontwritebytecode" useful?

2014-01-20 Thread eryksun
On Mon, Jan 20, 2014 at 5:42 AM, Albert-Jan Roskam wrote: > > When is setting a PYTHONDONTWRITEBYTECODE environment variable useful? Or > set sys.dont_write_bytecode to True? Or start Python with the -B option? > I know what it does > (http://docs.python.org/2/using/cmdline.html#envvar-PYTHONDONTW

[Tutor] how run it on python 3

2014-01-20 Thread S Tareq
this is the coding that i am trying to run it on python 3.3. the original coding was made on python 2.7 however i have made some changes to the coding to make it work on python 3.3. the changes that i have made  on brackets and raw_input to input. the coding does not load the external file ans s

Re: [Tutor] how run it on python 3

2014-01-20 Thread Emile van Sebille
On 1/20/2014 12:51 PM, S Tareq wrote: external file ans says invalid syntax . The full traceback with the invalid syntax message will provide you the specific line where the issue is realized. Note that the actual error my occur elsewhere particularly with mismatched parenthetical expressi

Re: [Tutor] how run it on python 3

2014-01-20 Thread Peter Otten
S Tareq wrote: > this is the coding that i am trying to run it on python 3.3. the original > coding was made on python 2.7 however i have made some changes to the > coding to make it work on python 3.3. the changes that i have made on > brackets and raw_input to input. the coding does not load th

Re: [Tutor] how run it on python 3 (S Tareq)

2014-01-20 Thread Brandon Gardell
Tareq, It'd be nice if you formatted it through upload with gist ( https://gist.github.com/ ) and posted the syntax error you were receiving as well. Then you wouldn't have to put ?s instead of indents, and we'd be able to read it better. I believe this is actually recommended in the mailing list

Re: [Tutor] how run it on python 3

2014-01-20 Thread Danny Yoo
> But you should not translate your scripts by hand -- there's a tool called > 2to3 that does the legwork for you. S Tareq has asked this question just a few days ago. https://mail.python.org/pipermail/tutor/2014-January/099466.html Most of us here have not yet gone entirely senile yet, so

Re: [Tutor] how run it on python 3

2014-01-20 Thread Emile van Sebille
On 1/20/2014 4:05 PM, Danny Yoo wrote: S Tareq has asked this question just a few days ago. https://mail.python.org/pipermail/tutor/2014-January/099466.html Most of us here have not yet gone entirely senile yet, so we still remember. Speak for yourself! The rest of us are rapidly approac

Re: [Tutor] how run it on python 3

2014-01-20 Thread Danny Yoo
>> In that thread, we asked the original questioner why they were having >> difficulty. But S Tareq responded in the way I would expect out of an >> automated answering machine: that is, not at all. This is not >> encouraging: either he or she did not understand the question, or they >> ignored t

Re: [Tutor] how run it on python 3

2014-01-20 Thread Mark Lawrence
On 21/01/2014 00:05, Danny Yoo wrote: But you should not translate your scripts by hand -- there's a tool called 2to3 that does the legwork for you. S Tareq has asked this question just a few days ago. https://mail.python.org/pipermail/tutor/2014-January/099466.html Most of us here have