You are not logged in or registered. Please login or register to use the full functionality of this board...
SIGN IN Join Our Community For FREE


python for basic coders
05-14-2017, 06:37 PM (This post was last modified: 05-14-2017 06:41 PM by figosdev.)
Post: #1
 (Print Post)
python for basic coders
so i started learning basic in the 1980s, and i used it for 20 years while looking for a "modern" version of basic or a more powerful language that was similarly friendly.

i tried javascript, found it tedious (its still my favourite language for creating a gui. i dont usually like css, but when i do its because javascript.) i also dont like running javascript most of the time. but its got power. theyre doing interesting stuff with it.

i tried at least two server-side languages, that includes python. i tried tcl, i wish i liked lua (its very popular for things basic is known for.) i was a freebasic fan early on, but ran into too many gotchas. i still think qb64 is the best effort ever made to create a replacement for qbasic-- while i believe walts crystalbasic has the potential at least to be a better language than qb64, i dont believe it will be a better replacement for qbasic-- why? no one will put that much effort in again.

freebasic was (imo, after a decade of thinking about it) for fb fans that wanted to move on from qbasic. qb64 was for qb fans that didnt think fb was "close enough." in the early days, you could tell.

well i followed fb from 2004 on, and qb64 from before it was announced. (thanks s, you know who you are.) qb64 was to be free software (it is now) and thats what we needed. but it took so long to get to where it was free/libre, i found python and learned that.

the more i got into it the more excited i was. it was the same excitement i had learning basic. like really 5 years or more of looking, and i found it thanks to the one-laptop-per-child program. you know how everyone wanted to make a "basic os?" (really a shell?) well someone finally did, but its in python, and its called "sugar": https://www.sugarlabs.org/

and although its not the same, the closest thing to the qbasic experience (from a kids point of view) for python is called pippy:

[Image: At9m4e7.png]


as i got to know python it just kept getting better.

i was attracted to it for how easy it made things, not how powerful it is. i was looking for way to do new things, but also a fun way to do things i did with basic.

there are now basic dialects with similar features, and even vb.net (as opposed to vb originally) gets closer to python.

even truebasic uses pythons syntax for substrings: p$[start:finish] # (you dont use the $ in python)

note that i use routines i made for left() and right() and mid() called left() and right() and mid()


when you learned basic, you started with little examples and tried them and modified them. thats how you learn python, too. and fig lets you use inline python:

Code Snippet: [Select]
python
    print "hello, world".upper()

    def ucase(p): return p.upper()
    print ucase("hello, world")

    fig


in fig you just say: "hello, world" ucase

in python you say: "hello, world".upper()

but you can create a function so in python its: ucase("hello, world")


familar basic statements in python include print, len, for, while, plus others.

+ is +, - is -, / is / (but hold on) and * is *

but:

^ is **
mod is % although you can do the same thing as .upper(): def mod(x, y): return x % y


function is def.

return works like it does in some dialects of basic, where instead of the functionname = value, it uses: return value

functions can be single line or indented blocks, the syntax is the same. for the super geeks out there, python can do recursive functions, lambdas and closures. (which every language has to have these days i suppose.)

i didnt even like writing functions with scope until i used python. i didnt like using libraries until i used python:

x = 5
def use_a_global_variable(): global x ; print x
use_a_global_variable()


for python you need to import things to get things like trig functions:

from math import sin, cos, tan
from random import randint # randint(0,9) is like int(rnd*10)


# for loops:

# for x = 1 to 100 step 2
for x in range(1, 100 + 1, 2):


# for in loops: (works on strings and arrays and numeric ranges)
for x in "hello": print x


while 1: print "hello again"


there are hobbyists and professionals and python book authors that still prefer python 2.

the python foundation will drop support for python 2 in 2020 (they extended it from 2015.)

python 2 is still maintained, as is pypy, which is an alternative to python.

fig runs in pypy, with about two lines modified (that point to the python interpreter.)

python is implemented in more than one language. the most popular implementation is c. pypy is implemented in python.


if you love basic, i think python 2 is much closer to basic in feel and ease of use. i have tried using newer versions many times, i even did a version of fig that wasnt in python 2. but i really dont like it.

