Re: Feature request: New string conversion type to ignore list item

2007-06-11 Thread pelon
On Jun 5, 6:27 am, [EMAIL PROTECTED] wrote:
> On 5 Jun., 13:12, Peter Otten <[EMAIL PROTECTED]> wrote:
>
> > or like this:
>
> > >>> "%s %.s %s" % ("first", "second", "third")
>
> > 'first  third'
>
> Hey, that's great, thanks Peter!
>
> Tom

Why not be consistent with other aspects of the language:

"%s %!s %s" % ("first", "second", "third")


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WebThumb

2007-06-20 Thread pelon
On Jun 17, 8:57 pm, Jay Loden <[EMAIL PROTECTED]> wrote:
> John J. Lee wrote:
> > Johny <[EMAIL PROTECTED]> writes:
>
> >> How can I get a website thumbnail?
> >> I would like to allow visitors to add their URLs  to our pages with
> >> the thumbnail of their website.
> >> Can anyone suggest a solution for web thumbnails?
> >> Thanks
> >> L.
>
> Don't know if this really helps any but it does sort of reaffirm what John 
> Lee said already:
>
> http://www.zubrag.com/articles/create-website-snapshot-thumbnail.php
>
> Seems like this is one are that could really use a nice open source library 
> of some kind :-)
>
> -Jay


This company offers screen captures for pay. I've not tried them, but
I may one day for verification of my web designs.
http://www.browsercam.com/default.aspx

pelon

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SimplePrograms challenge

2007-06-21 Thread pelon
*** New Thread

#5 has been bothering me.

def greet(name):
print 'hello', name
greet('Jack')
greet('Jill')
greet('Bob')

Using greet() three times is cheating and doesn't teach much and
doesn't have any real world use that #1 can't fulfill.

I offer this replacement:

def greet(name):
""" This function prints an email signature """   #optional doc
string highly recommended
print name + " can be reached at",#comma prevents
newline from being printed
print '@'.join([name,  "google.com"])
greet('Jill')

I think it's important to teach new pythonistas about good
documentation from the start. A few new print options are introduced.
And as far as functionality goes, at least it does something.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SimplePrograms challenge

2007-06-21 Thread pelon
And while I'm at it...

Although Guido's tutorial was a great place to start when I first came
to python I would have learned more and faster had SimplePrograms
existed. My only complaint with the python documentation is the dearth
of examples. The PHP documentation is chock full.


Steve,

You introduced this as a challenge. Why not make it so? JUST FOR FUN I
propose that blank lines and comments not be counted. There should
probably be an upper and lower limit on new concepts introduced. There
should be an emphasis on common, real world functionality. The
standard library should be used freely (although limited to the most
common modules).

I don't mean to turn this game into something too formal and serious,
but it's obvious from the enthusiasm shown on this thread that
pythonistas take their fun seriously.

-- 
http://mail.python.org/mailman/listinfo/python-list


Testing functions via command line

2007-04-02 Thread pelon
There must be a couple of lines that will replace the following:

>From the shell command line I wanted to send data to a specific
function inside my module and execute that function in order to test
it separately from the rest of the module. I know pdb will allow me to
insert data into a running process, but this particular function
requires several long steps beforehand.

My command line:

myprog.py --test removefromcue "myargs" ### removefromcue is
my function inside myprog.py


main()
...
try:
opts, args = getopt.getopt(sys.argv[1:], "t:", ["--test="])
except getopt.GetoptError:
for o, a in opts:
if o in "-t":
myfunc = a
myargs = args
test(myfunc, myargs)
sys.exit()


My problem was that I send a string into the the test function. I
needed to convert that string into the appropriate object. globals()
provides a dictionary with string:object pairs in the global
namespace.

def test(myfunc, myargs):
""" execute a given function """
for key,value in globals().items():
if myfunc in key:
func = value
break
args = ""
for i in myargs:
args += i + ","
func(args[:-1])   ###  removefromcue("myitem")

There's something very basic that I should know.

-- 
http://mail.python.org/mailman/listinfo/python-list