Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Kent Johnson
Dave Kuhlman wrote: > If there were really such a thing as nested > scopes/namespaces, we would have a function that would give us > access to them, similar to the way that locals() and globals() > give us access to the local and global namespace. > Nested namespaces are actually stored with the

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Kent Johnson
Dave Kuhlman wrote: > On Thu, Jul 27, 2006 at 05:34:13PM +0100, Alan Gauld wrote: > >> Hi Dave, >> >> You are causing yourself some confusion by still treating variables >> as something other than a name. Your first paragraph says: >> >> (Actually, functions and classes are just variables that h

[Tutor] Problems with encoding

2006-07-28 Thread mjekl
>kent37 at tds.net wrote: >>mjekl at iol.pt wrote: >> Hi, >> >> >> My interpreter in set via sitecustomize.py to use utf-8 as default encoding. >> >> I'm reading fields from a dbf table to a firebird db with encoding set to >> win1252. >> I guess it's original encoding is cp850, but am not sure,

[Tutor] visualization

2006-07-28 Thread Сергій
I have a world (environment), where live different objects. And all objects like to move.   This is the code: """ import random, time, Tkinter class Object:    def __init__ (self, x=10, y=10):    self.name = random.randint(0, 10)    self.x = x    self.y = y     def __repr__ (self):

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Danny Yoo
> If there were really such a thing as nested scopes/namespaces, we would > have a function that would give us access to them, similar to the way > that locals() and globals() give us access to the local and global > namespace. It would be _convenient_ to have such a function for inspection, bu

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Dave Kuhlman
On Thu, Jul 27, 2006 at 12:46:44PM -0400, Kent Johnson wrote: > Dave Kuhlman wrote: > > I've written up a few notes on Python namespaces and scopes. If > > anyone has corrections, comments, or suggestions, I'd appreciate > > them. You can find my comments here: > > > > http://www.rexx.com/~dku

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-28 Thread Dave Kuhlman
On Thu, Jul 27, 2006 at 05:34:13PM +0100, Alan Gauld wrote: > Hi Dave, > > You are causing yourself some confusion by still treating variables > as something other than a name. Your first paragraph says: > > (Actually, functions and classes are just variables that hold > references to function an

Re: [Tutor] MySQLdb question.

2006-07-28 Thread shawn bright
you may be missing db.commit(). When you do insert, update, etc.. you call commit() to make the changes stick.-skOn 7/28/06, Kent Johnson < [EMAIL PROTECTED]> wrote:Ron Phillips wrote:> I am trying to write a script that adds data to a table using > MySQLdb.py.  For some reason, "INSERT" seems to w

Re: [Tutor] MySQLdb question.

2006-07-28 Thread Ron Phillips
That was it all right! Thanks, Kent! Ron___Ron Phillips wrote: > I am trying to write a script that adds data to a table using > MySQLdb.py. For some reason, "INSERT" seems to work temporarily. I > run a command to insert a row, and then do a select query, and it's > there. Aft

Re: [Tutor] MySQLdb question.

2006-07-28 Thread Kent Johnson
Ron Phillips wrote: > I am trying to write a script that adds data to a table using > MySQLdb.py. For some reason, "INSERT" seems to work temporarily. I > run a command to insert a row, and then do a select query, and it's > there. After the program shuts down, though, it's gone. No rows are >

[Tutor] MySQLdb question.

2006-07-28 Thread Ron Phillips
I am trying to write a script that adds data to a table using MySQLdb.py.  For some reason, "INSERT" seems to work temporarily. I run a command to insert a row, and then do a select query, and it's there. After the program shuts down, though, it's gone. No rows are permanently created. SELECT wor

Re: [Tutor] how to run python's Graphical User Interface forEnvironments in agents.py

2006-07-28 Thread Сергій
2006/7/28, Alan Gauld <[EMAIL PROTECTED]>: > I have python24.> But just "*v = VacuumEnvironment(); w = EnvFrame(v);*" do nothing - > I don't> see any Graphical User Interface for Environments.> What am I doing wrong and how to compel this piece of code to return> a> Graphical User Interface for En

Re: [Tutor] how to run python's Graphical User Interface forEnvironments in agents.py

2006-07-28 Thread Alan Gauld
> I have python24. > But just "*v = VacuumEnvironment(); w = EnvFrame(v);*" do nothing - > I don't > see any Graphical User Interface for Environments. > What am I doing wrong and how to compel this piece of code to return > a > Graphical User Interface for Environments? Did you delete the tripl

Re: [Tutor] how to run python's Graphical User Interface for Environments in agents.py

2006-07-28 Thread Сергій
The entire last section of the code - from "import Tkinter as tk" to the end - is enclosed in triple-quotes ('''). This makes it into a string constant rather than code, effectively commenting it out. Try removing the two lines that just contain '''.Kent   I removed triple-quotes. And after learni

Re: [Tutor] playing around with function

2006-07-28 Thread Danny Yoo
>def navigated(self): >if (self.state == 'NF') and > (self.store.units[int(self.id)].isfuzzy()): >return True >if (self.state == 'PF') and > (self.store.units[int(self.id)].isfuzzy()): >return True >if (self.state == 'NT') and > (self.store.unit

Re: [Tutor] how to run python's Graphical User Interface for Environments in agents.py

2006-07-28 Thread Kent Johnson
Сергій wrote: > > > > > > > I am reading " Artificial Intelligence: A Modern Approach > http://ai

Re: [Tutor] playing around with function

2006-07-28 Thread Kent Johnson
kakada wrote: > # I have change my code style like this: > > def gotoNF(self): > self.state = "NF" > self.navigationNext(self.state) > def gotoNT(self): > self.state = "NT" > self.navigationNext(self.state) > def gotoNU(self): > self.state = "NU"

[Tutor] how to run python's Graphical User Interface for Environments in agents.py

2006-07-28 Thread Сергій
  I am reading " Artificial Intelligence: A Modern Approach" now (http://aima.cs.berkeley.edu/), and there are some ready python code from this book ( http://aima.cs.berkeley.edu/python/readme.html). And I have some problems with the code http://aima.cs.berkeley.edu/python/agents.py     It is said

Re: [Tutor] playing around with function

2006-07-28 Thread kakada
បានសរសេរ kakada: > Thank Alan and Luke, > > My coding is divided up into many modules and import from one to another. > Here is my editor.py interface. > > > #!/usr/bin/python > # -*- coding: utf8 -*- > > import sys > import application_rc > from PyQt4 import QtCore, QtGui > from ui_editor import U

Re: [Tutor] playing around with function

2006-07-28 Thread kakada
Thank Alan and Luke, My coding is divided up into many modules and import from one to another. Here is my editor.py interface. #!/usr/bin/python # -*- coding: utf8 -*- import sys import application_rc from PyQt4 import QtCore, QtGui from ui_editor import Ui_MainWindow from translate.storage imp

Re: [Tutor] playing around with function

2006-07-28 Thread Alan Gauld
"kakada" <[EMAIL PROTECTED]> wrote > I have problem with function jumping: I'm not sure what you mean by "function jumping" but I'll make a few comments... > in my class, I have three function here: > > def gotoNextFuzzy(self): >state = "isfuzzy" >self.navigationNext(state) > > d

Re: [Tutor] playing around with function

2006-07-28 Thread Luke Paireepinart
Where is self.ui initialized? are these functions part of a class? Why didn't you send the __init__ method? why didn't you send the whole class structure? >def gotoNextFuzzy(self): >state = "isfuzzy" >self.navigationNext(state) >def gotoNextFuzzy(self): >state = "isapprov