Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 11:22 am, harrismh777 wrote: > John Machin wrote: >> (1) You cannot work without using bytes sequences. Files are byte >> sequences. Web communication is in bytes. You need to (know / assume / >> be >> able to extract / guess) the input encoding. You need to encode your >> outp

Re: checking if a list is empty

2011-05-11 Thread harrismh777
alex23 wrote: through intuitive language skills. Why not? Because the vast majority of them don't seem to want to be bothered? That could very well be... but I have a hope for them. I honestly think its not because they don't want to be bothered, rather they just think its too far past the

Re: lightweight way to create new projects from templates

2011-05-11 Thread Chris Angelico
On Thu, May 12, 2011 at 4:34 AM, Jonathan Hartley wrote: > Hi. > > I'm looking for a quick way to create new Python projects from a template. > > I understand that 'Paste' (http://pythonpaste.org/) is one way to do this, > but I find Paste very intimidating because of all the functionality it > in

Re: unicode by default

2011-05-11 Thread Ben Finney
MRAB writes: > You need to understand the difference between characters and bytes. Yep. Those who don't need to join us in the third millennium, and the resources pointed out in this thread are good to help that. > A string contains characters, a file contains bytes. That's not true for Python

Re: unicode by default

2011-05-11 Thread Terry Reedy
On 5/11/2011 11:44 PM, harrismh777 wrote: Steven D'Aprano wrote: You need to understand the difference between characters and bytes. http://www.joelonsoftware.com/articles/Unicode.html is also a good resource. Thanks for being patient guys, here's what I've done: astr="pound sign" asym="

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 1:44 pm, harrismh777 wrote: > By > default it looks like Python3 is writing output with UTF-8 as default... > and I thought that by default Python3 was using either UTF-16 or UTF-32. > So, I'm confused here... also, I used the character sequence \u00A3 > which I thought was UT

Re: unicode by default

2011-05-11 Thread Benjamin Kaplan
On Wed, May 11, 2011 at 8:44 PM, harrismh777 wrote: > Steven D'Aprano wrote: >>> >>> You need to understand the difference between characters and bytes. >> >> http://www.joelonsoftware.com/articles/Unicode.html >> >> is also a good resource. > > Thanks for being patient guys, here's what I've done

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 2:14 pm, Benjamin Kaplan wrote: > > If the file you're writing to doesn't specify an encoding, Python will > default to locale.getdefaultencoding(), No such attribute. Perhaps you mean locale.getpreferredencoding() -- http://mail.python.org/mailman/listinfo/python-list

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread vijay swaminathan
I tried using QThread as well.. But the problem is, on the run method when i invoke the command prompt, it sends out the finished signal... I want it to send out the finished signal only on closing the command prompt that is invoked earlier in my process. guess some logic to be implement inside r

Re: checking if a list is empty

2011-05-11 Thread Gregory Ewing
Roy Smith wrote: Hans Georg Schaathun wrote: If both are numbers, they are converted to a common type. Otherwise, objects of different types always compare unequal That's just the default treatment for unrelated types that don't know anything about each other. I would guess that the list's =

Re: checking if a list is empty

2011-05-11 Thread D'Arcy J.M. Cain
On Wed, 11 May 2011 16:24:47 -0500 harrismh777 wrote: > D'Arcy J.M. Cain wrote: > Non-programmers should not be expected to program in 'C' nor in lisp... > > ... but non-programmers were able to program in BASIC jes fine... They still had to learn the language. > I contend that non-prog

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 21:47:27 GMT, Steven D'Aprano wrote: : On Wed, 11 May 2011 20:13:35 +0100, Hans Georg Schaathun wrote: : > One principle of object oriented programming is to bestow the objects : > with properties reflecting known properties from the domain being : > modelled. Lists do not have

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 20:16:01 -0700 (PDT), alex23 wrote: : Hans Georg Schaathun wrote: : > Revolutionary indeed, so why don't we exploit the revolution : > and write the programs to be as accessible as possible? : : Where do you draw the line, though? I said that, "as possible". You draw it

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Thu, 12 May 2011 17:44:07 +1200, Gregory Ewing wrote: : Roy Smith wrote: : > Hans Georg Schaathun wrote: : >>If both are numbers, they are converted to a common type. Otherwise, : >>objects of different types always compare unequal Actually, I did not. :-- hg -- http://mail.python.org/ma

Re: checking if a list is empty

2011-05-11 Thread Steven D'Aprano
On Wed, 11 May 2011 22:53:45 -0500, harrismh777 wrote: > alex23 wrote: >>> through intuitive language skills. Why not? >> Because the vast majority of them don't seem to want to be bothered? >> >> > That could very well be... but I have a hope for them. I honestly think > its not because they don

Re: unicode by default

2011-05-11 Thread harrismh777
John Machin wrote: On Thu, May 12, 2011 2:14 pm, Benjamin Kaplan wrote: If the file you're writing to doesn't specify an encoding, Python will default to locale.getdefaultencoding(), No such attribute. Perhaps you mean locale.getpreferredencoding() >>> import locale >>> locale.getpreferred

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Thu, 12 May 2011 01:49:05 -0400, D'Arcy J.M. Cain wrote: : That's not programming. That's using a canned app that a programmer : wrote that takes your unstructured input and does something useful with : it. Spreadsheets are a primitive example of that. Google is a more : advanced examp

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 21:42:10 GMT, Steven D'Aprano wrote: : *Potentially* different tests. Which is exactly the point. Given an : arbitrary object, the developer doesn't know what test is appropriate. : Should I write len(x) == 0 or list(x) == [] or x.next is None or : something else? How can I

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 wrote: : On May 12, 7:24 am, harrismh777 wrote: : > We need to move away from 'canned apps' to a new day where : > the masses can sit down to their computer and solve new problems with it : > through intuitive language skills.  Why not? : : Be

Need Assistance on this program.

2011-05-11 Thread vijay swaminathan
Hi All, I'm new bie to python thread programming and would like to assistance on the attached code. In this, I'm calling a thread to invoke a command prompt and would like to print the "Thread as alive" as long as the command prompt is opened and would like to print "Thread is Dead" only when the

Re: unicode by default

2011-05-11 Thread harrismh777
Ben Finney wrote: I'd phrase that as: * Text is a sequence of characters. Most inputs to the program, including files, sockets, etc., contain a sequence of bytes. * Always know whether you're dealing with text or with bytes. No object can be both. * In Python 2, ‘str’ is the type f

Re: unicode by default

2011-05-11 Thread harrismh777
Terry Reedy wrote: It does not matter how Python stored the unicode internally. Does this help? Your intent is signalled by how you open the file. Very much, actually, thanks. I was missing the 'internal' piece, and did not realize that if I didn't specify the encoding on the open that pytho

<    1   2