people will tell you that python 2 isnt worth it, but they arent trying to do the same things. when youre used to basic, youre used to strings working a certain way. python 2 does that, with extras that are very cool.

if you want to fiddle with string and unicode encoding all the time, you dont need python 2.

python 2 will make that much easier, though you may feel differently.

if youre coming from basic, i still think python 2 is the best. i actually enjoy using it, and it is easier.


graphics are a pain unless you love oop. if you dont love oop, try pygame, its the closest graphics library to basic.

color and locate i implemented with ansi escapes. this works on a mac and on gnu/linux without installing a library.

on windows, you have to install colorama to do ansi escapes.
or you have to get ansi.sys running (possible in windows 7 and before)
or you have to find a 3rd-party term that is ansi-capable (you could possibly write one in qb64 or fb.)

but the way you say color 5,0 in python is: (this is one way to do it)

print "\x1b[0;35m" + "this is magenta"

can you make that into a command? sure--

before i wrote fig, i offered lots of tips like this including public domain code to add basic-like commands to your python programs.

those routines are in fig, i even added to them.

all the code in fig is yours to do what you like. you can put it in any program.

you want an instr() function in your python program? learn the python way to do it, or borrow my instr() function. it has an extra parameter on the left (remove it) thats related to fig.

it doesnt have all the functionality of basics instr, but it has most of it. same for mid()


but this isnt about fig, its about python.

yes, fig can help you transition to python.

yes, fig contains routines i wrote to make it easier for basic coders to write programs in python, which i wrote for you to copy and paste if you want to.

but as i said: python, python, python, python, python.

im telling you how you can make it easier on yourself to learn python. these are tips about python. if you want to learn python, you can start here.


im adding this license so you can also copy and paste any (or all) of this writing and do anything you want with it-- put it in a book, website, blockbuster film, have fun

* license (for everything except the pictures): creative commons cc0 1.0 (public domain)
* http://creativecommons.org/publicdomain/zero/1.0/

i cant give you permission to do anything with the pictures.
Find all posts by this user
Like Post
05-14-2017, 08:20 PM
Post: #2
 (Print Post)
RE: python for basic coders
please
better say to python users to stop use python then that use BASIC
compilers & interpreters ,,,
that is the way against big company product what python is
and this big company is Google.
everyone with little grain of salt in brain know who is behind python
-Google
on the other side u use outdated version
good thing is that python is not popular programming language on Windows
and probably never be.
VB.net dont have any similarity with python because he is derived
from C#.
OOP
classes,nethods,inheritance and polymorphism are not exclusively
connected with "modern" languages
and statement that python is remarkable multiparadigm powerful language
is ordinary LIE.
Any modern basic compiler can beat python in almost any case
python without external imports is almost uselles.

basicPro forum:
http://basicpro.mipropia.com/smf/index.php
EU Radioboard forum:
http://euradioboard.createmybb3.com/index.php
AurelSoft main site:
http://aurelsoft.ucoz.com
Find all posts by this user
Like Post
05-14-2017, 09:20 PM
Post: #3
 (Print Post)
RE: python for basic coders
Quote:
better say to python users to stop use python then that use BASIC

be that as it may, some people do actually like python, and as i was saying i enjoyed it quite a lot after 20 years of basic.


Quote:
compilers & interpreters ,,,

compilers and interpreters?


Quote:
that is the way against big company product what python is

no-- python came out of the same place algol 60 came from. algol 60 influenced both basic and abc, which influenced python.


Quote:
and this big company is Google.

google didnt invent youtube, or python. they bought youtube and they now pay the developer of python.


Quote:
on the other side u use outdated version

actually-- not on the other side. the "outdated" version i use, which is still preferred by many people, is less like the one google is working on.


Quote:
good thing is that python is not popular programming language on Windows

or windows isnt a popular os for python.


Quote:
and probably never be.

because apache doesnt need windows.


Quote:
VB.net dont have any similarity with python

it has more in common with python now than it used to, which is what i was saying.


Quote:
OOP
classes,nethods,inheritance and polymorphism are not exclusively
connected with "modern" languages

i agree.


Quote:
and statement that python is remarkable multiparadigm powerful language
is ordinary LIE.

