Hm, thanks guys; I just had to verify I was thinking sanely about it. I am
going to pick up classmethods next. Do any of you have common design
patterns for the usage. They are just items I haven't integrated in my
coding, and I want to be certain I'm off on the right foot (:
On Sun, Sep 12, 2010
"Steven D'Aprano" wrote
A little more information... static methods are quite common[1] in
Java
and C++, where people feel the need (or in the case of Java, are
forced
by the language) to make every function a method.
static methods in C++ are normally reserved for use as class
methods (alt
On Mon, 13 Sep 2010 09:13:25 am Steven D'Aprano wrote:
> On Mon, 13 Sep 2010 06:05:23 am Alan Gauld wrote:
> > I think static methjods are largely a mistake of history. ISTR They
> > were
> > introduced into python before class methods (not by much - one
> > release?)
>
> No, they were introduced a
On Mon, 13 Sep 2010 06:05:23 am Alan Gauld wrote:
> I think static methjods are largely a mistake of history. ISTR They
> were
> introduced into python before class methods (not by much - one
> release?)
No, they were introduced at the same time. But it turned out that the
use cases Guido van Ro
On Fri, 10 Sep 2010 07:52:20 am Todd Ballard wrote:
> I am attempting to have a cummalative total of the y values and
> receive a "list index out of range" error message
How unfortunate.
Do you have an actual question to ask, or are you just sharing?
If you are having problems fixing the error,
On Sun, Sep 12, 2010 at 4:54 PM, Luke Paireepinart
wrote:
>>
>> Thanks for the tip. I'll do some more research but this sounds promising.
>>
>> Rance
>>
> Just be aware that some methods of list building will iterate over the list
> and evaluate it. So if you only want to retrieve the first 10 r
>
> Thanks for the tip. I'll do some more research but this sounds promising.
>
> Rance
>
Just be aware that some methods of list building will iterate over the list and
evaluate it. So if you only want to retrieve the first 10 results but you do
something like
Results = [I.fetch() for I in c
On Sun, Sep 12, 2010 at 3:53 PM, Bill Allen wrote:
> Rance,
>
> I was doing something similar, except I was querying an Oracle database,
> using the cx_Oracle module. I wanted the non-duplicated count of parts in
> my database that met certain criteria. All the output that met the criteria
> of
>
>> Second question is more of a performance question:
>>
>> I don't suspect a "large" # of items in the to_do list, so I *think*
>> that it would be better to just have one SQL statement and then loop
>> through the results 10 times to get the first few records rather than
>> having a seperate sq
> > If you do need to avoid accidentally launching missiles then you need
> > to do some type checking - although ideally using isinstance() instead
> > of type(). But in the majority of cases some sensible documentation
> > and Python's culture that we are all adults here usually means you
>
Rance,
I was doing something similar, except I was querying an Oracle database,
using the cx_Oracle module. I wanted the non-duplicated count of parts in
my database that met certain criteria. All the output that met the criteria
of the select statements is loaded into the cursor object. I then
On Sun, Sep 12, 2010 at 2:29 PM, Dave Angel wrote:
> On 2:59 PM, Rance Hall wrote:
> Convert the string to bytes. If the string is ASCII, you can simply use the
> bytes() function. If not, you may need to specify an encoding.
Thanks Dave, this is what I needed, I looked in the function refer
"Lie Ryan" wrote
In this case, the only reason why you hit the recursion limit is if
you
have a directory which is 1000 deep (quite unlikely, Windows has a
directory depth limit much lower than that).
Or you accidentally have a recursive directory - one that contains a
shortcut to a folder
"Huy Ton That" wrote
class WhatFor(object):
def it(cls):
print 'work with %s' % cls
it = classmethod(it)
def uncommon():
print 'I could be a global function'
uncommon = staticmethod(uncommon)
But I can't seem to understand the above. Under what circumstance
would
st
"Albert-Jan Roskam" wrote
following classes: Menu (responsible for the widget creation),
Autocomplete (a
subclass of the tkinter text entry widget which I've found on the
internet, I
wanted to keep this intact), Convert (responsible for the
conversion/cropping of
the images, which is somewha
"Roelof Wobben" wrote
Because I follow this book "Thinking like a computer scientist" and
I have only read the chapters about strings. lists and tuples.
And that book tries to use Python to teach a general Computing
Science degree 101 course. So it teaches you what are classically
considered g
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Sun, 12 Sep 2010 20:52:06 +0100
> Subject: Re: [Tutor] recursive problem
>
> "Roelof Wobben" wrote
>
I guess the question to ask/consider is: How can be establish
whether a
pa
"Roelof Wobben" wrote
I guess the question to ask/consider is: How can be establish
whether a
particular object supports a particular interface/set of
behaviours
In general we "try" it and handle the exceptions
that we require? E.g. how do we most pythonically check whether
some
object "wa
"Karim" wrote
My first idea is to create an *docrules* class which holds my
document.
Why not create a Document class that is your document.
This class will use 2 other instances from 2 respectives classes
reader and writer. The main method of reader is get().
The main method of writer is
On 2:59 PM, Rance Hall wrote:
Luke:
On python3.1 I get the following error using your (untested) two line snippet:
TypeError: Unicode-objects must be encoded before hashing
If I add the b back into the mix, I get a hash with no error messages.
But I still can't quite figure out how to get th
"Miss Soraya Nabizadeh" wrote
I am new to python
Welcome,
and I am doing an assignment which asks about writing python
functions.
The rules of the forum are that we don;t do assignments for you but we
will offer suggestions ior answer specific qquestions. That works best
if
you start by
On 2:59 PM, Rance Hall wrote:
Everybody knows you don't store plain text passwords in a database,
you store hashes instead
consider:
userpass = getpass.getpass("User password? ")
encuserpass = hashlib.md5()
encuserpass.update(userpass)
del userpass
Now the documentation clearly states th
I could not connect with gmail smtp server in Vista 32( worked ok in
XP 32). Both vista and xp have same anti-virus software.
>>> smtplib.SMTP("smtp.gmail.com",587)
Traceback (most recent call last):
File "", line 1, in
smtplib.SMTP("smtp.gmail.com",587)
File "C:\Program Files\Python2
I am attempting to have a cummalative total of the y values and receive a "list
index out of range" error message
import numpy
import matplotlib.pyplot as plt
import filereader
from filereader import *
My_Path="C:\\Python26\\assignment2\\datadownload.txt"
My_Data_Type=numpy.dtype([("year","
Ah, it works differently on py3 i guess. Py2 was pretty lax with string
handling. I would suggest researching Unicode encode functions rather than
looking at the hashlib for info. There is probably a string.encode or something
like that.
-
Sent from a mobile device w
Luke:
On python3.1 I get the following error using your (untested) two line snippet:
TypeError: Unicode-objects must be encoded before hashing
If I add the b back into the mix, I get a hash with no error messages.
But I still can't quite figure out how to get the variable contents
into the hash
Just in case it is not a known issue or well documented, do take the time if
you can to report it. Especially since you have got the symptom isolated
and demonstrated that it is limited to a particular OS build.
http://docs.python.org/bugs.html
-Bill
On Sat, Sep 11, 2010 at 1:44 PM, Michael P
This is how I use it (untested)
Import hashlib
Print hashlib.md5("somestr").hexdigest()
Works fine without using binary string.
On Sep 12, 2010, at 1:19 PM, Rance Hall wrote:
> Everybody knows you don't store plain text passwords in a database,
> you store hashes instead
>
> consider:
>
> us
Everybody knows you don't store plain text passwords in a database,
you store hashes instead
consider:
userpass = getpass.getpass("User password? ")
encuserpass = hashlib.md5()
encuserpass.update(userpass)
del userpass
Now the documentation clearly states that if you are hashing a string
you
> Date: Sun, 12 Sep 2010 13:40:09 -0400
> Subject: Re: [Tutor] tree problem
> From: joel.goldst...@gmail.com
> To: rwob...@hotmail.com
>
>
>
> On Sun, Sep 12, 2010 at 1:20 PM, Roelof Wobben
>> wrote:
>
>
>
>
>> Date: Sun, 12 Sep 2
On Sun, Sep 12, 2010 at 10:48 AM, Roelof Wobben wrote:
>
>
>
>
> > Date: Sun, 12 Sep 2010 09:46:08 -0400
> > From: joel.goldst...@gmail.com
> > To: tutor@python.org
> > Subject: Re: [Tutor] tree problem
> >
> >
> >
> > On Sun, Sep 12, 2010 at 9:32 AM, Roelof Wobbe
I'm not sure if this is the right forum for this or not, if there is a
better place to ask this question please let me know and I'll re-post
elsewhere.
I'm using python v3.1 and the py-postgresql v1.0.1 module located at
http://python.projects.postgresql.org/docs/1.0/
I'm using prepared sql state
What can I say except, thanks so much everyone for taking your time and
writing me an explication. I finally understood what function objects are.
Thanks, really thanks for helping me out. I wish everyone the best.
___
Tutor maillist - Tutor@python.org
> Date: Sun, 12 Sep 2010 09:46:08 -0400
> From: joel.goldst...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] tree problem
>
>
>
> On Sun, Sep 12, 2010 at 9:32 AM, Roelof Wobben
>> wrote:
>
>
>
>> Date: Sun, 12 Sep 2010 0
On Sun, Sep 12, 2010 at 9:32 AM, Roelof Wobben wrote:
>
>
>
> > Date: Sun, 12 Sep 2010 09:08:18 -0400
> > From: joel.goldst...@gmail.com
> > To: tutor@python.org
>
> > Subject: Re: [Tutor] tree problem
> >
> >
> >
> > On Sun, Sep 12, 2010 at 7:54 AM, Lie Ryan
> >
On Sun, Sep 12, 2010 at 7:54 AM, Lie Ryan wrote:
> On 09/12/10 21:15, Roelof Wobben wrote:
> >
> >
> > Hello,
> >
> > I have this problem.
> >
> > Write a program named litter.py that creates an empty file named
> trash.txt in each subdirectory of a directory tree given the root of the
> tree as
> Subject: Re: [Tutor] tree problem
> From: evert@gmail.com
> Date: Sun, 12 Sep 2010 13:29:12 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
>> Write a program named litter.py that creates an empty file named trash.txt
>> in each subdirecto
On 09/12/10 21:15, Roelof Wobben wrote:
>
>
> Hello,
>
> I have this problem.
>
> Write a program named litter.py that creates an empty file named trash.txt in
> each subdirectory of a directory tree given the root of the tree as an
> argument (or the current directory as a default).
By de
> Write a program named litter.py that creates an empty file named trash.txt in
> each subdirectory of a directory tree given the root of the tree as an
> argument (or the current directory as a default).
>
> So I change the example to this :
>
> def traverse(path, s='.\n', f=0, d=0):
> path2f
Hello,
I have this problem.
Write a program named litter.py that creates an empty file named trash.txt in
each subdirectory of a directory tree given the root of the tree as an argument
(or the current directory as a default).
So I change the example to this :
def traverse(path, s='.\n',
> From: rwob...@hotmail.com
> To: st...@pearwood.info
> Subject: RE: [Tutor] recursive problem
> Date: Sun, 12 Sep 2010 07:58:48 +
>
>
>
>
>
>> From: st...@pearwood.info
>> To: tutor@python.org
>> Date: Sun, 12
41 matches
Mail list logo