Re: Returning a string
2009/1/3 Kless jonas@googlemail.com: How is possible that I can print a variable, but when I use *return var* it returns an empty string What makes you think it's returning an empty string? You aren't doing anything with the return value in line 26 of your example. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
Kless schrieb: How is possible that I can print a variable, but when I use *return var* it returns an empty string http://paste.pocoo.org/show/97588/ I don't see anything that indicates that the returned object is the empty string. Simply because there is no code testing for that. And of course you don't show any debugging output, which doesn't help either. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
On 3 ene, 19:12, Diez B. Roggisch de...@nospam.web.de wrote: Kless schrieb: How is possible that I can print a variable, but when I use *return var* it returns an empty string http://paste.pocoo.org/show/97588/ I don't see anything that indicates that the returned object is the empty string. Simply because there is no code testing for that. And of course you don't show any debugging output, which doesn't help either. Diez Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
On Jan 3, 11:20 am, Kless jonas@googlemail.com wrote: On 3 ene, 19:12, Diez B. Roggisch de...@nospam.web.de wrote: Kless schrieb: How is possible that I can print a variable, but when I use *return var* it returns an empty string http://paste.pocoo.org/show/97588/ I don't see anything that indicates that the returned object is the empty string. Simply because there is no code testing for that. And of course you don't show any debugging output, which doesn't help either. Diez Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What? -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
On 3 ene, 19:40, Simon Forman sajmik...@gmail.com wrote: On Jan 3, 11:20 am, Kless jonas@googlemail.com wrote: Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What? That's the output got from ipython. As you can see, it prints 'Afghanistan' but it can not returns it. In change, the another strings are returned. Could it be because it isn't returning the value from the recursivecall? -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
Kless schrieb: On 3 ene, 19:12, Diez B. Roggisch de...@nospam.web.de wrote: Kless schrieb: How is possible that I can print a variable, but when I use *return var* it returns an empty string http://paste.pocoo.org/show/97588/ I don't see anything that indicates that the returned object is the empty string. Simply because there is no code testing for that. And of course you don't show any debugging output, which doesn't help either. Diez Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What is that? IPython? And I don't see no empty string here. *What* I see is the way python's interactive prompt puts out strings, like this: unicode(foo) u'foo' Do you mean by any chance that you don't understand why print prints foo, but the prompt shows ufoo? That is because the prompt invokes repr(o) to print out an object: print repr(unicode(foo)) u'foo' Which means that the output includes quotes and the u-prefix in case of an unicode object to help the user to see what the current object looks like. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
Kless schrieb: On 3 ene, 19:40, Simon Forman sajmik...@gmail.com wrote: On Jan 3, 11:20 am, Kless jonas@googlemail.com wrote: Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What? That's the output got from ipython. As you can see, it prints 'Afghanistan' but it can not returns it. In change, the another strings are returned. Could it be because it isn't returning the value from the recursivecall? Yep, I guess that's the problem. You need to do if cell_tag: return clean_tags(cell_tag) Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
On Sat, 03 Jan 2009 11:46:10 -0800, Kless wrote: On 3 ene, 19:40, Simon Forman sajmik...@gmail.com wrote: On Jan 3, 11:20 am, Kless jonas@googlemail.com wrote: Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What? That's the output got from ipython. As you can see, it prints 'Afghanistan' but it can not returns it. In change, the another strings are returned. Maybe you should show the *input* too… Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Returning a string
On 3 ene, 19:51, Diez B. Roggisch de...@nospam.web.de wrote: Kless schrieb: On 3 ene, 19:40, Simon Forman sajmik...@gmail.com wrote: On Jan 3, 11:20 am, Kless jonas@googlemail.com wrote: Afghanistan AF Out[19]: u'AF' AFG Out[19]: u'AFG' 004 Out[19]: u'004' What? That's the output got from ipython. As you can see, it prints 'Afghanistan' but it can not returns it. In change, the another strings are returned. Could it be because it isn't returning the value from the recursivecall? Yep, I guess that's the problem. You need to do if cell_tag: return clean_tags(cell_tag) Diez Thank you very much. It works now. -- http://mail.python.org/mailman/listinfo/python-list