Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79469 > unrolled thread
| Started by | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| First post | 2014-10-22 16:30 -0400 |
| Last post | 2014-10-25 22:15 +0000 |
| Articles | 20 on this page of 157 — 23 participants |
Back to article view | Back to comp.lang.python
I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 16:30 -0400
Re: I am out of trial and error again Lists Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-22 16:57 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:04 -0400
Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-22 14:35 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:38 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 22:28 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:30 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:32 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 23:55 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:26 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 00:44 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:02 -0400
Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:29 +0100
Re: I am out of trial and error again Lists alex23 <wuwei23@gmail.com> - 2014-10-23 11:37 +1000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:52 -0400
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-22 19:58 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 23:05 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-22 20:16 -0700
Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 02:31 -0400
Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 00:09 +0100
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 00:10 -0700
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 09:23 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:00 -0400
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 20:23 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 09:53 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:15 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:04 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 15:55 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:01 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:07 -0400
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 13:39 -0600
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:15 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:44 -0400
Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 22:03 +0100
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 19:13 -0700
Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 23:14 -0400
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-24 14:32 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 21:56 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:38 -0400
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 01:51 +1100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 11:04 -0400
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 02:13 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 08:56 -0700
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 10:35 -0600
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:10 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 12:37 -0400
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 03:47 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:56 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:03 -0400
Re: I am out of trial and error again Lists "Albert Visser" <albert.visser@gmail.com> - 2014-10-24 19:18 +0200
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:23 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:42 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:42 -0400
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:52 -0600
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:15 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:20 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:40 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:07 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:49 +0000
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:46 -0700
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-25 08:17 -0600
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:47 -0400
Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 11:57 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:09 -0400
Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:25 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:33 -0400
Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:55 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:00 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:19 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 17:35 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:23 +0000
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:37 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:33 +0100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:54 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:04 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:17 -0700
Re: I am out of trial and error again Lists Dave Angel <davea@davea.name> - 2014-10-24 18:09 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:27 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:01 -0700
Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-24 20:27 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:42 -0400
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:05 -0600
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 04:10 +1100
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:04 -0700
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 20:37 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:58 -0400
Re: I am out of trial and error again Lists alister <alister.nospam.ware@ntlworld.com> - 2014-10-24 21:07 +0000
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 15:11 -0600
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:21 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:48 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:14 -0400
Re: I am out of trial and error again Lists Grant Edwards <invalid@invalid.invalid> - 2014-10-25 15:01 +0000
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 20:51 +0000
Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 19:16 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 22:41 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 08:25 +0100
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 15:10 -0400
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:23 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-25 14:42 -0400
Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-25 18:48 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-26 00:25 +0100
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 01:08 -0400
Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-26 17:44 -0400
Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 20:57 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-22 22:43 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:11 -0400
The “trials” in “trial and error” should be as simple as possible (was: I am out of trial and error again Lists) Ben Finney <ben+python@benfinney.id.au> - 2014-10-23 10:59 +1100
Re: I am out of trial and error again Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-23 11:05 +1100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:10 -0400
Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:31 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:35 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:57 -0400
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 08:20 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:01 -0400
Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 01:56 -0600
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 09:09 +0100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 06:42 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:03 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 08:35 -0700
Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:25 +0200
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:29 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 16:00 +0000
Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:40 +0200
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:46 -0400
Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-24 17:56 +0200
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:21 +0000
Re: I am out of trial and error again Lists Tobiah <toby@tobiah.org> - 2014-10-23 07:51 -0700
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 08:05 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:47 -0400
Re: I am out of trial and error again Lists mm0fmf <none@mailinator.com> - 2014-10-24 22:06 +0100
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 09:12 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:48 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:26 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:58 -0400
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:27 -0700
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:57 -0400
Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-25 01:20 +0100
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:37 -0400
Re: I am out of trial and error again Lists Cameron Simpson <cs@zip.com.au> - 2014-10-25 11:52 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 20:46 -0700
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 21:09 -0700
Re: I am out of trial and error again Lists Ben Finney <ben+python@benfinney.id.au> - 2014-10-25 15:25 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:40 -0700
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 16:49 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:55 -0700
Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 17:03 +1100
Re: I am out of trial and error again Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-25 18:44 +1100
Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-25 10:24 -0700
Side-effects [was Re: I am out of trial and error again Lists] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-26 17:12 +1100
Re: Side-effects [was Re: I am out of trial and error again Lists] Chris Angelico <rosuav@gmail.com> - 2014-10-26 17:42 +1100
Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-27 22:26 +0100
Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 00:27 +0100
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:35 +0000
Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:15 -0400
Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 22:15 +0000
Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8 Next page →
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-24 20:42 -0400 |
| Message-ID | <v7sl4apq8t7p8m07jksi5joqp2m7b5of0p@4ax.com> |
| In reply to | #79639 |
On Fri, 24 Oct 2014 20:27:03 -0400, Terry Reedy <tjreedy@udel.edu> wrote: >On 10/24/2014 6:27 PM, Seymore4Head wrote: > >> I promise I am not trying to frustrate anyone. I know I have. > >Seymore, if you want to learn real Python, download and install 3.4.2 >and either use the Idle Shell and Editor or the interactive console >interpreter and a decent programmer editor. > >I cannot recommend CodeSkulptor to anyone. The opening statement ># CodeSkulptor runs Python programs >is deceptive. CodeSkulptor Python is not Python. It does not correspond >to any x.y version of Python. It is a somewhat crippled subset of >ancient Python (2.1) with selected additions of later features. It does >not have exceptions, raise, and try: except:. These are an essential >part of original Python and Python today It does not have complex >(maybe introduced in 1.5) and unicode (introduced in 2.0). Let that >pass. More important, it does not have new-style classes, an essential >new feature introduced in 2.2. Python beginners should start with >unified new-styled classes. If lucky, they need never learn about the >original old style, dis-unified type versus class system that started >going away in 2.2, is mostly gone in 2.7. and completely gone in 3.0. > >If you really want to continue with CodeSkulpter Python, you should find >a CodeSkulpterPython list. You cannot expect people here to know that >legal code like > class I(int): pass >will not run, but will fail with an exceeding cryptic message: > Line 1: undefined: TypeError: a.$d is undefined >Nor can you expect us to know all the other limitations. > >This is a list for Python. If you want help here, get and use a real >Python interpreter, with a proper interactive mode, as multiple people >have suggested. OK. I will. Thanks But the difference between Python 2 and Codeskulptor was not an issue with this question.
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-10-24 11:05 -0600 |
| Subject | Re: I am out of trial and error again Lists |
| Message-ID | <mailman.15136.1414170391.18130.python-list@python.org> |
| In reply to | #79578 |
On Fri, Oct 24, 2014 at 10:37 AM, Seymore4Head <Seymore4Head@hotmail.invalid> wrote: > If I could explain to you why something doesn't work then I could fix > it myself. I don't understand why it doesn't work. The best I can do > is repost the code. You don't need to be able to explain why it doesn't work. You just need to be able to explain what you expected it to do and what it actually did. Posting the code and the traceback that you get is a fine start. > if y in lst(range(1,10)): The name of the builtin is "list". It's a function* that takes an argument and uses it to construct a list, which it returns. "lst" is the name of some specific list that you're using in your code. It's not a function, which is why the error is complaining that it isn't callable. *Actually it's a type object, and calling it causes an instance of the type to be constructed, but for all intents and purposes here it works exactly like a function.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-10-25 04:10 +1100 |
| Subject | Re: I am out of trial and error again Lists |
| Message-ID | <mailman.15137.1414170654.18130.python-list@python.org> |
| In reply to | #79578 |
On Sat, Oct 25, 2014 at 4:05 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> The name of the builtin is "list". It's a function* that takes an
> argument and uses it to construct a list, which it returns.
>
> *Actually it's a type object, and calling it causes an instance of the
> type to be constructed, but for all intents and purposes here it works
> exactly like a function.
It's callable, that's all that matters.
callable(object) -> bool
Return whether the object is callable (i.e., some kind of function).
:)
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Larry Hudson <orgnut@yahoo.com> |
|---|---|
| Date | 2014-10-24 23:04 -0700 |
| Message-ID | <vvOdnfN37_LMoNbJnZ2dnUU7-LudnZ2d@giganews.com> |
| In reply to | #79578 |
On 10/24/2014 09:37 AM, Seymore4Head wrote:
<snip>
> import string
Not needed, delete it.
> def nametonumber(name):
> lst=[]
> nx=[]
> digit=[]
Not needed. You create digit as an empty list, them immediately follow by assigning a string to
it (NOT a _list_ of characters, but an actual string.)
> digit="".join(str(i) for i in range(10))
digit is now the _string_ "0123456789". Actually, a direct assignment here would be easier and
shorter;
digit = "0123456789"
> for x in name:
> lst.append(x)
lst is now a list of the characters in name. That works, but you can do the same thing with:
lst = list(name)
> for y in (lst):
Parentheses not needed.
> if y in lst(range(1,10)):
This is the line the traceback is referring to. lst is a list, but the parentheses tell Python
you are trying to call it as a function. That is what the "TypeError: 'list' object is not
callable" means. Also it seems you are now trying to make a list of the digits 1-9 without the
zero. Is this what you want? I don't think so, but if that IS what you want you can do it
easier with slicing (look it up, VERY useful): (Remember, digit is already a string of the ten
digits, with zero as the first character.)
if y in digit[1:]:
Otherwise if you do want zero included you simply need:
if y in digit:
> #if y in "1234567890":
> #if y.isdigit():
> #if y in digit:
All of those should work, with the zero.
> #if y in string.digits:
Ok (I think?), but the string module is effectively obsolete -- most of its capabilities have
been replaced with newer, better string methods. It is RARELY useful. I have never used it
myself so don't know too much about it. It is definitely not needed here, and is why I
suggested deleting the import.
> nx.append(y)
> ...
-=- Larry -=-
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-10-24 20:37 +0000 |
| Message-ID | <m2edab$mv8$3@dont-email.me> |
| In reply to | #79569 |
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote:
> I tried list(range(10)
This is missing a ")"
It probably sat there waiting for you to finish the line.
list(range(10))
You have two "(" in the line, you need two ")" to match them.
> I thought that would work in Python 3. It
> didn't.
It does if you enter it properly.
also try:
str(list(range(10)))
Note that that has three "(" and three ")" on the line.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-24 16:58 -0400 |
| Message-ID | <n3fl4adbmku0e2bhsbr4hh8go03ujfjafi@4ax.com> |
| In reply to | #79612 |
On Fri, 24 Oct 2014 20:37:31 +0000 (UTC), Denis McMahon
<denismfmcmahon@gmail.com> wrote:
>On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote:
>
>> I tried list(range(10)
>
>This is missing a ")"
>
>It probably sat there waiting for you to finish the line.
>
>list(range(10))
>
>You have two "(" in the line, you need two ")" to match them.
>
>> I thought that would work in Python 3. It
>> didn't.
>
>It does if you enter it properly.
>
>also try:
>
>str(list(range(10)))
>
>Note that that has three "(" and three ")" on the line.
I make lots of typing mistakes. It is not that. Did you see the short
example I posted?
name="123-xyz-abc"
for x in name:
if x in range(10):
print ("Range",(x))
if x in str(range(10)):
print ("String range",(x))
It doesn't throw an error but it doesn't print what you would expect.
[toc] | [prev] | [next] | [standalone]
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Date | 2014-10-24 21:07 +0000 |
| Message-ID | <Jcz2w.781005$AB3.419331@fx07.am4> |
| In reply to | #79614 |
On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote:
> On Fri, 24 Oct 2014 20:37:31 +0000 (UTC), Denis McMahon
> <denismfmcmahon@gmail.com> wrote:
>
>>On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote:
>>
>>> I tried list(range(10)
>>
>>This is missing a ")"
>>
>>It probably sat there waiting for you to finish the line.
>>
>>list(range(10))
>>
>>You have two "(" in the line, you need two ")" to match them.
>>
>>> I thought that would work in Python 3. It didn't.
>>
>>It does if you enter it properly.
>>
>>also try:
>>
>>str(list(range(10)))
>>
>>Note that that has three "(" and three ")" on the line.
>
> I make lots of typing mistakes. It is not that. Did you see the short
> example I posted?
>
> name="123-xyz-abc"
> for x in name:
> if x in range(10):
> print ("Range",(x))
> if x in str(range(10)):
> print ("String range",(x))
>
> It doesn't throw an error but it doesn't print what you would expect.
it prints what "I" expect, it probably does not print what you expect
you have may times been told that str(range(10)) does not do what you
expect but you keep failing to test
you think that it crates a list of strings ['1','2','3'....] but it does
not
it creates a list & then turns the whole list into a string '[1,2,3...]'
people are suggesting you try this things in the interactive prompt
because doing teaches far better than just reading.
--
Honesty's the best policy.
-- Miguel de Cervantes
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-10-24 15:11 -0600 |
| Subject | Re: I am out of trial and error again Lists |
| Message-ID | <mailman.15146.1414185119.18130.python-list@python.org> |
| In reply to | #79614 |
On Fri, Oct 24, 2014 at 2:58 PM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> name="123-xyz-abc"
> for x in name:
> if x in range(10):
> print ("Range",(x))
> if x in str(range(10)):
> print ("String range",(x))
>
> It doesn't throw an error but it doesn't print what you would expect.
That prints exactly what I expect it to. The first if prints nothing,
because you're testing whether a string is contained in a sequence of
ints. That will always be false. The second if prints those characters
from name that happen to be in the string "range(10)". That's the "1"
and the "a".
Apparently it doesn't print what *you* expect, which is why you need
to make your expectation clear and not assume that we will just read
your mind and immediately understand what you expect the code to do.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-10-24 23:21 +0000 |
| Message-ID | <m2emu7$mv8$9@dont-email.me> |
| In reply to | #79614 |
On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote:
> I make lots of typing mistakes. It is not that. Did you see the short
> example I posted?
>
> name="123-xyz-abc"
> for x in name:
> if x in range(10):
> print ("Range",(x))
> if x in str(range(10)):
> print ("String range",(x))
>
> It doesn't throw an error but it doesn't print what you would expect.
It prints exactly what I expect.
Try the following:
print(str(range(10)), type(str(range(10))))
print(str(list(range(10))), type(str(listr(range(10)))))
In python 3, str(x) just wraps x up and puts it in a string. range(x)
generates an iterable range object.
hence str(range(10)) is a string telling you that range(10) is an iterable
range object with certain boundaries.
However, list(iterable) expands the iterable to the full list of possible
values, so str(list(range(10))) is a string representation of the list
containing the values that the iterable range(10) creates.
Note that whether you're looking at a string representation of a value or
the value itself is a lot clearer in the interpreter console where
strings are displayed with quotes.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-24 19:48 -0400 |
| Message-ID | <mapl4ahonttu1u6u31774osnulc5nnos03@4ax.com> |
| In reply to | #79629 |
On Fri, 24 Oct 2014 23:21:43 +0000 (UTC), Denis McMahon
<denismfmcmahon@gmail.com> wrote:
>On Fri, 24 Oct 2014 16:58:00 -0400, Seymore4Head wrote:
>
>> I make lots of typing mistakes. It is not that. Did you see the short
>> example I posted?
>>
>> name="123-xyz-abc"
>> for x in name:
>> if x in range(10):
>> print ("Range",(x))
>> if x in str(range(10)):
>> print ("String range",(x))
>>
>> It doesn't throw an error but it doesn't print what you would expect.
>
>It prints exactly what I expect.
>
>Try the following:
>
>print(str(range(10)), type(str(range(10))))
>print(str(list(range(10))), type(str(listr(range(10)))))
>
>In python 3, str(x) just wraps x up and puts it in a string. range(x)
>generates an iterable range object.
>
>hence str(range(10)) is a string telling you that range(10) is an iterable
>range object with certain boundaries.
>
>However, list(iterable) expands the iterable to the full list of possible
>values, so str(list(range(10))) is a string representation of the list
>containing the values that the iterable range(10) creates.
>
>Note that whether you're looking at a string representation of a value or
>the value itself is a lot clearer in the interpreter console where
>strings are displayed with quotes.
I get it now.
Thanks
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-10-24 21:48 +0000 |
| Message-ID | <m2ehet$mv8$5@dont-email.me> |
| In reply to | #79569 |
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > Thanks everyone for your suggestions. Try loading the following in codeskulptor: http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-24 18:14 -0400 |
| Message-ID | <9ojl4allmth89g1jd8286njq5722ssqen8@4ax.com> |
| In reply to | #79621 |
On Fri, 24 Oct 2014 21:48:14 +0000 (UTC), Denis McMahon <denismfmcmahon@gmail.com> wrote: >On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: > >> Thanks everyone for your suggestions. > >Try loading the following in codeskulptor: > >http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py That is a useful way to test. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2014-10-25 15:01 +0000 |
| Message-ID | <m2ge12$8q6$2@reader1.panix.com> |
| In reply to | #79621 |
On 2014-10-24, Denis McMahon <denismfmcmahon@gmail.com> wrote:
> On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote:
>
>> Thanks everyone for your suggestions.
>
> Try loading the following in codeskulptor:
>
> http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py
No.
We[1] aren't intested in whatever Python-like language is implemented
in codeskulptor.
[1] I know I'm being a bit presumptuous writing the the plural first
person rather than the signular. If you _are_ interested in
codeskulptor "python" then jump in...
--
Grant
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-10-25 20:51 +0000 |
| Message-ID | <m2h2gd$7rd$1@dont-email.me> |
| In reply to | #79671 |
On Sat, 25 Oct 2014 15:01:54 +0000, Grant Edwards wrote: > On 2014-10-24, Denis McMahon <denismfmcmahon@gmail.com> wrote: >> On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head wrote: >> >>> Thanks everyone for your suggestions. >> >> Try loading the following in codeskulptor: >> >> http://www.codeskulptor.org/#user38_j6kGKgeOMr_0.py > No. I wasn't replying to you, I was replying to S4H. > We[1] aren't intested in whatever Python-like language is implemented in > codeskulptor. However S4H may be, and one thing I can be sure is that if I give him a cs url, he will at least be running the exact same python code I typed in the same python environment, and hence I know what results he should see, namely the same ones I saw. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Larry Hudson <orgnut@yahoo.com> |
|---|---|
| Date | 2014-10-24 19:16 -0700 |
| Message-ID | <uf2dnXvlKLRrmtbJnZ2dnUU7-aOdnZ2d@giganews.com> |
| In reply to | #79569 |
On 10/24/2014 07:38 AM, Seymore4Head wrote:
<snip>
> I do get the difference. I don't actually use Python 2. I use
> CodeSkulptor. I do have Python 3 installed. Actually I have Python 2
> installed but IDLE defaults to Python 3. So it is a pain to actually
> load Python 2.
>
Exactly HOW are you trying to run Idle? A default install of Py2 and Py3 in Windows should have
also installed Idle for each version. In my Win7 system, they are BOTH in the standard menu,
you should be able to call up either one.
OT: Side comment: I rarely use Windows these days, maybe once every two or three months -- I
MUCH prefer Linux. Among other reasons its a far better environment for programming. I only
have one (active) system with Windows installed, and two others with Linux only. Actually make
that three, if you count my Raspberry Pi. :-)
-=- Larry -=-
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-24 22:41 -0400 |
| Message-ID | <ke2m4ahg0cvuqhs0rkmnuldcq1l0kllfms@4ax.com> |
| In reply to | #79646 |
On Fri, 24 Oct 2014 19:16:21 -0700, Larry Hudson <orgnut@yahoo.com> wrote: >On 10/24/2014 07:38 AM, Seymore4Head wrote: ><snip> >> I do get the difference. I don't actually use Python 2. I use >> CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 >> installed but IDLE defaults to Python 3. So it is a pain to actually >> load Python 2. >> > >Exactly HOW are you trying to run Idle? A default install of Py2 and Py3 in Windows should have >also installed Idle for each version. In my Win7 system, they are BOTH in the standard menu, >you should be able to call up either one. > >OT: Side comment: I rarely use Windows these days, maybe once every two or three months -- I >MUCH prefer Linux. Among other reasons its a far better environment for programming. I only >have one (active) system with Windows installed, and two others with Linux only. Actually make >that three, if you count my Raspberry Pi. :-) > > -=- Larry -=- I have a directory of my py files. I right click on one of the py files and "open with IDLE" Windows XP If I try to open a py file I have for Python 2 it still opens using IDLE 3. I don't have many py 2 files anyway.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-10-25 08:25 +0100 |
| Message-ID | <mailman.15160.1414221945.18130.python-list@python.org> |
| In reply to | #79647 |
On 25/10/2014 03:41, Seymore4Head wrote: > On Fri, 24 Oct 2014 19:16:21 -0700, Larry Hudson <orgnut@yahoo.com> > wrote: > >> On 10/24/2014 07:38 AM, Seymore4Head wrote: >> <snip> >>> I do get the difference. I don't actually use Python 2. I use >>> CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 >>> installed but IDLE defaults to Python 3. So it is a pain to actually >>> load Python 2. >>> >> >> Exactly HOW are you trying to run Idle? A default install of Py2 and Py3 in Windows should have >> also installed Idle for each version. In my Win7 system, they are BOTH in the standard menu, >> you should be able to call up either one. >> >> OT: Side comment: I rarely use Windows these days, maybe once every two or three months -- I >> MUCH prefer Linux. Among other reasons its a far better environment for programming. I only >> have one (active) system with Windows installed, and two others with Linux only. Actually make >> that three, if you count my Raspberry Pi. :-) >> >> -=- Larry -=- > I have a directory of my py files. I right click on one of the py > files and "open with IDLE" Windows XP > > If I try to open a py file I have for Python 2 it still opens using > IDLE 3. > > I don't have many py 2 files anyway. > How about running your Python 2 version of IDLE and opening your files using File->Open or CTRL-O? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-10-25 15:10 -0400 |
| Message-ID | <mailman.15172.1414264263.18130.python-list@python.org> |
| In reply to | #79647 |
On Fri, 24 Oct 2014 22:41:06 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> declaimed the following:
>I have a directory of my py files. I right click on one of the py
>files and "open with IDLE" Windows XP
>
>If I try to open a py file I have for Python 2 it still opens using
>IDLE 3.
>
Most likely because the right-click menu holds the last installation
entry default...
What do you get in command shell for:
C:\Users\Wulfraed\Documents>assoc .py
.py=Python.File
C:\Users\Wulfraed\Documents>assoc .pyw
.pyw=Python.NoConFile
C:\Users\Wulfraed\Documents>ftype Python.File
Python.File="C:\Python_x64\Python27\python.exe" "%1" %*
C:\Users\Wulfraed\Documents>ftype Python.NoConFile
Python.NoConFile="C:\Python_x64\Python27\pythonw.exe" "%1" %*
C:\Users\Wulfraed\Documents>
>I don't have many py 2 files anyway.
NOTE: I suspect you will get different results from the "assoc"
commands -- I install the ActiveState versions of Python (I also don't use
IDLE, I prefer the PythonWin environment that most ActiveState installs
provide on Windows) -- so plug in your results on the "ftype" commands.
Those will tell you what the command line defaults are set to execute.
If I were to enter
ftype Python.File="C:\Python_x64\Python33\python.exe" "%1" %*
on a command line, I'd be changing my default handler to Python 3.
I'd don't know how to change the right-click menu, however...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-10-25 14:23 -0400 |
| Message-ID | <mailman.15169.1414261434.18130.python-list@python.org> |
| In reply to | #79569 |
On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> declaimed the following:
>
>I do get the difference. I don't actually use Python 2. I use
>CodeSkulptor. I do have Python 3 installed. Actually I have Python 2
>installed but IDLE defaults to Python 3. So it is a pain to actually
>load Python 2.
>
So don't use Idle... Open up a Windows command shell and invoke Python
without giving a script file to execute.
C:\Users\Wulfraed\Documents>python
ActivePython 2.7.5.6 (ActiveState Software Inc.) based on
Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\Users\Wulfraed\Documents>python3
ActivePython 3.3.2.0 (ActiveState Software Inc.) based on
Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\Users\Wulfraed\Documents>
Note that my default Python is still 2.7, but I also have Python 3.3
installed, and can access it using "python3" (I can also ensure Python 2.7
by using "python2")
>
>I tried list(range(10) I thought that would work in Python 3. It
>didn't. I spent quite a bit of time last night trying to come up with
Really? what did it do? SHOW US!
C:\Users\Wulfraed\Documents>python3
ActivePython 3.3.2.0 (ActiveState Software Inc.) based on
Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print(list(range(10)))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> repr(list(range(10)))
'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'
>>>
Recall that "print" is a function in Python 3, so the extra layer of ()
are required.
C:\Users\Wulfraed\Documents>python
ActivePython 2.7.5.6 (ActiveState Software Inc.) based on
Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print(list(range(10)))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> repr(list(range(10)))
'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'
>>>
"Print" doesn't need the (), but they also don't hurt it in Python 2.
(still in Py2)
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> xrange(10)
xrange(10)
>>> print range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print xrange(10)
xrange(10)
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> exit()
Now Py3
C:\Users\Wulfraed\Documents>python3
ActivePython 3.3.2.0 (ActiveState Software Inc.) based on
Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> range(10)
range(0, 10)
>>> xrange(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'xrange' is not defined
>>> print(range(10))
range(0, 10)
>>>
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
|---|---|
| Date | 2014-10-25 14:42 -0400 |
| Message-ID | <gmrn4at2g1o718v5icu91i9ar6v7or9au6@4ax.com> |
| In reply to | #79677 |
On Sat, 25 Oct 2014 14:23:44 -0400, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: >On Fri, 24 Oct 2014 10:38:31 -0400, Seymore4Head ><Seymore4Head@Hotmail.invalid> declaimed the following: > >> >>I do get the difference. I don't actually use Python 2. I use >>CodeSkulptor. I do have Python 3 installed. Actually I have Python 2 >>installed but IDLE defaults to Python 3. So it is a pain to actually >>load Python 2. >> > > So don't use Idle... Open up a Windows command shell and invoke Python >without giving a script file to execute. > >C:\Users\Wulfraed\Documents>python >ActivePython 2.7.5.6 (ActiveState Software Inc.) based on >Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)] >on win32 >Type "help", "copyright", "credits" or "license" for more information. >>>> exit() > >C:\Users\Wulfraed\Documents>python3 >ActivePython 3.3.2.0 (ActiveState Software Inc.) based on >Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)] >on win32 >Type "help", "copyright", "credits" or "license" for more information. >>>> exit() > >C:\Users\Wulfraed\Documents> > > Note that my default Python is still 2.7, but I also have Python 3.3 >installed, and can access it using "python3" (I can also ensure Python 2.7 >by using "python2") > > >> >>I tried list(range(10) I thought that would work in Python 3. It >>didn't. I spent quite a bit of time last night trying to come up with > > Really? what did it do? SHOW US! > >C:\Users\Wulfraed\Documents>python3 >ActivePython 3.3.2.0 (ActiveState Software Inc.) based on >Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)] >on win32 >Type "help", "copyright", "credits" or "license" for more information. >>>> list(range(10)) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> print(list(range(10))) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> repr(list(range(10))) >'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]' >>>> > > Recall that "print" is a function in Python 3, so the extra layer of () >are required. > >C:\Users\Wulfraed\Documents>python >ActivePython 2.7.5.6 (ActiveState Software Inc.) based on >Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)] >on win32 >Type "help", "copyright", "credits" or "license" for more information. >>>> list(range(10)) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> print list(range(10)) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> print(list(range(10))) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> repr(list(range(10))) >'[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]' >>>> > > "Print" doesn't need the (), but they also don't hurt it in Python 2. >(still in Py2) > >>>> range(10) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> xrange(10) >xrange(10) >>>> print range(10) >[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> print xrange(10) >xrange(10) >>>> exit >Use exit() or Ctrl-Z plus Return to exit >>>> exit() > > Now Py3 > >C:\Users\Wulfraed\Documents>python3 >ActivePython 3.3.2.0 (ActiveState Software Inc.) based on >Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)] >on win32 >Type "help", "copyright", "credits" or "license" for more information. >>>> range(10) >range(0, 10) >>>> xrange(10) >Traceback (most recent call last): > File "<stdin>", line 1, in <module> >NameError: name 'xrange' is not defined >>>> print(range(10)) >range(0, 10) >>>> I am not working on that any more. I have my assignment for this week so I am done with busy work. Thanks for all your help
[toc] | [prev] | [next] | [standalone]
Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8 Next page →
Back to top | Article view | comp.lang.python
csiph-web