Re: [Tutor] How python keeps track of data types

2016-03-29 Thread Danny Yoo
Hi Abhishek,

On Mon, Mar 28, 2016 at 12:31 PM, Abhishek Kumar
 wrote:
> Hello
> I am a computer science student,I want to know how python keeps track of
> data types of variables and is there a way to get data types of variables
> without actually running the script(with type() function). I think python
> AST can help, but am unable to figure out.Please help me.
> I've explored compiler library but could not find anything helpful.


This is not a beginner-level question.  You may not be reaching the
audience you want here.  You're essentially asking for a static type
system for Python.  Python was not particularly designed to
accommodate a static type system  It is dynamically typed: in Python,
types are attached to values, not variables.

Start reading:

https://en.wikipedia.org/wiki/Type_system#Dynamic_type_checking_and_runtime_type_information


Your question is an active area of CS research.  Therefore, we can't
provide clear, direct answers to your question: you have to do your
own searching.  Here are a few starting points.

http://lambda-the-ultimate.org/node/1519

http://lambda-the-ultimate.org/node/2622

https://www.cis.upenn.edu/~bcpierce/tapl/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How python keeps track of data types

2016-03-29 Thread Abhishek Kumar
Thanks everyone for answers and links.I wasn't aware of fact that python
names are just references to Objects.


Abhishek

On Tue, Mar 29, 2016 at 1:01 AM, Abhishek Kumar 
wrote:

> Hello
> I am a computer science student,I want to know how python keeps track of
> data types of variables and is there a way to get data types of variables
> without actually running the script(with type() function). I think python
> AST can help, but am unable to figure out.Please help me.
> I've explored compiler library but could not find anything helpful.
>
> Thanks
> Abhishek Kumar
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Fwd: How python keeps track of data types

2016-03-29 Thread khalil zakaria Zemmoura
-- Forwarded message --
From: Abhishek Kumar 
Date: 2016-03-29 7:15 GMT+01:00
Subject: Re: [Tutor] How python keeps track of data types
To: Tutor@python.org


Thanks everyone for answers and links.I wasn't aware of fact that python
names are just references to Objects.


Abhishek

On Tue, Mar 29, 2016 at 1:01 AM, Abhishek Kumar 
wrote:

> Hello
> I am a computer science student,I want to know how python keeps track of
> data types of variables and is there a way to get data types of variables
> without actually running the script(with type() function). I think python
> AST can help, but am unable to figure out.Please help me.
> I've explored compiler library but could not find anything helpful.
>
> Thanks
> Abhishek Kumar
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Hi Abhishek

You may also take a look at this video tutorials serie that was done by
Doctor Philip Guo if you are iterested at looking to the python internal
and how it works under the hood

https://www.youtube.com/watch?v=ngkl95AMl5M&list=PLzV58Zm8FuBL6OAv1Yu6AwXZrnsFbbR0S

Best regards
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Lisa Hasler Waters
Hello All,

I have a few students who are interested in creating interactive games in
Python. We have learned how to use tkinter but we are looking for something
more robust. I tried using pygame but cannot seem to get it initialized. I
continually get this error:


Traceback (most recent call last):
  File "/Users/lwaters/Desktop/pygameTest.py", line 1, in 
import pygame, sys
  File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
line 95, in 
from pygame.base import *
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,
2): no suitable image found.  Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
no matching architecture in universal wrapper
>>>

Any thoughts would be appreciated!

Thanks so much, Lisa Waters - a novice Python-er
-- 
Lisa Waters, PhD
Technology Integration
Flint Hill School
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Bob Gailer
On Mar 29, 2016 2:03 PM, "Lisa Hasler Waters"  wrote:
>
> I continually get this error:
>
>
> Traceback (most recent call last):
>   File "/Users/lwaters/Desktop/pygameTest.py", line 1, in 
> import pygame, sys
>   File
>
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
> line 95, in 
> from pygame.base import *
> ImportError:
>
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,
> 2): no suitable image found.  Did find:
>
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
> no matching architecture in universal wrapper
I assume you are running python 2.7 . true?
What operating system?
How did you install pygame?
First guess uninstall and reinstall a game.
Any other information you can give us may help.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Lisa Hasler Waters
Thanks Bob.

Using Mac, OS 10.11 El Cap
Yes running Python 2.7
Installed the Pygame from: http://www.pygame.org/download.shtml 1.9.1

I could try to uninstall/re -- but I'll wait to see if anyone has other
suggestions based on the new info I've provided.

Thx

On Tue, Mar 29, 2016 at 2:18 PM, Bob Gailer  wrote:

>
> On Mar 29, 2016 2:03 PM, "Lisa Hasler Waters" 
> wrote:
> >
> > I continually get this error:
> >
> >
> > Traceback (most recent call last):
> >   File "/Users/lwaters/Desktop/pygameTest.py", line 1, in 
> > import pygame, sys
> >   File
> >
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
> > line 95, in 
> > from pygame.base import *
> > ImportError:
> >
> dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,
> > 2): no suitable image found.  Did find:
> >
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
> > no matching architecture in universal wrapper
> I assume you are running python 2.7 . true?
> What operating system?
> How did you install pygame?
> First guess uninstall and reinstall a game.
> Any other information you can give us may help.
>



