why are classes created


hello ,i am a newbie to programming learning python as my 1st language.1why are classes created.2similarly after creating a class they define something called methods.why are methods created when we can create functions.3 what exactly is this creating a instance/object mean why is this done.
Posted On: Friday 28th of December 2012 01:14:25 AM Total Views:  91
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




include folder

Dear Python users and developers: My trouble is as follows: I'm putting back on line an old pc-linux cluster. Today while trying to install a python based program I got an error regarding the Python.h file that should be in the /include/Phyton2.3 folder. So I went looking for the file but it wasn't there, I mean the whole folder /Phyton2.3 inside the /usr/include directory was not there. I am not te administrator of that cluster that has been off for at least 2 years, so I really don't know what to do. Please help. My Linux version is: Debian GNU-Linux My Python version is: 2.3 Many
VIEWS ON THIS POST

44

Posted on:

Wednesday 7th November 2012
View Replies!

Re: IDE for Python

Joel Andres Granados writes: > > list: > > I have tried various times to use an IDE for python put have always been > disapointed. Not sure which platform you're on, but I've really liked PyScripter for the Windows platform.
VIEWS ON THIS POST

21

Posted on:

Wednesday 7th November 2012
View Replies!

confused about why i get a type error when i call an object's method

I'm confused about why i get a type error when i call an object's method. Here's the example code: >>> class Foo: def __init__(self): self.foo = [] def foo(self): print "in foo!" >>> f = Foo() >>> dir(f) ['__doc__', '__init__', '__module__', 'foo'] >>> f.foo() Traceback (most recent call last): File "", line 1, in f.foo() TypeError: 'list' object is not callable >>>
VIEWS ON THIS POST

112

Posted on:

Wednesday 7th November 2012
View Replies!

Re: All names in the current module

Fabio Z Tessitore wrote: > to get names' list you can simply call globals() Not strictly true. globals() returns the current's scope global vars. If you import a module in the current scope globals() won't display the names inside it. -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair
VIEWS ON THIS POST

219

Posted on:

Wednesday 7th November 2012
View Replies!

Question about pychecker and pylint

