[Tutor] Matrix

2004-12-19 Thread Bugra Cakir
hi,

I want to create a matrix in Python. For example 3x4 how can i
create this? thanks
___
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Help IDLE Compile Problem

2006-07-11 Thread Bugra Cakir
Hi,I have two Python source files within editing them via IDLE.I have a problem. The second file is used by the first file. Some partsi mean from the second file is used. But when i change the contents of the
second file and while i'm running the first file with F5, change doesnt reflectto the runtime. If i close two IDLE windows and delete .pyc of the second filethen it is ok. What is the problem ?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] IDLE Caching

2006-07-23 Thread Bugra Cakir
Hi,I have a problem with IDLE on Windows.While I'm executing a python script in IDLE subsequenceediting and executions on the file sometimes doesn't reflect the changes.For example, i changed the file then save it, execute it, although i changed
the file, IDLE shows the previous version of the file. If I close and run the IDLEthen it correctly shows the execution of the current source file. What will bethe problem ?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
class Tree:    def Tree(self):    self.rootNode = None    def Tree(self, rootNode):    self.rootNode = rootNode    def getRootNode(self):    return self.rootNode    def setRootNode(self, rootNode):
    self.rootNode = rootNodeclass Node:    def Node(self):    self.content = ''    self.isleaf = False    self.childnode = None    self.label = ''    def setContent(self, content=''):
    self.content = content    def getContent(self):    return self.content    def setLeaf(self, leaf):    self.isleaf = leaf    def isLeaf(self):    return self.isleaf    def setChild(self, childnode):
    self.childnode = childnode    def getChild(self):    return self.childnode    def setLabel(self, label=''):    self.label = label    def getLabel(self):    return self.label
t = Tree()n = Node()look at this code. Edit this code with IDLE. For example change one of the 'self' statementin the code. For instance change self => slf then save the file and press F5(Run Module)
It doesn't complain about the code !!! this is my problem.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
Really, I have realized the difference Luke said. However sometimes IDLE runs theold version, this is the thing I cant realized.On 7/24/06, Luke Paireepinart
 <[EMAIL PROTECTED]> wrote:
[snip code]> look at this code. Edit this code with IDLE. For example change one of> the 'self' statement> in the code. For instance change self => slf then save the file and> press F5(Run Module)
> It doesn't complain about the code !!! this is my problem.>I think maybe you're just confused about what 'self' is.'self' is not a reserved keyword that's used for the name of classinstances.
for example:#-start code---class Foo(object):def __init__(abracadabra):   print 'BAR!'   print abracadabra   abracadabra.random_variable = 42#make an instance of Foo and call its __init__
x = Foo()#print the value of random_variableprint x.random_variable#end code-#---start outputBAR!<__main__.Foo object at 0x00F0C930>42#---end output
does this clear anything up for you?There's no reason to name your first arguments ofmethods of class instances 'self' other thanreadability and tradition.  To the compilerit makes no difference.
Do you still think it's a problem with IDLE?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
So from the answers, i want to imagine how python exercise the codewhen you push the button execute. My guess before looking at the docsor other material,1. check python syntax
2. transform to byte code.3. execute the byte code.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE Caching

2006-07-24 Thread Bugra Cakir
let me dig into documentation before thinking in the blind :) thanks a lot Alan !On 7/25/06, Alan Gauld <
[EMAIL PROTECTED]> wrote:> So from the answers, i want to imagine how python exercise the code
> when you push the button execute. My guess before looking at the> docs> or other material,>> 1. check python syntax> 2. transform to byte code.> 3. execute the byte code.
What you have is correct for a main program.If its a module being imported there is a slight difference:0) check if module already loaded, if yes stop1) check if a pre-compiled version already exists
2) check if the source file is newer3) if newer compile code to byte code and save pyc file4) import byte codeThis is described in more detail in the documentation.Alan GauldAuthor of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 31, Issue 26

2006-09-11 Thread Bugra Cakir
Hi,My thought is seperate main and utility functions to different files.For example there will be a Main.py and UsbUtil.py and from Main.pyyou can import usb functions.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor