Shop OBEX P1 Docs P2 Docs Learn Events
Python on Propeller: many requests lately. . . - Page 3 — Parallax Forums

Python on Propeller: many requests lately. . .

1356789

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2015-03-16 18:12
    No problem, Bill.

    I keep plugging away!!
  • ozpropdevozpropdev Posts: 2,791
    edited 2015-03-16 18:32
    Have any of these educators even looked at SPIN.
    If you can't teach kids or adults the fundamentals of computers,bits,bytes etc in a few hours then "Houston we have a problem"
    This may not entirely be the educatots fault though with attitudes like this:
    A quote from a typical "today" kid :
    What do we need educators for. As long as you've got a smartphone everything you need to know is on Wikipedia!
    and this
    Q. Why is <insert language name here> better than what I'm using now?
    A. Coz a guy on Youtube sez so!

    very sad :(
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-03-16 18:49
    Giving customers what they think they want is not the best marketing strategy. Educating them on what they need works better in the long run. Educators are a fickle, buzz-word-driven bunch. What's fashionable today with them will be history tomorrow. So, Ken, stick to what Parallax does best, and don't spread yourselves thin by catering to every fad that comes along. At the end of the day, constancy sells better than currency.

    -Phil
  • David BetzDavid Betz Posts: 14,511
    edited 2015-03-16 18:55
    jazzed wrote: »
    Just give them a spin compiler that uses python syntax and a pc or tablet/phone emulator for the interactive language lovers.

    Another alternative would be to make a p1v with external hub ram and 32 address space.
    I wish people would stop comparing Spin with Python. They aren't at all alike except that they both using indentation to indicate block structure and that is a very superficial similarity.
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-16 19:26
    re:Giving customers what they think they want is not the best marketing strategy. Educating them on what they need works better in the long run. Educators are a fickle, buzz-word-driven bunch.

    The important question is why are they asking for Python? The 2 articles posted below tries to explain why Python is getting so popular

    From here: http://www.computerworld.com/article/2489732/it-skills-training/python-bumps-off-java-as-top-learning-language.html

    "Python has surpassed Java as the top language used to introduce U.S. students to programming and computer science, according to a recent survey posted by the Association for Computing Machinery (ACM).
    mobile device management tablet user apps
    Mobile device management continues to broaden

    Think 'enterprise mobility management,' which includes app and data security, among other things.
    Read Now

    Eight of the top 10 computer science departments now use Python to teach coding, as well as 27 of the top 39 schools, indicating that it is the most popular language for teaching introductory computer science courses, according to Philip Guo, a computer science researcher who compiled the survey for ACM."

    =====================================================================================================================================================

    Python is Now the Most Popular Introductory Teaching Language at Top U.S. Universities

    From Here: http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-us-universities/fulltext

    At the time of writing (July 2014), Python is currently the most popular language for teaching introductory computer science courses at top-ranked U.S. departments.

    Specifically, eight of the top 10 CS departments (80%), and 27 of the top 39 (69%), teach Python in introductory CS0 or CS1 courses.
    Motivation

    Python has been getting more popular as the first language to teach novices. Three years ago, Mark Guzdial blogged about the rise of Python as a teaching language and predictions for future teaching languages. Top-ranked CS departments at MIT and UC Berkeley recently switched their introductory courses to Python. The largest three MOOC providers (edX, Coursera, and Udacity) all offer introductory programming courses in Python. And professors in diverse subfields (e.g., Lorena Barba) are now advocating for teaching Python to novices.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2015-03-16 19:57
    Thank you for the replies on this topic.

    We're not about to undertake another toolchain for Propeller, other than PropBASIC integration into Propeller IDE.

    As pointed out above, Python is growing in popularity and seems to have surpassed C. This happened really quickly, too.

    If a Python compiler were useful and available I'd point a few customers to it for evaluation and consideration in their courses.

    Thanks,

    Ken Gracey
  • jmgjmg Posts: 15,148
    edited 2015-03-16 20:20
    Ken Gracey wrote: »
    Thank you for the replies on this topic.

    We're not about to undertake another toolchain for Propeller, other than PropBASIC integration into Propeller IDE.

    As pointed out above, Python is growing in popularity and seems to have surpassed C. This happened really quickly, too.

    If a Python compiler were useful and available I'd point a few customers to it for evaluation and consideration in their courses.
    I don't think you need 'another tool chain; or 'a Python compiler" just yet.
    However, you could easily make sure there were good examples of python talking to Prop Boards, on your pages.

    Enough to prove you are "compatible with" python.
    If users want compact system approach, the RoboPi mentioned in #61 sounds something to point them to.
  • ValeTValeT Posts: 308
    edited 2015-03-16 20:38
    Ken Gracey wrote: »
    Thank you for the replies on this topic.

    We're not about to undertake another toolchain for Propeller, other than PropBASIC integration into Propeller IDE.

    As pointed out above, Python is growing in popularity and seems to have surpassed C. This happened really quickly, too.

    If a Python compiler were useful and available I'd point a few customers to it for evaluation and consideration in their courses.

    Thanks,

    Ken Gracey

    Mr. Gracey,

    It should be possible to create a converter for converting Python code to Spin code, then compile the converted code and download it to the Propeller using OpenSpin. I do not know how difficult this is though. Mr. Weir created a Spin code to Python converter, so maybe he knows more?

    ValeT
  • msrobotsmsrobots Posts: 3,704
    edited 2015-03-16 20:51
    Ken Gracey wrote: »
    Thank you for the replies on this topic.

    We're not about to undertake another toolchain for Propeller, other than PropBASIC integration into Propeller IDE.

    As pointed out above, Python is growing in popularity and seems to have surpassed C. This happened really quickly, too.

    If a Python compiler were useful and available I'd point a few customers to it for evaluation and consideration in their courses.

    Thanks,

    Ken Gracey

    Great news for PropBasic. I never used it, but it has a lot of followers on the propeller. Very good decision to support it. PropBasic is looking for a IDE since a long time.

    The hype of Phyton is quite connected with the RasPi. I am not at all sure that it is a good language to learn to program.

    my 2 cents

    Mike
  • Keith YoungKeith Young Posts: 569
    edited 2015-03-16 21:06
    msrobots wrote: »
    The hype of Phyton is quite connected with the RasPi. I am not at all sure that it is a good language to learn to program.

    my 2 cents

    Mike

    Can you describe what makes it a language that isn't good to learn? What in your opinion is the best language for middle schoolers and high schoolers to learn? Why?

    To me, when I see it, I see a simple syntax so the learning is battling their logic, not semicolons and apostrophes. As I've said before, I have no formal education in this.

    Thanks!
  • rod1963rod1963 Posts: 752
    edited 2015-03-16 21:26
    The popularity of Python for teaching programming is baffling - Pascal or Oberon would be better IMO. As far as embedded Python versions go, there only seems to be one for the ARM, no ports even attempted for the PIC32(which I had been looking for) that also has the memory and compute resources. Makes me wonder if it's a bit too rich for all but the top end ARM controllers.

    If so that would make it a bad fit for the Prop.

    That said, it's not hard to teach binary, hex and assembly language. Though I learned it in junior college as part of learning about programming the 8085. But I don't see the relevance of exposing younger kids in their early teens to it unless they are really into programming and digging into the hardware and have a decent teacher to help them over the bumps they may encounter.

    The funny thing is, the old ISA slot based PC/AT running DOS would have been a good platform. You could build and stuff just about ISA base I/O device in it. Pull up Turbo C, Pascal or Basic and interface to the real world. Today with the bloated gigabyte sized OS's that insulate you from the hardware and complicate development environments take all the fun out of it.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-03-16 21:42
    rod1963 wrote:
    The funny thing is, the old ISA slot based PC/AT running DOS would have been a good platform. You could build and stuff just about ISA base I/O device in it. Pull up Turbo C, Pascal or Basic and interface to the real world. Today with the bloated gigabyte sized OS's that insulate you from the hardware and complicate development environments take all the fun out of it.

    No kidding! My go-to language in those days was Modula 2, a beautiful language that compiled to blazing-fast object code. Twiddling bits on the parallel port was piece of cake, too. Now, I can't even get a parallel-port license dongle for one of my CAD programs to work on anything above Win98. We might think that just because we buy our PCs that we own them. We don't, really.

    Let's get Perl running on the Prop. I've already done the regex stuff. Who's with me?!!! :)

    Seriously, though, it would be nice to see at least one garbage-collected (i.e. non-malloc), string-aware language available for the Prop. Bill Gates and Paul Allen did it for the lowly TRS-80 Model I, so I know it's possible.

    -Phil
  • jmgjmg Posts: 15,148
    edited 2015-03-16 22:29
    msrobots wrote: »
    Great news for PropBasic. I never used it, but it has a lot of followers on the propeller. Very good decision to support it. PropBasic is looking for a IDE since a long time.

    The hype of Phyton is quite connected with the RasPi. I am not at all sure that it is a good language to learn to program.

    Yes, there is scope for making Prop BASIC co-operate well with FreeBasic,
    which would make source-movement simpler.

    http://www.freebasic.net/wiki/wikka.php?wakka=CatPgFullIndex
    http://www.freebasic.net/forum/viewtopic.php?f=5&t=21433

    Propellor IDE could even call either command-line compiler, and so support developing in both.
    Serial port support in FreeBASIC is quite good, so they can communicate well.

    Expanding the details a little here is one example of a Syntax difference, that does not need to be a difference.
    Common conditional syntax is a cornerstone to code portability.
        FreeBasic		PropBasic
        #DEFINE		'{$DEFINE Symbol}
        #ELSE		'{$ELSE}
        #ELSEIF
        #ENDIF		'{$ENDIF}
        #IF
        #IFDEF		'{$IFDEF Symbol}
        #IFNDEF		'{$IFNDEF Symbol}
        #UNDEF		'{$UNDEFINE Symbol}
    
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-03-16 23:20
    I've been toying with the idea of building a Propeller resident Python interpreter on top of the Tachyon VM using the microSD (or serial Flash) to hold the virtual memory files. Since the Tachyon VM and O/S does fit on a standard Propeller and supports virtual memory while the VM itself is very fast and compact it seems logical to compile to this model while also supporting the resident Python interpreter. A cross-compiler IMO would lose the interactive flavor of Python and basically be reduced to "another glorious PC compiled language" that could just as easily be cross-compiled to an ARM etc but would always pale in comparison to a resident interpreter.

    Then I had a look at the C source code for a Python interpreter and it was as I expected, HUGE, but from my experience it's only impossible when you look up at the mountain of code and think of climbing it rather than looking for a better way. Sometimes it's better not to look at the mountain in the first place, just do it. That is what I'm doing at present (amongst other things) and I believe it's possible (oh boy, I'm sweating) to tweak and enhance the text interpreter part of Tachyon to evaluate typical Python expression. In my experiments some expressions require very little internal tricks to compile directly to Tachyon bytecode. I have as much memory as an SD card will hold and it's possible to use overlays or even "interpret" bytecode from file using a caching technique similar to what I did with the dictionary when I first put it in SD, so that sections of code and loops still run at full speed.

    I'm not saying all this is easy but I don't think it's impossible either although it certainly is a challenge and a half. As I am thinking of material to include in my Circuit Cellar article for the IoT5500 then mentioning the possibility of a future Python interpreter might prove beneficial for Parallax also, after of course when I have demonstrated that this is possible and viable that is.

    Personally the reason I don't favor certain "languages" is simply for the reason that they don't run directly and interactively on the target = Propeller. Either way implementing Python may change that and really "propel the Propeller" and pave a ready and hungry market for the P2. Of course for more performance you can always drop down to Forth :)

    Though this scares me, I do however love a challenge, nothing better to get you motivated and focused I say!

    Maybe I'm dreaming. What do you think? Am I mad? Will I regret it? Basic would be a lot easier.....
  • jmgjmg Posts: 15,148
    edited 2015-03-17 00:16
    Maybe I'm dreaming. What do you think? Am I mad? Will I regret it? Basic would be a lot easier.....
    You could always do both the easier Basic, and Python in parallel. That way if python proves a bridge too far, you still have something to show for the effort ... ?
  • Heater.Heater. Posts: 21,230
    edited 2015-03-17 00:46
    @ValeT,
    It should be possible to create a converter for converting Python code to Spin code,...
    No. Cannot be done.

    @msrobots,
    The hype of Phyton is quite connected with the RasPi.
    I find it unlikely that universities throughout the USA are going to adopt Python for CS course because of a little toy made in England. However the creator of the Pi was an academic in a CS department in England who will have been going with the flow as it were.

    Python is a far better language to learn to program in than the BASIC we had to start out with.

    CS departments don't want to teach a programming language, they want to teach Computer Science. All that algorithm analysis stuff. To that end they need a language with as little friction and annoying details as possible so that they can quickly get past the language issue and on to the real subject. For this reason they used Scheme for ages.

    @Peter Jakacki,

    Hmmm...OK...peter is about to prove it can be done. That is a big challenge you have set yourself Peter.

    I'm wondering how the humble Propeller is going to handle Python like this:
    >>> 234897109832471283741865919825610856108965098653  * 329840161786498713491873254918753497154987514
    77478500710323285943491653692433533189584085656580205205986996082252364420133953293993218642L
    >>>
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-03-17 02:03
    Heater. wrote: »
    @Peter Jakacki,

    Hmmm...OK...peter is about to prove it can be done. That is a big challenge you have set yourself Peter.

    I'm wondering how the humble Propeller is going to handle Python like this:
    >>> 234897109832471283741865919825610856108965098653  * 329840161786498713491873254918753497154987514
    77478500710323285943491653692433533189584085656580205205986996082252364420133953293993218642L
    >>>
    


    We wouldn't be expecting a PC implementation of Python would we? The Pythons that have been implemented on microcontrollers such as Micro Python are lean and mean so that is our target to aim for and if we reach that then we are doing quite well. PropPy we will have to call it and if we do a custom board for it like the pyboard we will call it the PyProp so that it's PropPy on the PyProp :)

    But I think that perhaps if I do implement a Basic first which is very doable then that might give me a breather while I tackle the rather more demanding Python. Tally ho.
  • ozpropdevozpropdev Posts: 2,791
    edited 2015-03-17 02:22
    Maybe I'm dreaming. What do you think? Am I mad? Will I regret it? Basic would be a lot easier.....
    Your certainly not mad Peter.
    Based on your Tachyon work I'm sure you'll come up with something neat.
    I was thinking of dabbling in a similar project on the P2 when it arrives.
    Looking forward to seeing what you come up with :)
    Cheers
    Brian
  • RaymanRayman Posts: 13,895
    edited 2015-03-17 03:35
    Integrating an Intel Edison module with Propeller somehow would provide another path to Python programming...
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2015-03-17 04:08
    Adding I/O to the Pi is a lot easier than adding Python to the P1.

    As Heater said a few posts back, CS classes teach algorithms not languages. The language is just a tool which needs to be as invisible as possible. And the chip chosen is even less important.

    Those few courses that actually teach embedded design and where students are exposed to the chip datasheet won't be interested in the P1 or P2. It'll be ARM all the way because that's what industry wants and that's where the jobs are.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-03-17 04:22
    I think Peter's approach is the only one that has any hope of succeeding: i.e. making the Python VM run under another VM, in this case, forth's. This is the approach that Zilog used with their Z8671 BASIC. The entire editor/interpreter was written in a threaded byte-code language. It wasn't fast, but it did the job and enabled functionality that would not have fit the chip otherwise.

    BTW, I believe Python is garbage-collected. This is an almost ideal function for a separate cog to perform in the background. It'll be interesting to see if it can be done without affecting determinism, which is otherwise a problem for single-processor garbage-collected languages.

    -Phil
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-17 04:50
    re:BTW, I believe Python is garbage-collected

    Garbage Collection for Python
    http://arctrix.com/nas/python/gc/
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-17 04:51
    re:The hype of Phyton is quite connected with the RasPi. I am not at all sure that it is a good language to learn to program.

    While it may seem like that is a fair statement I would argue that the opposite is true in that >> by having Python available on the Raspberry Pi it made the Pi more acceptable and Python contributed greatly to the Pi's success..

    Also, if you look at the timeline for the Raspberry (below) and the date (summer 2014) of the the articles that showed just how popular Python had gotten (I published the links in a few posts above) It shows that Python was already popular.

    Post-launch

    16 April 2012 – Reports appear from the first buyers who had received their Raspberry Pi.[177][178]
    20 April 2012 – The schematics for the Model A and Model B are released.[179]
    18 May 2012 – The Foundation reported on its blog about a prototype camera module they had tested.[180] The prototype used a 14-megapixel module.
    22 May 2012 – Over 20,000 units had been shipped.[181]

    As a matter of fact it is generally accepted that Python is the single most useful language to know for the Raspberry Pi.

    re: I am not at all sure that it is a good language to learn to program.

    With Python you have a easy to use general purpose language that has a syntax that's easy to learn. It's a scripting language that can scale from a single simple tasks to big data . For example you can do physical computing, audio and video, 3d graphics, Minecraft programming, and games, analytical and quantitative computing. You have a very large library base to work from. Programs you write take less time and you write less lines of code that languages such as Java, C++ etc .It's also cross platform.
    I could go on but I don't have time to write a book LOL

    Other than it's a little slow compared to some other languages , what's not to like?
  • Heater.Heater. Posts: 21,230
    edited 2015-03-17 05:19
    Bob,

    Python has been an important part of the Pi concept since the beginning. It's called a Pi as a play on Python.

    The beginning goes back to 2006 when Eben Upton conceived the Raspberry Pi idea. His first prototype was not ARM based and did not run Linux. It was more like an Arduino that ran Python. Sadly I can't find a link to a description of that prototype just now.

    Python is a fine language for a beginner to programming. The proof of that is the success of tens of thousands of children getting on with the Pi.

    Of course Python is also a "serious" language used by many professionals as well.

    What's not to like? Only the performance and the stupid white space block delimiting.
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-17 05:36
    @ Heater

    re:Python has been an important part of the Pi concept since the beginning. It's called a Pi as a play on Python.

    No one is arguing with that and no doubt by having the Python language on the Pi has helped the language grow. . The discussion is questioning whether the Python language was popular when the Pi boards were released to the public vrs the Pi making the language popular.
  • TappermanTapperman Posts: 319
    edited 2015-03-17 05:45
    Heater. wrote: »
    But now it's frikken Python. On micro controllers! Be serious.

    I hear that! I have a desktop pc ... I do not use a prop for word processing ... and I don't plan on mounting my desktop pc on a drone ... seems they each have their place.

    ... Tim
  • yetiyeti Posts: 818
    edited 2015-03-17 05:52
    Heater. wrote: »
    What's not to like? Only the performance
    http://pypy.org/
    Heater. wrote: »
    and the stupid white space block delimiting.
    http://www.pythonb.org/
    (I never tested this...)

    I can haz SPIN with braces?
    Pleaaaaaase...
  • prof_brainoprof_braino Posts: 4,313
    edited 2015-03-17 06:17
    I'm late to the discussion, so apologies it these points have been covered.

    To run on Prop 1 and still have room to do work, ant app must be designed to run on the P1 (under 32K).
    Also if you want interactive, support for keyboard, mouse, video out, it needs to be designed for this.
    Finally, if you want ability to communicate with RPi and other controller, whatever needs to be designed for it.

    Propforth is specificially designed for all this. Also, propforth is specifically designed to handle sensor and actuator preprocessinga and filtering, and to act as the real time portion in junction with a linux (or any other PC workstation OS) node.

    While propforth is of course FORTH, any set of python interface functions could be created. These could be stored on SD and loaded on the fly using the existing paging mechanism. As long as the function obey the 2k buffer, guidelines, one could have and unlimited number of functions.

    Propforth 6 is in the process of packaging for public release, and included pooled-tasking support. Pooled tasking allow as many tasks as one can fit in memory, with a slight cost for task pool overhead.

    Work would need to be done to decide what the python interface needs to look like, but all the parts are right there ready to be put together.

    Realtime on the prop, interface to linux workstation. Boom. Right tool for the right job. Everything except the python bits.
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-03-17 06:27
    What do you do after you add braces to Python?
    What's next

    There's still a lot of work to be done. We're planning to:

    Add indentation support to C language

    I love these guys!!!! :D
Sign In or Register to comment.