I wonder if pychecker projet is dead On pychecker home page (http://pychecker.sourceforge.net/), last version date from February 3, 2006 and their mailist contain spam messages only. Other tools like pychecker is pylint at (http://www.logilab.org/project/eid/857). This is a great tools and it's still active. However, it has issue : its web site, it is very incomprehensible. Do you have other pylint web site
VIEWS ON THIS POST

98

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Bragging about Python

Programs like this were posted on this thread: > def fib(): > generation, parent_rabbits, baby_rabbits = 1, > 1, 1 > while True: > yield generation, baby_rabbits > generation += 1 > parent_rabbits, baby_rabbits = \ > baby_rabbits, parent_rabbits + > baby_rabbits > > for pair in fib(): > if pair[0] > 100: > break > print "Generation %d has %d (baby) rabbits." > % pair > One goal behind the SimplePrograms page is to give people that are new to Python a *gentle* immersion into Python code. I prefer simple: parent_rabbits, baby_rabbits = (1, 1) while baby_rabbits < 100: print 'This generation has %d rabbits' % baby_rabbits parent_rabbits, baby_rabbits = (baby_rabbits, parent_rabbits + baby_rabbits) Somebody commented in another reply that they'd prefer the variable names "a" and "b," but other than that, I think it's hard to simplify this. The problem of counting rabbits is not sufficiently rich to motivate a solution with generator functions, and "yield" statements are just gonna scare people away from the Python, unless they've had a chance to see simpler idioms first. I do think there's a place on the page for a good generators example, but it needs to solve a sufficiently complex problem that the use of generators actually simplifies the solution. So I'm throwing down the gauntlet--can somebody write a short program (maybe 10 to 20 lines) where you solve a problem more simply than a similar non-generator-using solution would solve it Maybe something like Eight Queens -- Steve P.S. FWIW the page does already include examples of generator expressions and the itertools module, but it does not yet show any code that actually implements a generator. I would greatly welcome the addition of a good example. ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/on...hrefer=1ONXIC
VIEWS ON THIS POST

83

Posted on:

Wednesday 7th November 2012
View Replies!

Roundup SECURITY FIX releases 0.6.11 and 0.7.3

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've just released versions 0.6.11 and 0.7.3 which contain an important SECURITY FIX. I strongly encourage all users of Roundup to upgrade immediately. The download files are at: https://sourceforge.net/project/show...group_id=31577 Richard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAtm5orGisBEHG6TARAqGaAJ40cckTD3r+IgeiQETYszjKiDObxgCfb/qh uwYswRP8ftQaa71MNOn7yas= =KzEE -----END PGP SIGNATURE-----
VIEWS ON THIS POST

66

Posted on:

Wednesday 7th November 2012
View Replies!

[ANN] PyLint 0.4.1

all I'm pleased to announce the 0.4.1 version of pylint. This is a quick bug fix release to correct some annoyous bug of the previous version What's new ------------ * fix the setup.py script to allow bdist_winst (well, the generated installer has not been tested...) with the necessary logilab/__init__.py file * fix file naming convention as suggested by Andreas Amoroso * fix stupid crash bug with bad method names What is pylint ---------------- Pylint is a python tool that checks if a module satisfy a coding standard. Pylint can be seen as another pychecker since nearly all tests you can do with pychecker can also be done with Pylint. But Pylint offers some more features, like checking line-code's length, checking if variable names are well-formed according to your coding standard, or checking if declared interfaces are truly implemented, and much more (see http://www.logilab.org/pylint/ for the complete check list). The big advantage with Pylint is that it is highly configurable, customizable, and you can easily write a small plugin to add a personal feature. The usage it quite simple : $ pylint mypackage.mymodule This command will output all the errors and warnings related to the tested code (here : mypackage.mymodule), will dump a little summary at the end, and will give a mark to the tested code. Pylint is free software distributed under the GNU Public Licence. Home page --------- http://www.logilab.org/projects/pylint/ Download -------- ftp://ftp.logilab.org/pub/pylint/ Mailing list ------------ mailto://python-projects@lists.logilab.org -- Sylvain Thnault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org
VIEWS ON THIS POST

48

Posted on:

Wednesday 7th November 2012
View Replies!

Pickled objects over the network

Irmen de Jong wrote > In what way would Pyro be overkill where Yaml (also a module that you need > to install separately) wouldn't be Sure they are the same to install and sure pyro can do the job (pyro is a nice package). But I got the impression that the questioner wanted to do the networking stuff himself at a low level (using sockets) and the data management using some available library -- pickle. Since pickle has problems -- does not interface well with networking -- security issues -- has an xml option that according to the docs is an order of magnitude slower I thought I would point out yaml (with safe-load) which sits somewhere inbetween the xml-pickle and the default pickle. I should also mention here that I find yaml is much more known and used in the ruby and perl world than in the python world. This is unfortunate considering that both ruby and perl have a traditional syntax (begin end, { } etc ). On the other hand, python and yaml have similar modern syntactic structures -- structure follows indentation -- and are therefore well matched to each other. So in summary the 'competition' is not between yaml and pyro -- pyro could easily have a pickle-using-yaml option -- but between yaml and xml.
VIEWS ON THIS POST

54

Posted on:

Saturday 10th November 2012
View Replies!

Port scan module

I programmed a port scanning module which you can download here http://code.google.com/p/portscan/ Including the module in your program allows you to scan specific ports in an IP, using the function scan(ip,port,timeout). Instead of getting a cryptic code in return, the ...
VIEWS ON THIS POST

129

Posted on:

Saturday 10th November 2012
View Replies!

howto obtain directory where current (running) py-file is placed?

Hi all, I guess this question was asked many times before, but I don't know keywords for web search. Thank you in advance, D....
VIEWS ON THIS POST

189

Posted on:

Saturday 10th November 2012
View Replies!

ANN: Django Tutorial Part 1 - Setup (New ShowMeDo video in our firstDjango series)

Summary: Seans shows you how to setup your own Django installation on a bare Ubuntu installation in just 10 minutes. This is the first episode in a longer Django series - please leave an encouraging Thank-You comment if you like ...
VIEWS ON THIS POST

105

Posted on:

Saturday 10th November 2012
View Replies!

Parsing HTML?

I'm trying to parse an HTML file. I want to retrieve all of the text inside a certain tag that I find with XPath. The DOM seems to make this available with the innerHTML element, but I haven't found a ...
VIEWS ON THIS POST

24

Posted on:

Saturday 10th November 2012
View Replies!

RELEASED Python 2.4.4, Final.

On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.4 (FINAL). Python 2.4.4 is a bug-fix release. While Python 2.5 is the latest version of Python, we're making this release ...
VIEWS ON THIS POST

45

Posted on:

Saturday 10th November 2012
View Replies!

CherryPy-2.1.0-final released

, I am happy to announce the release of CherryPy-2.1.0 If is the result of 6 months of intense development since the last stable release and the work of a growing number of contributors. CherryPy has become increasingly popular ...
VIEWS ON THIS POST

121

Posted on:

Saturday 10th November 2012
View Replies!

Re: wrapping C functions in python

Brian and Diez: First of all, thanks for the advice. Brian: I have installed NumPy and SciPy, but I can't seem to find a wavelet transform there. The main point of this was more to learn C wrapping than to ...
VIEWS ON THIS POST

94

Posted on:

Saturday 10th November 2012
View Replies!

Updated Cygwin Package: python-2.3.4-1

New News: === ==== I have updated the version of Python to 2.3.4-1. The tarballs should be available on a Cygwin mirror near you shortly. The following is the only notable change since the previous release: o upgrade to Python ...
VIEWS ON THIS POST

62

Posted on:

Saturday 10th November 2012
View Replies!

Re: what does ^ do in python

>> HOw can we use express pointers as in C or python > > Traceback (most recent call last): > File "", line 1, in > File "parser.py", line 123, in parse_text > tree = language.parse_text(text) > File "english.py", ...
VIEWS ON THIS POST

56

Posted on:

Saturday 10th November 2012
View Replies!

python for game programming

Is Python program language popular for game programming...
VIEWS ON THIS POST

138

Posted on:

Saturday 10th November 2012
View Replies!

Python Standardization: Wikipedia entry

I would value the opinion of fellow Pythoneers who have also contributed to Wikipedia, on the issue of "Is Python Standardized". Specifically in the context of this table: http://en.wikipedia.org/wiki/Compari...ral_comparison (Comparison of programming languages) And this entry in the talk page ...
VIEWS ON THIS POST

28

Posted on:

Saturday 10th November 2012
View Replies!

SimpleXMLRPCServer to fastcgi via WSGI?

Is there a straightforward way to convert an XML-RPC server application (written for SimpleXMLRPCServer) to use WSGI so that it can be used as s fastcgi server By "straightforward" I mean something simple, without using some external framework. Alternatively, ...
VIEWS ON THIS POST

77

Posted on:

Saturday 10th November 2012
View Replies!

RE: dictionary/hash and '1' versus 1

> From: Stephen Hansen [mailto:apt.shansen@gmail.com] > Sent: Thursday, January 03, 2008 7:39 PM > To: Reedick, Andrew > Cc: python-list@python.org > Subject: Re: dictionary/hash and '1' versus 1 > > > > Well one important thing to learn while learning ...
VIEWS ON THIS POST

89

Posted on:

Saturday 10th November 2012
View Replies!

Tcl/Tk 8.5.0 released

Thought this might interest some... http://www.osnews.com/story.php/1907...k-8.5-Released The relevant bits for Python here are the major improvements in Tk, specifically native themed widgets for full platform integration on Windows and OS X and improved appearance under X11, additonal widgets such as ...
VIEWS ON THIS POST

203

Posted on:

Saturday 10th November 2012
View Replies!

Problem with generator expression and class definition

I faced a strange behavior with generator expression, which seems like a bug, for both python 2.4 and 2.5 : >>> class A : .... a = 1, 2, 3 .... b = 1, 2, 3 .... C = list((e,f) ...
VIEWS ON THIS POST

147

Posted on:

Saturday 10th November 2012
View Replies!

Re: Fastest way to write huge files

Terry Reedy wrote: > > > Mohamed Yousef wrote: >> let's say , I'm moving large files through network between devices >> what is the fastest way to do this >> what i came up with :- > > ...
VIEWS ON THIS POST

138

Posted on:

Sunday 11th November 2012
View Replies!

RE: Python Written in C?

Fredrik Lundh wrote: > rynt wrote: > >> You're either --- >> A. A Troll >> B. A young, immature programmer trying to show off or >> C. A total idiot. > > you forgot the " of the above" ...
VIEWS ON THIS POST

33

Posted on:

Sunday 11th November 2012
View Replies!

Re: Type Problem

Victor wrote... >len = len(dirs) The function 'len' is a built-in function in Python. If you assign an integer to the name 'len', that will replace the function with an int. And you can't call an int. My suggestion: Do ...
VIEWS ON THIS POST

26

Posted on:

Sunday 11th November 2012
View Replies!

What replaces `` in py3k?

In Python 3, backticks (``) are being removed. The plan is to create an automatic way to port python2 programs to python3, so my question is: What are backticks going to be translated into I tried looking at the 2to3 ...
VIEWS ON THIS POST

113

Posted on:

Sunday 11th November 2012
View Replies!

pretty generic question

I have to talk about coding. I'm thinking about traffic, freight, scheduling, microcontrols, and acoustics. I have pretty basics understandings of the controls of computers. My knowledge is a little contrary or rare; I specialize in information interfaces, but they're ...
VIEWS ON THIS POST

108

Posted on:

Sunday 11th November 2012
View Replies!

URLlib2?

Probably a silly question but I am writing a CGI script which need to check the referring URL, can anyone provide any pointers I have looked at URLLib2 and a couple of other libraries, but am slightly confused.
VIEWS ON THIS POST

90

Posted on:

Sunday 11th November 2012
View Replies!

some questions about ejabberd,spark and psi

hi,every buddy I've now installed a jabber server,right it's ejabberd mentioned above and 2 jabber client,right again it's spark and psi and I can connect to jabber server by spark but failed by psi,saying 'certificate failed the authenticity test;Reason:certificate is ...
VIEWS ON THIS POST

131

Posted on:

Sunday 11th November 2012
View Replies!

Transforming ascii file (pseduo database) into proper database

I need to take a series of ascii files and transform the data contained therein so that it can be inserted into an existing database. The ascii files are just a series of lines, each line containing fields separated by ...
VIEWS ON THIS POST

54

Posted on:

Sunday 11th November 2012
View Replies!

FindWindowById returns None..... ?

I'm trying to split my GUI into several files since its beginning to become a bit large.. I've placed a panel class inside gui2.py, but it needs some information from a panel in gui1.py... if I import gui1 in ...
VIEWS ON THIS POST

82

Posted on:

Sunday 11th November 2012
View Replies!

dpap implementation in python

Hi people Is there a dpap implementation for python I can seem to find is perl based (dpap is used to share photos in iphoto) Andy...
VIEWS ON THIS POST

44

Posted on:

Monday 12th November 2012
View Replies!

how to pass a dictionary (including chinese characters) through Queueas is?

Hi , As indicated in the following python script, the dictionary b has Chinese characters: "\t\t". But a.get() returns the dictionary witha little bit different format for the "\t\t: '\xd6\xd0\xce\xc4' . How can I get the dictionary through the Queue ...
VIEWS ON THIS POST

44

Posted on:

Saturday 24th November 2012
View Replies!

RE: Numeric literal syntax

Steven D'Aprano wrote: > On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: > >> It seems to me that the right choice for thousands seperator is the >> apostrophe. > > You mean the character already used as ...
VIEWS ON THIS POST

47

Posted on:

Sunday 25th November 2012
View Replies!

caseless dict - questions

I have a requirement for using caseless dict. I searched the web for many different implementations and found one snippet which was implemented in minimal and useful way. ############# import UserDict class CaseInsensitiveDict(dict, UserDict.DictMixin): def __init__(self, *args, **kwargs): self.orig = ...
VIEWS ON THIS POST

48

Posted on:

Sunday 25th November 2012
View Replies!

Apache2 + Python WITHOUT mod_pytho

Hi to all! How can i configure apache2 so that it processes all .py files with python _without_ using mod_python I'm on Ubuntu 8.4. currently my /etc/apache2/sites-available/default file reads: __________________________ NameVirtualHost * ServerAdmin webmaster@localhost DocumentRoot /var/www/ ...
VIEWS ON THIS POST

27

Posted on:

Sunday 25th November 2012
View Replies!

[ANN] Gheat 0.2: Heatmaps for Google Maps, now with Pygame

Greetings, program! I have released a new version of Gheat, heatmaps for Google Maps. Announcement with promo screencast here: http://blag.whit537.org/2008/04/ghea...ty-colors.html Project homepage here: http://code.google.com/p/gheat/ chad...
VIEWS ON THIS POST

27

Posted on:

Sunday 25th November 2012
View Replies!

dark crusade 1.11 patch

dark crusade 1.11 patch http://cracks.00bp.com F R E E C R A C K S...
VIEWS ON THIS POST

31

Posted on:

Sunday 25th November 2012
View Replies!

Re: Pickle to Source - Gabriel Genellina?

En Fri, 04 Apr 2008 22:47:47 -0300, $P!D3R DelSol escribi: > I found this 3 year old message asking about doing the same exact thing > I am trying to do. This is one wheel I REALLY don't want ...
VIEWS ON THIS POST

26

Posted on:

Sunday 25th November 2012
View Replies!

blog

www.bussines-yoga.blogspot.com My Search Funds Ok so this is not tech/gadget related but i had to post about this I have found a great new site and it is earning me 003 for every single I make on the net www.bussines-yoga.blogspot.com ...
VIEWS ON THIS POST

18

Posted on:

Sunday 25th November 2012
View Replies!

python 3.0 memory leaking?

the edgewall trac release 0.11 is blocked now since more than one month for a memory leak nobody is able to find, see http://groups.google.com/group/trac-...16e519da54f16b .. does python-3.0 improve something to avoid writing memory leaking applications rupert....
VIEWS ON THIS POST

76

Posted on:

Sunday 25th November 2012
View Replies!

MySQLdb: commit before cursor close, or after?

I'm getting some wierd commit-related behavior from MySQLdb. I'm using InnoDB, so transactions really matter. I'm currently doing cursor = db.cursor() cursor.execute(...) cursor.close() db.commit() Is that the correct order, or should I call "db.commit()" before "cursor.close()" Does anyone know for ...
VIEWS ON THIS POST

88

Posted on:

Sunday 25th November 2012
View Replies!

Announcing the Python core sprint at PyCon 2008

As has occurred since the inception of PyCon, there will be a sprint on the Python core at this year's conference! If you will be attending PyCon (or will be in Chicago during the dates of the sprints), attending the ...
VIEWS ON THIS POST

68

Posted on:

Sunday 25th November 2012
View Replies!

Great Python books for the beginner

I'm a freshman in college and I'm going to be taking an intro to programming course next semester which mainly uses Python, so I thought it might be a good time to pick up Python beyond the scope of ...
VIEWS ON THIS POST

91

Posted on:

Sunday 25th November 2012
View Replies!

gadfly installion error

I tried installing gadfly in windows nt.but while running run_tests the following error occured. Traceback (most recent call last): File "D:\Mapserver\krishma\python\python_examples\createdb.py", line 5, in connection = gadfly.gadfly() File "C:\Python26\lib\site-packages\gadfly\database.py", line 26, in __init__ from gadfly import sql, bindings File "C:\Python26\lib\site-packages\gadfly\bindings.py", line 64 [create, view, name, namelist, as, selection] = l ^ SyntaxError: invalid syntax can anybody help me in this\t
VIEWS ON THIS POST

64

Posted on:

Tuesday 27th November 2012
View Replies!

help on save and save as methods

I've been working on this kind of text editor program and I can't figure out how to actually save the date entered into the editor with the save and saveas methods. heres the two methods that I wrote using other examples from the wxPython site. (Toggle Plain Text) def OnSave(self, event): """ Save a file""" self.dirname = '' fDialog = wx.FileDialog(self, "Choose a file", self.dirname, "*.*", wx.SAVE) if fDialog.ShowModal() == wx.ID_OK: self.filename = fDialog.GetFilename() self.dirname = fDialog.GetDirectory() f = open(os.path.join(self.dirname,self.filename),'w') self.text2.SetValue(f.write()) f.close() fDialog.Destroy() def OnSaveAs(self, event): """ Save a file""" self.dirname = '' fDialog = wx.FileDialog(self, "Choose a file", self.dirname, "*.*", wx.SAVE | wx.OVERWRITE_PROMPT) if fDialog.ShowModal() == wx.ID_OK: self.filename = fDialog.GetFilename() self.dirname = fDialog.GetDirectory() f = open(os.path.join(self.dirname,self.filename),'w') #textString = self.text2.SetValue(str(self.text2)) #f.write(self.text2.SetValue(self.text2['s'])) f.write(self.text2.SetValue(str(self.text2))) f.close() fDialog.Destroy() def OnSave(self, event): """ Save a file""" self.dirname = '' fDialog = wx.FileDialog(self, "Choose a file", self.dirname, "*.*", wx.SAVE) if fDialog.ShowModal() == wx.ID_OK: self.filename = fDialog.GetFilename() self.dirname = fDialog.GetDirectory() f = open(os.path.join(self.dirname,self.filename),'w') self.text2.SetValue(f.write()) f.close() fDialog.Destroy() def OnSaveAs(self, event): """ Save a file""" self.dirname = '' fDialog = wx.FileDialog(self, "Choose a file", self.dirname, "*.*", wx.SAVE | wx.OVERWRITE_PROMPT) if fDialog.ShowModal() == wx.ID_OK: self.filename = fDialog.GetFilename() self.dirname = fDialog.GetDirectory() f = open(os.path.join(self.dirname,self.filename),'w') #textString = self.text2.SetValue(str(self.text2)) #f.write(self.text2.SetValue(self.text2['s'])) f.write(self.text2.SetValue(str(self.text2))) f.close() fDialog.Destroy()
VIEWS ON THIS POST

58

Posted on:

Tuesday 27th November 2012
View Replies!

Python Bot

Wrong. My intention is not to create a bot for World of warcraft or any other games. And what i'm doing isnt illegal. And it's not your concern why i want to create this "robot".
VIEWS ON THIS POST

31

Posted on:

Tuesday 27th November 2012
View Replies!

Python 3 script to exe

I wanted to know if there's a way to convert a python 3 script to exe. I installed py2exe and tried to follow some YouTube tutorials but it's not working. Is there a way I can convert a python script to an exe for Windows
VIEWS ON THIS POST

88

Posted on:

Friday 28th December 2012
View Replies!