Re: [Tutor] Wrapping with list

2013-09-13 Thread Alan Gauld
On 13/09/13 11:24, Dotan Cohen wrote: A function that I wrote works on a list or on a string. If the function is passed a string, then it wraps the string in a list at the top of the function. Is it bad form to wrap the string in place? It depends what your function does. In most cases the stri

Re: [Tutor] Newbie question. Is it possible to run/call a python2.7 program and reference results from/in python3.3?

2013-09-13 Thread Alan Gauld
On 13/09/13 15:59, Paul Smith wrote: So there are many tools out there but mechanize and scrapy 3rd party modules seem to produce the best results; however nothing like these exist for Python3. I get close but cannot produce the clean simple url results in python3 Yes that's the biggest barrie

[Tutor] Newbie question. Is it possible to run/call a python2.7 program and reference results from/in python3.3?

2013-09-13 Thread Paul Smith
Attempting a simple web crawler in python3, browse a url - collect/clean/produce valid url list from a url; random choice from valid url list; visit new url repeat process - collect/clean/produce valid url list from new url... So there are many tools out there but mechanize and scrapy 3rd party mo

Re: [Tutor] Wrapping with list

2013-09-13 Thread Steven D'Aprano
On Fri, Sep 13, 2013 at 12:24:40PM +0200, Dotan Cohen wrote: > A function that I wrote works on a list or on a string. If the > function is passed a string, then it wraps the string in a list at the > top of the function. Is it bad form to wrap the sting in place? > > if not isinstance(someVar, li

Re: [Tutor] Wrapping with list

2013-09-13 Thread Dave Angel
On 13/9/2013 06:24, Dotan Cohen wrote: > A function that I wrote works on a list or on a string. If the > function is passed a string, then it wraps the string in a list at the > top of the function. Is it bad form to wrap the sting in place? > > if not isinstance(someVar, list): > someVar = [

Re: [Tutor] Wrapping with list

2013-09-13 Thread Oscar Benjamin
On 13 September 2013 11:24, Dotan Cohen wrote: > A function that I wrote works on a list or on a string. If the > function is passed a string, then it wraps the string in a list at the > top of the function. Is it bad form to wrap the sting in place? > > if not isinstance(someVar, list): > som

[Tutor] Wrapping with list

2013-09-13 Thread Dotan Cohen
A function that I wrote works on a list or on a string. If the function is passed a string, then it wraps the string in a list at the top of the function. Is it bad form to wrap the sting in place? if not isinstance(someVar, list): someVar = [someVar] To avoid that, I am creating a list then