Hi Kent,
>
> >>> class foo(object):
> ... __slots__ = ['x', 'y']
> ...
> >>> f=foo()
> >>> f.x=1
> >>> f.y=2
> >>> f.z=3
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'foo' object has no attribute 'z'
>
> Take a look at
> http://www.python.org/2.2.3/des
Hi all,
I'm just looking for a quick runthrough on the differences between new
style classes and the old ones, and how to use the new ones.
Also, how exactly do you use __slots__? I've got a 6000 object
collection, and apparently using __slots__ will save memory, but only
those attributes specifi
raw_input takes one argument.
While
>>> x = 5
>>> b = 10
>>> print x, "+", b, "=", x+b
will print 5 + 10 = 15, you could also have written it -
>>>print str(x) + " + " + str(b) + " = " + str(x+b)
Now, if I have a function -
def divByTen(number):
return number/10
I can call it like s
Hi Goofball223,
Just a quick thing -
> for i in (0,10, 20, 30, 40, 50, 60, 70, 80, 90, 100):
Have you used range() before?
for i in range(10):
print i
0
1
2
3
4
5
6
7
8
9
It's handy for situations like yours. Also, you could use it like this -
zeroToNine = range(10)
print zeroToNine
Hi all,
Just musing.
Even though I'm familiar with imaplib & IMAP, and most of the email
modules, I still find them somewhat... obtuse to work with.
The IMAP protocol is rather exposed in imaplib, and you have to read
RFCs and fiddle to sort the format required for IMAP commands.
For an examp
You'll need the csv module. And that should be about it, I think. The
rest would just be using string methods.
On 8/15/05, Diaz, Wendell <[EMAIL PROTECTED]> wrote:
>
>
>
> Hey guys,
>
>
>
> Hope you can help me on this.
>
>
>
> I want to make a python program which opens an XML (U
No-one's mentioned a Schwartzian Transform yet ; )
On 8/15/05, Kent Johnson <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Note that in Python2.4+, you can use key= instead:
> >
> > def sortKey(lst):
> > return lst[2]
> > Quant.sort(key=sortKey)
> >
> > This is more effient than spe
Hi all,
I've got some source code which will be handling non-ASCII chars like
umlauts and what not, and I've got a testing portion stored in the
code.
I get this deprecation warning when I run my code -
__main__:1: DeprecationWarning: Non-ASCII character '\xfc' in file
C:\Python24\testit.py on
Hehe,
Yah, I should've read the tutorial again, I do apologise, it was a 3
in the morning-coffee not working question.
Regards,
Liam Clarke
On 8/17/05, Alan G <[EMAIL PROTECTED]> wrote:
> > changeIndex = None
> > al = len(line)
> > for i in range(al):
>
> And theres the problem.
> Pythonpro
Hi all,
I should know this, but it seems to elude me at present.
I have a loop which is looping through a line of chars by index.
So, one of these -
for i in range(len(line)):
Now, question is, is there a simple way to 'fast forward' index i?
At the moment, I'm doing it like this -
c
Erk, I of course meant -
path = os.path.join('categories', self.name)
On 8/10/05, mailing list <[EMAIL PROTECTED]> wrote:
> Hi Negroup,
>
> First off, you may want to use os.path.join to create paths -
>
> path = 'categories/%s' % self.name
>
>
Hi Negroup,
First off, you may want to use os.path.join to create paths -
path = 'categories/%s' % self.name
could be -
path = os.path.join(categories, self.name)
This will ensure minimum hassle if you ever want to use this across
multiple OS.
Also, it looks a little tidier, and IMAO, tidie
Also, you may want to consider something like easygui -
http://www.ferg.org/easygui/
if all you need is simple dialogs.
You may also want to consider Pythoncard - pythoncard.sourceforge.net,
it's quite capable of more elaborate GUI stuff, but it's built on
wxPython, which can be a little intimidat
Hi all,
I have the following code -
>>> j =
"""a = {
b = {
c = {
d = 5
e = 10
}
}
}"""
>>> ref = []
>>> data = {}
>>> ref.append(data)
>>> for line in j.split('\n'):
... if "=" in line:
... (LHS, RHS) = line.split(" = ")
... if RHS == "{":
... #op
14 matches
Mail list logo