really? whats "unremarkable" about it?

youre welcome to your opinions, but theyre just different opinions. i mean, youre not making arguments here, just statements that you feel are true.

which is fine i suppose, if thats all you want to say about it.


Quote:
Any modern basic compiler can beat python in almost any case

you are so obstinate. when i talk about a compiler you say interpreters are better. when i talk about an interpreter, you say compilers are better.

both are better for some things. or you disagree?


Quote:
python without external imports is almost uselles.

thats why theres a standard library included with most installations. you install python, youve got the libraries. and theyre easy to import. like really, really easy.

qbasic:

apostrophe dollar-sign quote-mark NAME dot EXTENSION quote-mark

python:

* no apostrophe
* no dollar-sign
from LIBRARY import COMMAND
no extension required
* no quote-marks

you can even:

from LIBRARY import *


every time i try to help with python (in the python or other forum) you go on about how terrible python is.

every time you say its terrible and a plot from google and it doesnt work on windows.

its only slightly more of a pain on windows, for the stuff i like to do. ive used it in windows. its easy.

installing colorama (a tiny tiny library) is a little tedious if you dont like the command line. because you have to change to a folder and run a batch file.

installing pygame is difficult if you cant download the right version, or perhaps if you have a 15-year-old version of windows. but a lot of things are difficult to install at that point. like a web browser.
Find all posts by this user
Like Post
05-15-2017, 02:35 AM
Post: #4
 (Print Post)
RE: python for basic coders
Quote:
every time i try to help with python (in the python or other forum) you go on about how terrible python is.
look fig
nothing personal against you, you are fine and i apologize to you
but after all this  "python this ,python that" i have feeling that my head will explode.
and yes most of things i say here are TRUE.

you say help with python .what kind of help?
i currently have thoony instaled and this thing not work as i supposed to think.
WinPython 2.54 work better on windows but is too heavy...
On the other side most of BASIC-s work out of box .

basicPro forum:
http://basicpro.mipropia.com/smf/index.php
EU Radioboard forum:
http://euradioboard.createmybb3.com/index.php
AurelSoft main site:
http://aurelsoft.ucoz.com
Find all posts by this user
Like Post
05-15-2017, 03:03 AM (This post was last modified: 05-15-2017 03:05 AM by figosdev.)
Post: #5
 (Print Post)
RE: python for basic coders
Quote:
you say help with python .what kind of help?
i currently have thoony instaled and this thing not work as i supposed to think.

i mostly intended along the lines of "if someone installs python and wants help using it." because i am not familiar with your setup.


Quote:
WinPython 2.54 work better on windows but is too heavy...

fair enough.


Quote:
On the other side most of BASIC-s work out of box .

that much is definitely true.
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - Blokus
QB64 Member Project - OpenGL Triangles
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - ARB Checkers
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Exit
QB64 Member Project - Algeria Weather
QB64 Member Project - Dreamy Clock
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Pivet version one
QB64 Member Project - Overboard
QB64 Member Project - Bowditch curve
QB64 Member Project - Quarto
QB64 Member Project - Foursight
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - Point Blank
QB64 Member Project - Connect Four
QB64 Member Project - Color Rotating Text
QB64 Member Project - Rubix's Magic
QB64 Member Project - Color Triangles
QB64 Member Project - Amazon
QB64 Member Project - Dakapo
QB64 Member Project - Martin Fractals version one
QB64 Member Project - Touche
QB64 Member Project - Basic Dithering
QB64 Member Project - Rotating Background
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Inside Moves
QB64 Member Project - Score 4
QB64 Member Project - Input
QB64 Member Project - Spiro Roses
QB64 Member Project - Qubic
QB64 Member Project - Splatter
QB64 Member Project - Martin Fractals version four
QB64 Member Project - RGB Color Wheel
QB64 Member Project - Pivot version two
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Line Thickness
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Othello
QB64 Member Project - 9 Board
QB64 Member Project - Isolation
QB64 Member Project - Domain
QB64 Member Project - Swirl
QB64 Member Project - Kings Court
QB64 Member Project - Sabotage
QB64 Member Project - Martin Fractals version two