-- 
Lisa Waters, PhD
Technology Integration
Flint Hill School
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Oscar Benjamin
On 29 Mar 2016 21:19, "Bob Gailer"  wrote:
>
> On Mar 29, 2016 2:03 PM, "Lisa Hasler Waters" 
wrote:
> >
> > I continually get this error:
> >
> >
> > Traceback (most recent call last):
> >   File "/Users/lwaters/Desktop/pygameTest.py", line 1, in 
> > import pygame, sys
> >   File
> >
>
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
> > line 95, in 
> > from pygame.base import *
> > ImportError:
> >
>
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,
> > 2): no suitable image found.  Did find:
> >
>
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
> > no matching architecture in universal wrapper
> I assume you are running python 2.7 . true?
> What operating system?
> How did you install pygame?
> First guess uninstall and reinstall a game.
> Any other information you can give us may help

Just guessing here but the error suggests a mismatch between 32 and 64 bit
binaries. Is it possible that you have installed 32 bit Python and 64 bit
pygame or vice-versa?

(I'm not an OSX user but I think that's what the error can mean.)

--
Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Alan Gauld
On 29/03/16 19:03, Lisa Hasler Waters wrote:

> I have a few students who are interested in creating interactive games in
> Python. We have learned how to use tkinter but we are looking for something
> more robust. 

I'm not sure what you mean by robust. Tkinter is fine for
low speed/non-graphics intensive type games but probably
a bit clunky for graphics. But it should be robust in
the sense of reliable...


> I tried using pygame but cannot seem to get it initialized. I
> continually get this error:

> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
> no matching architecture in universal wrapper

Sounds like you installed the wrong version of pygame for your Mac.
The pygame support forum are probably the best folks to ask for specific
issues like this.

PyGin and Albow are other games based frameworks you could
investigate. And of course there is OpenGL which plays very
well with MacOSX.

Try this link for more:

https://wiki.python.org/moin/PythonGameLibraries

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Lisa Hasler Waters
Wonderful! Thanks Alan and Oscar. I will proceed with the various
suggestions and hopefully will be successful.

Thanks again so very much for all your support and help!

Lisa

On Tue, Mar 29, 2016 at 3:19 PM, Alan Gauld 
wrote:

> On 29/03/16 19:03, Lisa Hasler Waters wrote:
>
> > I have a few students who are interested in creating interactive games in
> > Python. We have learned how to use tkinter but we are looking for
> something
> > more robust.
>
> I'm not sure what you mean by robust. Tkinter is fine for
> low speed/non-graphics intensive type games but probably
> a bit clunky for graphics. But it should be robust in
> the sense of reliable...
>
>
> > I tried using pygame but cannot seem to get it initialized. I
> > continually get this error:
>
> >
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
> > no matching architecture in universal wrapper
>
> Sounds like you installed the wrong version of pygame for your Mac.
> The pygame support forum are probably the best folks to ask for specific
> issues like this.
>
> PyGin and Albow are other games based frameworks you could
> investigate. And of course there is OpenGL which plays very
> well with MacOSX.
>
> Try this link for more:
>
> https://wiki.python.org/moin/PythonGameLibraries
>
> HTH
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Lisa Waters, PhD
Technology Integration
Flint Hill School
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Oscar Benjamin
On 29 Mar 2016 22:20, "Alan Gauld"  wrote:
>
> PyGin and Albow are other games based frameworks you could
> investigate. And of course there is OpenGL which plays very
> well with MacOSX.

OpenGL plays nicely with Windows and Linux as well. I think that pygame
actually uses pyglet which is an OpenGL wrapper behind the scenes. I'm not
sure what kind of class this setup is for but I doubt that using raw OpenGL
is appropriate here. Some kind of higher level wrapper (e.g. pygame) is
what you'd want.

I'm not sure how well maintained pygame is any more though. Does anyone
know?

--
Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Alan Gauld
On 29/03/16 22:17, Oscar Benjamin wrote:
>
>
> On 29 Mar 2016 22:20, "Alan Gauld"  > wrote:
>
> > investigate. And of course there is OpenGL which plays very
> > well with MacOSX.
>
> OpenGL plays nicely with Windows and Linux as well.
>

But not so well as MacOS X because the OS itself (or the GUI part) is
written in/for OpenGL. So in addition to raw OpenGL you also get to
mix n' match the OSX graphics libraries. You can't do that as easily
in X or Windows is an add-on library, not a native part of the OS.

But I agree raw OpenGL would be too low level for most games
development (unless you really want high performance, but then
you probably wouldn't use python...). But if you wanted high
performance within the context of a single window then OpenGL
might be worth exploring.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor