Fill memeory with endless loop?

2008-05-13 Thread globalrev
if i do something like while 1: print "x" will the program ever stop because it runs out of memory? or is the print x never stored somewhere? if u do soemhting like add element to a list it has an upper nbr of elements right? if though huge... does windows or any other OS have some proces that

Re: Fill memeory with endless loop?

2008-05-13 Thread globalrev
On 13 Maj, 18:59, Filip Štědronský <[EMAIL PROTECTED]> wrote: > On Út, kvě 13, 2008 at 06:49:33 +0200, globalrev wrote: > > > if i do something like > > while 1: > > print "x" > > > will the program ever stop because it runs out of memory? >

Re: usage of python

2008-05-13 Thread globalrev
On 13 Maj, 19:10, Rajarshi <[EMAIL PROTECTED]> wrote: > Hi, I teach an introductory programming course in Python. As part of > the introduction I'd like to highlight the usage of Python in > industry. The idea is to show that there are big players using Python > for a variety of tasks. Given that t

variable scope question?

2008-05-13 Thread globalrev
http://mail.python.org/pipermail/python-list/2003-October/233435.html why isnt it printing a in the second(second here, last one in OP) example before complaining? def run(): a = 1 def run2(b): a = b print a run2(2) print a run() def run(): a = 1 def run2(b): print a

python: lexical or dynamic scope?

2008-05-13 Thread globalrev
i cant figure outif python has lexical or general scope. it seems functions have lexical scope but with some restrictions and some non-function scopes are dynamic? -- http://mail.python.org/mailman/listinfo/python-list

built in list generator?

2008-05-13 Thread globalrev
if i want a list with all numbers between x and y is there a way to do this with an inbult function. i mean i can always construct a function to do this but is there soemthing like: nbrs = list(range(50,100, 2)) -- http://mail.python.org/mailman/listinfo/python-list

2004 example, passing function error

2008-05-13 Thread globalrev
http://linuxgazette.net/109/pramode.html >>> >>>def sqr(x): return x*x ... >>>def cube(x): return x*x*x ... >>>sqr >>>a = [sqr, cube] >>>a[0](2) >>>def compose(f, g): return f(g(x)) ... >>>compose(sqr, cube, 2) 64 >>> but i get: >>> compose(sqr, cube, 2) Traceback (most recent call last): F

datamining .txt-files, library?

2008-05-15 Thread globalrev
i have a big collection of .txt files that i want to open and parse to extract information. is there a library for this or maybe even built in? -- http://mail.python.org/mailman/listinfo/python-list

Re: datamining .txt-files, library?

2008-05-15 Thread globalrev
On 15 Maj, 14:40, George Sakkis <[EMAIL PROTECTED]> wrote: > On May 15, 8:27 am, globalrev <[EMAIL PROTECTED]> wrote: > > > i have a big collection of .txt files that i want to open and parse to > > extract information. > > > is there a library for this or

exists=false, but no complaint when i open it!?

2008-05-15 Thread globalrev
print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet \trainingsetunzipped\training_set\mv_001.txt') d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- sweden.gif') d.close() exists returns false but when i open it doesnt complain. how come? another file that exists ret

file open/read/name etc, not working

2008-05-15 Thread globalrev
import os print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') d.readline() returns true in the shell but prints no text even though the document contains text. d.name returns nothing, d.name() raises an error. -- http://mail.pyth

Re: file open/read/name etc, not working

2008-05-15 Thread globalrev
On 15 Maj, 18:12, globalrev <[EMAIL PROTECTED]> wrote: > import os > > print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') > d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') > d.readline() > > returns true in the shell bu

Re: file open/read/name etc, not working

2008-05-15 Thread globalrev
On 15 Maj, 18:33, "Andreas Tawn" <[EMAIL PROTECTED]> wrote: > >import os > > >print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') > >d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') > >d.readline() > > >returns true in the shell but prints no text even though the document > >conta

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread globalrev
yeah i was unclear but i tested different stuff at the same time. and flim is not misspelled i just created it and jolted osmething down and it became flim... print os.path.exists('C:/Python25/myPrograms/netflix/flim.txt') d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') #print d.readline()

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread globalrev
when i try to write to the file... Traceback (most recent call last): File "C:\Python25\myPrograms\netflix\netflix.py", line 10, in d.write('hej du galne kock') IOError: [Errno 0] Error -- http://mail.python.org/mailman/listinfo/python-list

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread globalrev
On 15 Maj, 19:04, globalrev <[EMAIL PROTECTED]> wrote: > when i try to write to the file... > > Traceback (most recent call last): > File "C:\Python25\myPrograms\netflix\netflix.py", line 10, in > > d.write('hej du galne kock') > IOError: [E

class problem, NoneType obj has no attribute

2008-05-16 Thread globalrev
wassup here? >>> 7 Traceback (most recent call last): File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in print cust1.getID() AttributeError: 'NoneType' object has no attribute 'getID' >>> class customer: def __init__(self, ID, movies): self.ID = ID self.m

free dictionary english - spanish?

2008-05-16 Thread globalrev
i want to write a translationprogram, i have the webapp done already. i need a big free dictionary though. english-spanish/spanish-english seems like the best i know some spanish and thats what also is needed the most i think together with chinese. anywhere you can download one? preferrably easy

Re: class problem, NoneType obj has no attribute

2008-05-16 Thread globalrev
On 16 Maj, 13:54, Peter Otten <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > globalrev schrieb: > >> cust1 = customer.__init__('12',['1','435','2332']) > > > cust1 = customer('12',['1','4

Re: class problem, NoneType obj has no attribute

2008-05-16 Thread globalrev
On 16 Maj, 14:19, Bruno Desthuilliers wrote: > globalrev a écrit : > > > wassup here? > > > 7 > > > Traceback (most recent call last): > > File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in > > > > print cust1.getID() >

Re: class problem, NoneType obj has no attribute

2008-05-16 Thread globalrev
On 16 Maj, 14:19, Bruno Desthuilliers wrote: > globalrev a écrit : > > > wassup here? > > > 7 > > > Traceback (most recent call last): > > File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in > > > > print cust1.getID() >

write to specific line in file?

2008-05-16 Thread globalrev
i ahve a program that takes certain textsnippets out of one file and inserts them into another. problem is it jsut overwrites the first riow every time. i want to insert every new piece of text into the next row. so: 1. how do i write to a new line every time i write to the file? 2. if i dont wa

save dictionary for later use?

2008-05-16 Thread globalrev
i extract info from one file and put it into a dictionary. i want to save that dictionary for later use, how do i do that? might save a list of dictionaries or a list of classobjects too if there is any difference. -- http://mail.python.org/mailman/listinfo/python-list

Re: save dictionary for later use?

2008-05-16 Thread globalrev
On 16 Maj, 21:22, jay graves <[EMAIL PROTECTED]> wrote: > On May 16, 2:17 pm, globalrev <[EMAIL PROTECTED]> wrote: > > > i extract info from one file and put it into a dictionary. > > i want to save that dictionary for later use, how do i do that? > > might save

maximum recursion depth?

2008-05-27 Thread globalrev
i received an error maximum recursion depth when processing large amounts of data. i dont know exactly how many recursive calls i made but id assume 5 or so. is there a definitie limit to the nbr of calls or is the memory that runs out? is that then the RAMmemory? is there a special amount o

confused by HTMLParser class

2008-05-27 Thread globalrev
tried all kinds of combos to get this to work. http://docs.python.org/lib/module-HTMLParser.html from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print "Encountered the beginning of a %s tag" % tag def handle_endtag(sel

SMS sending and receiving from website?

2008-05-30 Thread globalrev
can i send and receive messages from a website using python? how would that work with costs? would the mobileowner pay both ways? -- http://mail.python.org/mailman/listinfo/python-list

Re: SMS sending and receiving from website?

2008-05-31 Thread globalrev
On 31 Maj, 04:04, John Henderson <[EMAIL PROTECTED]> wrote: > globalrev wrote: > > can i send and receive messages from a website using python? > > Absolutely. But I'm not clear what you mean by "from a > website". Do you mean to use SMPP protocol to lodge

Re: SMS sending and receiving from website?

2008-05-31 Thread globalrev
On 31 Maj, 14:48, globalrev <[EMAIL PROTECTED]> wrote: > On 31 Maj, 04:04, John Henderson <[EMAIL PROTECTED]> wrote: > > > > > globalrev wrote: > > > can i send and receive messages from a website using python? > > > Absolutely. But I'm not

python setup.py install on Vista?

2008-04-18 Thread globalrev
type "python setup.py install" that is used in most "addons" for python. well using windows vista, where the h*** am i supposed to type this? if it is not doable in windows, what do i have to do instead? just clicking the setup.py-file never works. -- http://mail.python.org/mailman/listinfo/pyt

random.random(), random not defined!?

2008-04-19 Thread globalrev
do i need to import something to use random? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, getting canvas-object, how?

2008-04-19 Thread globalrev
On 19 Apr, 10:15, Rafał Wysocki <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] napisa³(a): > > > > > so i load a gif onto a canvas and when i click the canvs i want to get > > the color of the pixel that is clicked. > > so i need to ge the object im clicking. > > i was told in another thread to use

Re: Tkinter, getting canvas-object, how?

2008-04-19 Thread globalrev
On 19 Apr, 21:43, globalrev <[EMAIL PROTECTED]> wrote: > On 19 Apr, 10:15, Rafaù Wysocki <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] napisa³(a): > > > > so i load a gif onto a canvas and when i click the canvs i want to get > > > the

Re: Frame work for simple physics web applications

2008-04-19 Thread globalrev
On 19 Apr, 21:55, Rick Muller <[EMAIL PROTECTED]> wrote: > I'd like to use my webserver to distribute some simple python physics > apps. Ideally, I'd like to use some simple form to input a few pieces > of data, call a python program, and return some image from a plot or > some other rendering. Thi

Bigger projects, including files?

2008-04-19 Thread globalrev
if i have a larger project and want to divide my program into several files, how do i include these files in the mainprogram? using import someprojectfile doesnt work because import is for site- packages right and i dont want to put all my files in that folder. so how do i do it? -- http://mail

Re: Bigger projects, including files?

2008-04-19 Thread globalrev
On 20 Apr, 02:04, "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote: > globalrev wrote: > > if i have a larger project and want to divide my program into several > > files, how do i include these files in the mainprogram? > > > using import someprojectfil

cherrypy-webapp-code?

2008-04-20 Thread globalrev
anyone have a small cherrypy-webapp and are willing to post the code. could be a nonsense-app just wanna see some code. -- http://mail.python.org/mailman/listinfo/python-list

close GUI and quit script?

2008-04-20 Thread globalrev
how do i close a GUI and end the mainloop of the script? -- http://mail.python.org/mailman/listinfo/python-list

question about the mainloop

2008-04-20 Thread globalrev
in C?? java etc there is usually: procedure 1 procedure 2 procedure 3 main { procedure 1 procedure 2 procedure 3 } i dont get the mainloop() in python. i mean i have written some programs, for example a calculator using tkinterGUI. if i have some functions i wanna call to run the program and i

Re: question about the mainloop

2008-04-20 Thread globalrev
On 21 Apr, 04:26, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 20 Apr 2008 20:24:04 -0300, globalrev <[EMAIL PROTECTED]> escribió: > > > in C?? java etc there is usually: > > > procedure 1 > > procedure 2 > > procedure 3 >

Re: question about the mainloop

2008-04-22 Thread globalrev
On 21 Apr, 07:31, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 21 Apr 2008 00:57:38 -0300, globalrev <[EMAIL PROTECTED]> escribió: > > > > > On 21 Apr, 04:26, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> En Sun, 2

function that accepts any amount of arguments?

2008-04-23 Thread globalrev
if i want a function that can take any amount of arguments how do i do? lets say i want a function average that accepts any number of integers and returns the average. -- http://mail.python.org/mailman/listinfo/python-list

Re: python and web programming, easy way...?

2008-04-27 Thread globalrev
On 27 Apr, 04:26, miya <[EMAIL PROTECTED]> wrote: > On Apr 26, 4:36 pm, bvidinli <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > i use currently python for console programming. > > in past, i tried it for web programming, to use it instead of php. > > Unfortunately, i failed in my attempt to switch

PyGame, window is not closing, tut not helping

2008-05-01 Thread globalrev
im doing this : http://www.learningpython.com/2006/03/12/creating-a-game-in-python-using-pygame-part-one/ and when closing the program the window stays up and doesnt respond. i tried adding this: http://www.pygame.org/wiki/FrequentlyAskedQuestions bu it doesnt work, or maybe im doing it wrong. h

Re: PyGame, window is not closing, tut not helping

2008-05-01 Thread globalrev
another program that has the same problem: import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load("snake.png") ballrect = ball.get_rect() while 1: for event in pygame.event.get():

pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread globalrev
if pygame.key.get_pressed[K_a]: print "Muppet" K_a is not defined. but yes it is. why do i get this error? this works: if pygame.key.get_pressed(): print "donkey" -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread globalrev
On 2 Maj, 18:13, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > globalrev schrieb: > > > if pygame.key.get_pressed[K_a]: > > print "Muppet" > > > K_a is not defined. > > > but yes it is. why do i get this error? > &g

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread globalrev
print pygame.K_a displays 97 btw. what does that mean? i though it would return true or false or 0 or 1. -- http://mail.python.org/mailman/listinfo/python-list

pygame: rect moveto?

2008-05-03 Thread globalrev
http://www.pygame.org/docs/ref/rect.html#Rect.move well i need to put my rect ina specific place and i donw know from where i will move it so i need a function rect.moveTo(x,y). how do i do that? -- http://mail.python.org/mailman/listinfo/python-list

pygame.mixer.load not working

2008-05-04 Thread globalrev
import pygame pygame.mixer.music.load(example1.mp3) pygame.mixer.music.play(loops=1, start=0.0) Traceback (most recent call last): File "C:\Python25\myPrograms\pygameProgs\musicexp.py", line 3, in pygame.mixer.music.load(example1.mp3) NameError: name 'example1' is not defined example1 is

pygame music, cant read mp3?

2008-05-05 Thread globalrev
http://www.pygame.org/docs/ref/mixer.html import pygame #pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=3072) //it complained abiout words= so i guess its only the nbrs should be there// pygame.mixer.init(22050, -16, 2, 3072) pygame.mixer.music.load("example1.mp3") pygame.mixer

confused about self, why not a reserved word?

2008-05-05 Thread globalrev
class Foo(object): def Hello(self): print "hi" object is purple, ie some sort of reserved word. why is self in black(ie a normal word) when it has special powers. replacing it with sel for example will cause an error when calling Hello. -- http://mail.python.org/mailman/li

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 13:47, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > globalrev wrote: > >http://www.pygame.org/docs/ref/mixer.html > > > import pygame > > > #pygame.mixer.init(frequency=22050, size=-16, channels=2, > > buffer=3072) //it complained abio

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 14:03, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 13:47, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > globalrev wrote: > > >http://www.pygame.org/docs/ref/mixer.html > > > > import pygame > > > > #p

Re: confused about self, why not a reserved word?

2008-05-05 Thread globalrev
sorry i noticed now a little error, i was playing around a lot and saw that on the sel-example i had then called foo.hello() instead of foo.Hello(). but it was an informing error now i egt it. was wondering about self anyway so thanks for clearing it up. but it still is a bit confusing that u c

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> wrote: > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') > > Are you sure that: > > os.path.exists('C:/Pyth

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 16:09, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > wrote: > > > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 16:29, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 16:09, globalrev <[EMAIL PROTECTED]> wrote: > > > > > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > > wrote: > > > > 2008/5/5, globalrev <[EMAIL PRO

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 17:25, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > directory = ['C:','Python25','myPrograms','pygameProgs','dront.mp3'] > > os.path.join(directory) > > > Then python can worry about the gritty details, and you don't have to. > > Or somewhat neater IMHO: > > os.path.join('C:','Python

explain this function to me, lambda confusion

2008-05-07 Thread globalrev
i have a rough understanding of lambda but so far only have found use for it once(in tkinter when passing lambda as an argument i could circumvent some tricky stuff). what is the point of the following function? def addn(n): return lambda x,inc=n: x+inc if i do addn(5) it returns

Re: explain this function to me, lambda confusion

2008-05-07 Thread globalrev
and what si the diffrence here: g = lambda x=5:x*x g = lambda x:x*x the first was a mistake to write but it worked and the x=5 seems to be completely ignored. why? it has no effect at all? -- http://mail.python.org/mailman/listinfo/python-list

Re: explain this function to me, lambda confusion

2008-05-07 Thread globalrev
On 7 Maj, 23:47, globalrev <[EMAIL PROTECTED]> wrote: > and what si the diffrence here: > > g = lambda x=5:x*x > g = lambda x:x*x > > the first was a mistake to write but it worked > and the x=5 seems to be completely ignored. why? it has no effect at > all? ah w

regexp help

2008-05-09 Thread globalrev
i want to a little stringmanipulationa nd im looking into regexps. i couldnt find out how to do: s = 'poprorinoncoce' re.sub('$o$', '$', s) should result in 'prince' $ is obv the wrng character to use bu what i mean the pattern is "consonant o consonant" and should be replace by just "consonant".

Re: regexp help

2008-05-09 Thread globalrev
ty. that was the decrypt function. i am slo writing an encrypt function. def encrypt(phrase): pattern = re.compile(r"([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])") return pattern.sub(r"1\o\1", phrase) doesnt work though, h becomes 1\\oh. def encrypt(phrase): pattern = re.compile(r

Re: regexp help

2008-05-09 Thread globalrev
> The inner pair of () are not necessary. yes they are? ty anyway, got it now. -- http://mail.python.org/mailman/listinfo/python-list

do you fail at FizzBuzz? simple prog test

2008-05-10 Thread globalrev
http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: "Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers