Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106496 > unrolled thread
| Started by | "Gordon( Hotmail )" <sionet3344@hotmail.co.uk> |
|---|---|
| First post | 2016-04-05 06:48 +0100 |
| Last post | 2016-04-07 03:40 +1000 |
| Articles | 20 on this page of 41 — 15 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Promoting Python "Gordon( Hotmail )" <sionet3344@hotmail.co.uk> - 2016-04-05 06:48 +0100
Re: Promoting Python Rustom Mody <rustompmody@gmail.com> - 2016-04-05 00:31 -0700
Re: Promoting Python Joel Goldstick <joel.goldstick@gmail.com> - 2016-04-05 08:06 -0400
Re: Promoting Python alister <alister.ware@ntlworld.com> - 2016-04-05 18:02 +0000
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-05 19:47 +0100
Re: Promoting Python alister <alister.ware@ntlworld.com> - 2016-04-05 19:38 +0000
Re: Promoting Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-04-05 08:13 -0400
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-05 15:31 +0300
Re: Promoting Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-04-06 20:52 +1200
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 12:12 +0300
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-06 12:06 +0100
Re: Promoting Python Ned Batchelder <ned@nedbatchelder.com> - 2016-04-06 04:38 -0700
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-06 14:21 +0100
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 14:46 +0300
Re: Promoting Python Michael Selik <michael.selik@gmail.com> - 2016-04-06 13:33 +0000
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 17:14 +0300
Re: Promoting Python Chris Angelico <rosuav@gmail.com> - 2016-04-07 00:20 +1000
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 21:23 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 21:50 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 22:30 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 22:22 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 22:59 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 23:39 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-07 01:03 +0300
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-07 09:30 +0300
Re: Promoting Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-07 00:56 -0600
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-07 10:19 +0300
Re: Promoting Python Steven D'Aprano <steve@pearwood.info> - 2016-04-08 16:09 +1000
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 23:05 +0300
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-06 14:54 +0100
Re: Promoting Python Marko Rauhamaa <marko@pacujo.net> - 2016-04-06 17:08 +0300
Re: Promoting Python Larry Martell <larry.martell@gmail.com> - 2016-04-06 10:36 -0400
Re: Promoting Python Chris Angelico <rosuav@gmail.com> - 2016-04-07 00:14 +1000
Re: Promoting Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-06 15:20 +0100
Re: Promoting Python Ned Batchelder <ned@nedbatchelder.com> - 2016-04-06 07:34 -0700
Re: Promoting Python Ned Batchelder <ned@nedbatchelder.com> - 2016-04-06 10:55 -0700
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-06 23:24 +0100
Re: Promoting Python BartC <bc@freeuk.com> - 2016-04-06 18:04 +0100
Re: Promoting Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-04-06 08:04 -0400
Re: Promoting Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-06 13:39 +0100
Re: Promoting Python Steven D'Aprano <steve@pearwood.info> - 2016-04-07 03:40 +1000
Page 1 of 3 [1] 2 3 Next page →
| From | "Gordon( Hotmail )" <sionet3344@hotmail.co.uk> |
|---|---|
| Date | 2016-04-05 06:48 +0100 |
| Subject | Promoting Python |
| Message-ID | <mailman.54.1459840979.32530.python-list@python.org> |
I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC as you can see on my site at http://www.sigord.co.uk/ I think you will agree all such versions of Basic I have used are far easier to understand than Python. Though with my limited knowledge I accept Python may have many advantages over say Liberty Basic etc. The problem I am finding is most of the sites claiming to help understand Python devote far too much space bragging about the wonders of Python instead of concentrating how to make sensible use of it. For example I struggle to find examples of such as below if you could please help me. If I manage to duplicate some of my efforts on my site with Python I will be happy to upload the code to my site. I will also try to upload working exec files of such also, except my previous attempts at downloading the relevant software was blocked by AVG software as risky. Gordon Liberty Basic for n = 32 to 255: print n;chr$(n) : next n REM BBC Basic FOR c = 1 TO 15 : COLOUR c PRINT "Color ";c NEXT c REM BBC Basic c = 0 FOR x = 80 TO 2000 STEP 96 GCOL c: CIRCLE FILL x,500,50 : c = c + 1 NEXT x
[toc] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2016-04-05 00:31 -0700 |
| Message-ID | <dfada2fa-39b9-4d89-a47c-c4e0742be9e0@googlegroups.com> |
| In reply to | #106496 |
On Tuesday, April 5, 2016 at 12:53:13 PM UTC+5:30, Gordon( Hotmail ) wrote:
> I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC as you can see on my site at http://www.sigord.co.uk/ I think you will agree all such versions of Basic I have used are far easier to understand than Python. Though with my limited knowledge I accept Python may have many advantages over say Liberty Basic etc.
>
> The problem I am finding is most of the sites claiming to help understand Python devote far too much space bragging about the wonders of Python instead of concentrating how to make sensible use of it. For example I struggle to find examples of such as below if you could please help me. If I manage to duplicate some of my efforts on my site with Python I will be happy to upload the code to my site. I will also try to upload working exec files of such also, except my previous attempts at downloading the relevant software was blocked by AVG software as risky.
>
> Gordon
>
>
> Liberty Basic
> for n = 32 to 255: print n;chr$(n) : next n
I grew up on BBC basic in 1984. Not used thereafter.
Your first one is (I guess) this in python:
>>> for i in range(32,127):
... print chr(i),
...
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
>
> REM BBC Basic
> FOR c = 1 TO 15 : COLOUR c
> PRINT "Color ";c
> NEXT c
>
> REM BBC Basic
> c = 0
> FOR x = 80 TO 2000 STEP 96
> GCOL c: CIRCLE FILL x,500,50 : c = c + 1
> NEXT x
If you tell us some more of what color, gcol etc do someone will likely show you
Though in all fairness I dont expect it to be as pithy as the BASIC
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2016-04-05 08:06 -0400 |
| Message-ID | <mailman.64.1459857970.32530.python-list@python.org> |
| In reply to | #106498 |
On Tue, Apr 5, 2016 at 3:31 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> On Tuesday, April 5, 2016 at 12:53:13 PM UTC+5:30, Gordon( Hotmail ) wrote:
>> I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC as you can see on my site at http://www.sigord.co.uk/ I think you will agree all such versions of Basic I have used are far easier to understand than Python. Though with my limited knowledge I accept Python may have many advantages over say Liberty Basic etc.
>>
>> The problem I am finding is most of the sites claiming to help understand Python devote far too much space bragging about the wonders of Python instead of concentrating how to make sensible use of it. For example I struggle to find examples of such as below if you could please help me. If I manage to duplicate some of my efforts on my site with Python I will be happy to upload the code to my site. I will also try to upload working exec files of such also, except my previous attempts at downloading the relevant software was blocked by AVG software as risky.
>>
>> Gordon
>>
>>
>> Liberty Basic
>> for n = 32 to 255: print n;chr$(n) : next n
>
> I grew up on BBC basic in 1984. Not used thereafter.
>
> Your first one is (I guess) this in python:
>
>>>> for i in range(32,127):
> ... print chr(i),
> ...
> ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
>
>>
>> REM BBC Basic
>> FOR c = 1 TO 15 : COLOUR c
>> PRINT "Color ";c
>> NEXT c
>>
>> REM BBC Basic
>> c = 0
>> FOR x = 80 TO 2000 STEP 96
>> GCOL c: CIRCLE FILL x,500,50 : c = c + 1
>> NEXT x
>
> If you tell us some more of what color, gcol etc do someone will likely show you
> Though in all fairness I dont expect it to be as pithy as the BASIC
> --
> https://mail.python.org/mailman/listinfo/python-list
The color stuff has to do with DOS based 16 color displays I think.
Or maybe it worked with other 16 color displays of the time
--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
[toc] | [prev] | [next] | [standalone]
| From | alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2016-04-05 18:02 +0000 |
| Message-ID | <N4TMy.410004$fz.288710@fx37.am4> |
| In reply to | #106510 |
On Tue, 05 Apr 2016 08:06:02 -0400, Joel Goldstick wrote:
> On Tue, Apr 5, 2016 at 3:31 AM, Rustom Mody <rustompmody@gmail.com>
> wrote:
>> On Tuesday, April 5, 2016 at 12:53:13 PM UTC+5:30, Gordon( Hotmail )
>> wrote:
>>> I am struggling to understand the basic principles of Python having
>>> spent many years as a pure Amateur tinkering with a variety of BASIC
>>> as you can see on my site at http://www.sigord.co.uk/ I think you
>>> will agree all such versions of Basic I have used are far easier to
>>> understand than Python. Though with my limited knowledge I accept
>>> Python may have many advantages over say Liberty Basic etc.
>>>
>>> The problem I am finding is most of the sites claiming to help
>>> understand Python devote far too much space bragging about the wonders
>>> of Python instead of concentrating how to make sensible use of it. For
>>> example I struggle to find examples of such as below if you could
>>> please help me. If I manage to duplicate some of my efforts on my site
>>> with Python I will be happy to upload the code to my site. I will also
>>> try to upload working exec files of such also, except my previous
>>> attempts at downloading the relevant software was blocked by AVG
>>> software as risky.
>>>
>>> Gordon
>>>
>>>
>>> Liberty Basic for n = 32 to 255: print n;chr$(n) : next n
>>
>> I grew up on BBC basic in 1984. Not used thereafter.
>>
>> Your first one is (I guess) this in python:
>>
>>>>> for i in range(32,127):
>> ... print chr(i),
>> ...
>> ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C
>> D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f
>> g h i j k l m n o p q r s t u v w x y z { | } ~
>>
>>
>>> REM BBC Basic FOR c = 1 TO 15 : COLOUR c
>>> PRINT "Color ";c
>>> NEXT c
>>>
>>> REM BBC Basic c = 0 FOR x = 80 TO 2000 STEP 96
>>> GCOL c: CIRCLE FILL x,500,50 : c = c + 1
>>> NEXT x
>>
>> If you tell us some more of what color, gcol etc do someone will likely
>> show you Though in all fairness I dont expect it to be as pithy as the
>> BASIC --
>> https://mail.python.org/mailman/listinfo/python-list
>
> The color stuff has to do with DOS based 16 color displays I think.
> Or maybe it worked with other 16 color displays of the time
No
If that code is BBC basic then it would print the word Colour followed by
the numbers 1 - 15
For x in range (1,16):
print "Colour %s"%x
--
fat electrons in the lines
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-04-05 19:47 +0100 |
| Message-ID | <ne1114$fim$1@dont-email.me> |
| In reply to | #106536 |
On 05/04/2016 19:02, alister wrote: > On Tue, 05 Apr 2016 08:06:02 -0400, Joel Goldstick wrote: >>>> REM BBC Basic FOR c = 1 TO 15 : COLOUR c >>>> PRINT "Color ";c >>>> NEXT c >>>> >>>> REM BBC Basic c = 0 FOR x = 80 TO 2000 STEP 96 >>>> GCOL c: CIRCLE FILL x,500,50 : c = c + 1 >>>> NEXT x >>> >>> If you tell us some more of what color, gcol etc do someone will likely >>> show you Though in all fairness I dont expect it to be as pithy as the >>> BASIC -- >>> https://mail.python.org/mailman/listinfo/python-list >> >> The color stuff has to do with DOS based 16 color displays I think. >> Or maybe it worked with other 16 color displays of the time > > No > If that code is BBC basic then it would print the word Colour followed by > the numbers 1 - 15 > > For x in range (1,16): > print "Colour %s"%x > You forgot the COLOUR statement. Presumably each line is in a different text colour. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2016-04-05 19:38 +0000 |
| Message-ID | <5vUMy.372427$vw.236860@fx33.am4> |
| In reply to | #106537 |
On Tue, 05 Apr 2016 19:47:00 +0100, BartC wrote: > On 05/04/2016 19:02, alister wrote: >> On Tue, 05 Apr 2016 08:06:02 -0400, Joel Goldstick wrote: > >>>>> REM BBC Basic FOR c = 1 TO 15 : COLOUR c >>>>> PRINT "Color ";c >>>>> NEXT c >>>>> >>>>> REM BBC Basic c = 0 FOR x = 80 TO 2000 STEP 96 >>>>> GCOL c: CIRCLE FILL x,500,50 : c = c + 1 >>>>> NEXT x >>>> >>>> If you tell us some more of what color, gcol etc do someone will >>>> likely show you Though in all fairness I dont expect it to be as >>>> pithy as the BASIC -- >>>> https://mail.python.org/mailman/listinfo/python-list >>> >>> The color stuff has to do with DOS based 16 color displays I think. >>> Or maybe it worked with other 16 color displays of the time >> >> No If that code is BBC basic then it would print the word Colour >> followed by the numbers 1 - 15 >> >> For x in range (1,16): >> print "Colour %s"%x >> >> > You forgot the COLOUR statement. Presumably each line is in a different > text colour. indeed i did I am no-longer in the old basic habit of putting as many statements on a line as possible. Perhaps this is where the constant requests for a one line solution originate? -- Price's Advice: It's all a game -- play it to have fun.
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2016-04-05 08:13 -0400 |
| Message-ID | <mailman.65.1459858471.32530.python-list@python.org> |
| In reply to | #106498 |
On Tue, 5 Apr 2016 00:31:10 -0700 (PDT), Rustom Mody
<rustompmody@gmail.com> declaimed the following:
>> Liberty Basic
>> for n = 32 to 255: print n;chr$(n) : next n
>
>I grew up on BBC basic in 1984. Not used thereafter.
>
>Your first one is (I guess) this in python:
>
>>>> for i in range(32,127):
>... print chr(i),
>...
> ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
>
Not quite...
>>> for i in range(32, 256):
... print i, chr(i)
...
32
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
...
Though characters 128-255 may depend on the computer encoding...
PythonWin console gives:
244 ??5 ??6 ??7 ??8 ??9 ??0 ??1 ??2 ??3 ??4 ??5 ??>
(actually -- it displays inverse video blue HEX values...)
Windows command shell is something like
244 (
245 )
246 ÷
247 ˜
248 °
249 ·
250 ·
251 v
252 n
253 ²
254 ¦
255
>>>
Though the first two are not parentheses, but make up an integral sign,
247 is a double-tilde, 251 is a square root. Apparently Forte Agent has a
different encoding than the Windows command shell.
>>
>> REM BBC Basic
>> FOR c = 1 TO 15 : COLOUR c
>> PRINT "Color ";c
>> NEXT c
>>
>> REM BBC Basic
>> c = 0
>> FOR x = 80 TO 2000 STEP 96
>> GCOL c: CIRCLE FILL x,500,50 : c = c + 1
>> NEXT x
>
>If you tell us some more of what color, gcol etc do someone will likely show you
>Though in all fairness I dont expect it to be as pithy as the BASIC
Off hand, I'd guess "colour" sets text output color, "gcol" likely sets
graphics color, and "circle fill" likely draws a filled circle in that
color.
For the OP: Very few languages have built-in graphics commands; which
is why porting BASIC programs was so difficult. This means you have to
import some graphical framework and use ITS command functions.
Unfortunately, there are so many routes... If you are on Windows, and
install the win32 python extension, you can make use of the native Win32
libraries to create device contexts, draw into them, etc. Be ready to drown
in the less than clear MSDN documentation. For example, this might be the
"circle fill" (once you've defined the context/window, pen, and brush
https://msdn.microsoft.com/en-us/library/vs/alm/dd162510%28v=vs.85%29.aspx
Or, since Python includes an interface to Tk, there is a "turtle
graphics" module that may be usable (it will be more portable than Win32).
>From the 2.7 help system ( https://docs.python.org/2/library/turtle.html or
https://docs.python.org/3/library/turtle.html depending on version of
Python installed):
-=-=-=-=-
Turtle graphics is a popular way for introducing programming to kids. It
was part of the original Logo programming language developed by Wally
Feurzig and Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an
import turtle, give it the command turtle.forward(15), and it moves
(on-screen!) 15 pixels in the direction it is facing, drawing a line as it
moves. Give it the command turtle.right(25), and it rotates in-place 25
degrees clockwise.
By combining together these and similar commands, intricate shapes and
pictures can easily be drawn.
The turtle module is an extended reimplementation of the same-named module
from the Python standard distribution up to version Python 2.5.
It tries to keep the merits of the old turtle module and to be (nearly)
100% compatible with it. This means in the first place to enable the
learning programmer to use all the commands, classes and methods
interactively when using the module from within IDLE run with the -n
switch.
The turtle module provides turtle graphics primitives, in both
object-oriented and procedure-oriented ways. Because it uses Tkinter for
the underlying graphics, it needs a version of Python installed with Tk
support.
-=-=-=-=-
turtle.circle(radius, extent=None, steps=None)
Parameters: radius – a number
extent – a number (or None)
steps – an integer (or None)
Draw a circle with given radius. The center is radius units left of the
turtle; extent – an angle – determines which part of the circle is drawn.
If extent is not given, draw the entire circle. If extent is not a full
circle, one endpoint of the arc is the current pen position. Draw the arc
in counterclockwise direction if radius is positive, otherwise in clockwise
direction. Finally the direction of the turtle is changed by the amount of
extent.
-=-=-=-=-
turtle.fill(flag)
Parameters: flag – True/False (or 1/0 respectively)
Call fill(True) before drawing the shape you want to fill, and fill(False)
when done. When used without argument: return fillstate (True if filling,
False else).
-=-=-=-=-
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-05 15:31 +0300 |
| Message-ID | <877fgci6eu.fsf@elektro.pacujo.net> |
| In reply to | #106511 |
Dennis Lee Bieber <wlfraed@ix.netcom.com>: > For the OP: Very few languages have built-in graphics commands; > which is why porting BASIC programs was so difficult. This means you > have to import some graphical framework and use ITS command functions. The Racket dialect of the Scheme programming language has an interesting approach: | > (circle 10) | ⚪ [...] | > (rectangle 10 20) | ▯ [...] | > (hc-append (circle 10) (rectangle 10 20)) | ⚪▯ <URL: https://docs.racket-lang.org/quick/> Follow the link for more elaborate examples. Marko
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2016-04-06 20:52 +1200 |
| Message-ID | <dmk137Ftl1iU1@mid.individual.net> |
| In reply to | #106496 |
Another option for graphical stuff is pygame:
http://pygame.org/news.html
A rough translation of some of your code:
import pygame, sys
from pygame import display, draw, event, font, Color, QUIT
# Set up the display window
screen = display.set_mode((800, 600))
colors = ["red", "orange", "yellow", "green", "blue", "purple"]
font.init()
f = font.Font(None, 24)
y = 10
for name in colors:
text = f.render("Color " + name, True, Color(name))
screen.blit(text, (10, y))
y += text.get_height()
x = 30
y = 200
for name in colors:
c = Color(name)
draw.circle(screen, c, (x, y), 20)
x += 50
# Refresh the screen
display.flip()
# Pause until the window is closed
while True:
for e in event.get():
if e.type == QUIT:
sys.exit(0)
--
Greg
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 12:12 +0300 |
| Message-ID | <87pou3gkxn.fsf@elektro.pacujo.net> |
| In reply to | #106561 |
Gregory Ewing <greg.ewing@canterbury.ac.nz>: > Another option for graphical stuff is pygame: Thanks! > http://pygame.org/news.html Especially for this: No need to mess with installing it outside of your operating systems package manager. However: Does Pygame work with Python 3? Yes. Pygame 1.9.2 supports Python 3.2 and up. But Fedora comes with Pygame 1.9.1. Marko
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-04-06 12:06 +0100 |
| Message-ID | <ne2qd3$8rg$1@dont-email.me> |
| In reply to | #106496 |
On 05/04/2016 06:48, Gordon( Hotmail ) wrote: > I am struggling to understand the basic principles of Python having > spent many years as a pure Amateur tinkering with a variety of BASIC Last time I looked, there seemed to be around 250 dialects of Basic, and with wildly differing implementations from pure interpreters to full compilers, from GWBASIC to .NET. (Is there even an official standard?) With Python there are two dialects, and it's often already installed on a system (probably not on Windows though). There are a few different implementations too, but code I think is largely compatible across them. > The problem I am finding is most of the sites claiming to help understand Python devote > far too much space bragging about the wonders of Python instead of... I fully agree. But you don't have to use classes, exceptions, decorators, generators, iterators, closures, comprehensions, meta classes, ... the list of meaningless buzzwords just goes on. It'll cope with ordinary coding as well, although such programs seem to be frowned upon here; they are not 'Pythonic'. > Liberty Basic > for n = 32 to 255: print n;chr$(n) : next n > > REM BBC Basic > FOR c = 1 TO 15 : COLOUR c > PRINT "Color ";c > NEXT c Python apparently has hundreds of libraries to do this stuff, which is a downside: there are as many libraries as Basics probably! And each seems to work a little differently from the other... I haven't tried graphics in Python, but I would start by googling 'python basic graphics' or some such phrase. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2016-04-06 04:38 -0700 |
| Message-ID | <24613931-1957-412e-a803-25a68a021605@googlegroups.com> |
| In reply to | #106565 |
On Wednesday, April 6, 2016 at 7:06:28 AM UTC-4, BartC wrote: > On 05/04/2016 06:48, Gordon( Hotmail ) wrote: > > The problem I am finding is most of the sites claiming to help understand Python devote > > far too much space bragging about the wonders of Python instead of... > > I fully agree. But you don't have to use classes, exceptions, > decorators, generators, iterators, closures, comprehensions, meta > classes, ... the list of meaningless buzzwords just goes on. These are not meaningless buzzwords. They are technical terms describing the features of the language. You don't see the need for these features, so perhaps you haven't bothered to learn about them, but that does not make them meaningless. In order to make the claim that something is a meaningless buzzword, you'd have to show the simpler better way to describe the same thing. How would you replace the word "class", or "decorator"? And I don't mean, how would you write code without using those features. Python has classes, which are a specific technical thing that can be clearly defined. You might as well say that toolboxes have too many meaningless buzzwords like hammer, screwdriver, wrench, chisel, etc. It seems like a willful refusal to learn about what the language offers. But let's please not run down the rathole again of you telling us that things like classes and exceptions are useless, and us trying to show you why they are useful. We've been around and around those arguments, and there doesn't seem to be anything more to say about it. Just say that you prefer simpler languages, and leave it at that. Perhaps what you mean is that there are too many "explanations" out there that are not good at explaining the concepts. I'm sure that's true. But there are also explanations out there that are good. Find one that speaks to you, and learn. --Ned.
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-04-06 14:21 +0100 |
| Message-ID | <ne32b3$7nr$1@dont-email.me> |
| In reply to | #106566 |
On 06/04/2016 12:38, Ned Batchelder wrote: > On Wednesday, April 6, 2016 at 7:06:28 AM UTC-4, BartC wrote: >> On 05/04/2016 06:48, Gordon( Hotmail ) wrote: >>> The problem I am finding is most of the sites claiming to help understand Python devote >>> far too much space bragging about the wonders of Python instead of... >> >> I fully agree. But you don't have to use classes, exceptions, >> decorators, generators, iterators, closures, comprehensions, meta >> classes, ... the list of meaningless buzzwords just goes on. > > These are not meaningless buzzwords. They are technical terms describing > the features of the language. You don't see the need for these features, > so perhaps you haven't bothered to learn about them, but that does not > make them meaningless. OK, I'll withdraw the word 'meaningless'. Out of the eight things I listed, I would only need to go and look up the meaning of three of them. Out of the rest, I've only used classes to implement records, and have been obliged to use exceptions because that was how some functions worked. > You might as well say that toolboxes have too many meaningless buzzwords like > hammer, screwdriver, wrench, chisel, etc. No, those are the basics. Unless you want to suggest a lump of rock and a stick are the basic tools of DIY! > It seems like a willful refusal to > learn about what the language offers. The context here is of someone moving over from Basic, which barely had proper function calls. Then you don't need that advanced stuff. That can be acquired gradually later on, if someone wants to. But get people hooked into the language first rather than frightening them off. > But let's please not run down the rathole again of you telling us that things > like classes and exceptions are useless, and us trying to show you why they > are useful. We've been around and around those arguments, and there doesn't > seem to be anything more to say about it. > > Just say that you prefer simpler languages, and leave it at that. I'm saying that people should be allowed to use Python in simple ways. The language seems to have nearly everything necessary to make that possible. (Except 'goto', which imposes some limitations. 'if' and 'goto' allow any kind of control flow to be programmed.) -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 14:46 +0300 |
| Message-ID | <87h9ffgdtr.fsf@elektro.pacujo.net> |
| In reply to | #106565 |
BartC <bc@freeuk.com>: > But you don't have to use classes, exceptions, decorators, generators, > iterators, closures, comprehensions, meta classes, ... the list of > meaningless buzzwords just goes on. Also, you don't have to use the letter "e" in your identifiers or the number 2 anywhere in your programs. Really, there's only one high-level construct you can't live without: the "while" statement. Virtually every Python program has at least one "while" statement, and in general, it is unavoidable. Basic programs, on the other hand, don't need that meaningless buzzword, but can live just fine with GOTO. > It'll cope with ordinary coding as well, although such programs seem > to be frowned upon here; they are not 'Pythonic'. I wonder what is left of Python after your list of exclusions. Marko
[toc] | [prev] | [next] | [standalone]
| From | Michael Selik <michael.selik@gmail.com> |
|---|---|
| Date | 2016-04-06 13:33 +0000 |
| Message-ID | <mailman.133.1459949616.32530.python-list@python.org> |
| In reply to | #106567 |
On Wed, Apr 6, 2016, 12:51 PM Marko Rauhamaa <marko@pacujo.net> wrote: > BartC <bc@freeuk.com>: > Really, there's only one high-level construct you can't live without: > the "while" statement. Virtually every Python program has at least one > "while" statement, and in general, it is unavoidable. > > Basic programs, on the other hand, don't need that meaningless buzzword, > but can live just fine with GOTO. > You don't need WHILE or GOTO, you can just copy-paste code. You probably need an IF at some point. >
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 17:14 +0300 |
| Message-ID | <87zit6lt8q.fsf@elektro.pacujo.net> |
| In reply to | #106577 |
Michael Selik <michael.selik@gmail.com>: > On Wed, Apr 6, 2016, 12:51 PM Marko Rauhamaa <marko@pacujo.net> wrote: > >> Really, there's only one high-level construct you can't live without: >> the "while" statement. Virtually every Python program has at least >> one "while" statement, and in general, it is unavoidable. >> >> Basic programs, on the other hand, don't need that meaningless >> buzzword, but can live just fine with GOTO. > > You don't need WHILE or GOTO, you can just copy-paste code. You > probably need an IF at some point. Seriously, Python wouldn't be, couldn't be Turing-complete without "while" (mainly because it doesn't support tail-recursion elimination). Now, if Python had an unlimited range() iterator/iterable, you could use a "for" statement to emulate "while". As it stands, Python without "while" could only compute primitive-recursive functions. However, you only need "while" a maximum of one time in your whole program to perform an arbitrary computation. Marko
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-04-07 00:20 +1000 |
| Message-ID | <mailman.0.1459952698.1197.python-list@python.org> |
| In reply to | #106580 |
On Thu, Apr 7, 2016 at 12:14 AM, Marko Rauhamaa <marko@pacujo.net> wrote: > Seriously, Python wouldn't be, couldn't be Turing-complete without > "while" (mainly because it doesn't support tail-recursion elimination). Side point: Turing completeness actually assumes a mythical Turing machine with infinite memory. So Python could be implemented without tail call elimination, executed on a machine with infinite stack space, and would only need removal of sys.*recursion_limit, and it'd be valid. The *language* isn't broken because of that. Plus, anyone could implement a Python interpreter with TCE. There might well be some out there already. The only issue is that you'd mess with tracebacks, so Guido doesn't want it. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 21:23 +0300 |
| Message-ID | <87mvp6lhoy.fsf@elektro.pacujo.net> |
| In reply to | #106583 |
Chris Angelico <rosuav@gmail.com>: > Plus, anyone could implement a Python interpreter with TCE. Tricky in practice because None is the default return value. If the programmer were careful to return the value of the tail call, it can be eliminated. Marko
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 21:50 +0300 |
| Message-ID | <877fgalgfz.fsf@elektro.pacujo.net> |
| In reply to | #106593 |
Random832 <random832@fastmail.com>: > On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote: >> Chris Angelico <rosuav@gmail.com>: >> > Plus, anyone could implement a Python interpreter with TCE. >> >> Tricky in practice because None is the default return value. >> >> If the programmer were careful to return the value of the tail call, >> it can be eliminated. > > Well, the interpreter can know that the calling function doesn't > return anything (returns None). Maybe it could pass a secret argument > to the called function telling it not to return its value and to > return None instead. Oh, I forgot about the secret whisper-with-a-wink channel... Marko
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-06 22:30 +0300 |
| Message-ID | <87r3eik00q.fsf@elektro.pacujo.net> |
| In reply to | #106593 |
Chris Angelico <rosuav@gmail.com>: > This is the exact sort of shenanigans that it takes to convert > recursion into tail recursion - and in MOST cases, it's very little > effort to go from there to explicit while loops. That's why TCE is so > infrequently important that it's just not worth the cost - which in > this case is damage to tracebacks. In Python, that is. In Scheme, you write loops with tail recursion. While you *could* use the (while code body ...) form in Scheme, that would be falling out of religion. Marko
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.lang.python
csiph-web