Re: Writing a Carriage Return in Unicode

2009-11-18 Thread MRAB
Doug wrote: Hi! I am trying to write a UTF-8 file of UNICODE strings with a carriage return at the end of each line (code below). filOpen = codecs.open("c:\\temp\\unicode.txt",'w','utf-8') str1 = u'This is a test.' str2 = u'This is the second line.' str3 = u'This is the third line.' strCR = u

Re: Arcane question regarding white space, editors, and code collapsing

2009-11-18 Thread Steven D'Aprano
On Thu, 19 Nov 2009 10:56:35 +1100, Ben Finney wrote: > Wells writes: > >> Is it... pythonic, then, to have these lines of tabs/spaces to support >> code collapsing? Is it proper, improper, or irrelevant? > > It's quite improper (though syntactically null, in Python) to have > trailing whitespa

Re: combinatorics via __future__ generators

2009-11-18 Thread Phlip
On Nov 18, 4:58 pm, Phlip wrote: > Python: > > I have a quaint combinatorics problem. Before I solve it, or find a > solution among "generators", I thought y'all might like to show off > any solutions. > > Given an array like this... > >   [0, 4, 3] > > Produce an array like this: > >   [ >     [0

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-18 Thread Steven D'Aprano
On Wed, 18 Nov 2009 15:58:24 -0800, Steve Howell wrote: > On Nov 18, 2:22 pm, Steven D'Aprano > wrote: >> On Wed, 18 Nov 2009 02:06:49 -0800, Steve Howell wrote: >> > P.S. The underscores before the method names might look a little >> > funny for inner methods, but it's the nature of the code..._

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-18 Thread Steve Howell
On Nov 18, 3:02 pm, Steven D'Aprano wrote: > Lexical duplication is one of the weakest code smells around, because it > is so prone to false negatives. You often can't avoid referring to the > same lexical element multiple times: > > def sinc(x): >     if x != 0: >         return sin(x)/x >     re

DeprecationWarning on md5

2009-11-18 Thread Zeynel
Hello, I am a newbie both in Scrapy and Python. When I create a project with Scrapy I get these errors: C:\Python26\lib\site-packages\twisted\python\filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha C:\Python26\lib\site-packages\twisted\sp

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-18 Thread Steve Howell
On Nov 18, 5:13 pm, Steven D'Aprano wrote: > On Wed, 18 Nov 2009 15:58:24 -0800, Steve Howell wrote: > > On Nov 18, 2:22 pm, Steven D'Aprano > > wrote: > >> On Wed, 18 Nov 2009 02:06:49 -0800, Steve Howell wrote: > >> > P.S. The underscores before the method names might look a little > >> > funny

Re: Arcane question regarding white space, editors, and code collapsing

2009-11-18 Thread Ben Finney
Steven D'Aprano writes: > On Thu, 19 Nov 2009 10:56:35 +1100, Ben Finney wrote: > > > It's quite improper (though syntactically null, in Python) to have > > trailing whitespace on lines. That includes blank lines. > > Blank lines are far from improper in Python, they're recommended by > PEP 8. I

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-18 Thread Steven D'Aprano
On Wed, 18 Nov 2009 17:14:27 -0800, Steve Howell wrote: > In my rewritten code, here is the smell: > > dispatches = { > 'dict': _dict, > 'list': _list, > 'attr': _attr, > 'key': _key, > 'as': _as, > 'call': _call, >

Re: non-copy slices

2009-11-18 Thread tbourden
Hi, sth == something :) sorry for the abbreviation. I'm talking about the shallow copy, still it's a copy. Unnecessary in my case and the worst part in my scenario is the creation (allocation) and deletion of a very large number of lists of moderate size (a few hundred objects) generated due to sl

Re: New syntax for blocks

2009-11-18 Thread r
On Nov 18, 5:27 pm, Steven D'Aprano wrote: > On Wed, 18 Nov 2009 18:28:11 +1300, greg wrote: > > r wrote: > >> I think the syntax was chosen because the alternatives are even worse > >> AND since assignment is SO common in programming, would you *really* > >> rather type two chars instead of one?

Re: DeprecationWarning on md5

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 5:23 PM, Zeynel wrote: > Hello, > > I am a newbie both in Scrapy and Python. When I create a project with > Scrapy I get these errors: > > C:\Python26\lib\site-packages\twisted\python\filepath.py:12: > DeprecationWarning: the sha module is deprecated; use the hashlib > modu

What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Peng Yu
http://www.python.org/dev/peps/pep-0008/ The above webpage states the following naming convention. Such a variable can be an internal variable in a class. I'm wondering what is the naming convention for the method that access such variable. - _single_leading_underscore: weak "internal use" in

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-11-18 Thread Steve Howell
On Nov 18, 5:42 pm, Steven D'Aprano wrote: > On Wed, 18 Nov 2009 17:14:27 -0800, Steve Howell wrote: > > In my rewritten code, here is the smell: > > >     dispatches = { > >             'dict': _dict, > >             'list': _list, > >             'attr': _attr, > >             'key': _key, > >  

hex

2009-11-18 Thread hong zhang
List, I want to input hex number instead of int number. in type="int" in following, parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int", default=0, help="index of 11n mcs table. Default: 0.") How can I do it? Thanks. --henry -- http://mail.python.org/mailman/listinfo/p

Re: combinatorics via __future__ generators

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 4:58 PM, Phlip wrote: > Python: > > I have a quaint combinatorics problem. Before I solve it, or find a > solution among "generators", I thought y'all might like to show off > any solutions. > > Given an array like this... > >  [0, 4, 3] > > Produce an array like this: > >

Re: non-copy slices

2009-11-18 Thread Daniel Stutzbach
On Wed, Nov 18, 2009 at 2:22 PM, Themis Bourdenas < t.bourdena...@imperial.ac.uk> wrote: > It's nothing in the library that completely imitates the slice without the > copies, right? You might be interested in my blist extension type (link below). Syntactically, using a blist is just like using

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 6:27 PM, Peng Yu wrote: > http://www.python.org/dev/peps/pep-0008/ > > The above webpage states the following naming convention. Such a > variable can be an internal variable in a class. I'm wondering what is > the naming convention for the method that access such variable.

Invitation to connect on LinkedIn

2009-11-18 Thread Jim Qiu
LinkedIn Jim Qiu requested to add you as a connection on LinkedIn: -- Jaime, I'd like to add you to my professional network on LinkedIn. - Jim Accept invitation from Jim Qiu http://www.linkedin.com/e/I2LlXdLlWUhFABKmxVOlgGLlWUhFAfhMPPF/blk/I

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Benjamin Kaplan
On Wed, Nov 18, 2009 at 9:27 PM, Peng Yu wrote: > http://www.python.org/dev/peps/pep-0008/ > > The above webpage states the following naming convention. Such a > variable can be an internal variable in a class. I'm wondering what is > the naming convention for the method that access such variable.

convert a string to a regex?

2009-11-18 Thread Peng Yu
There are many special characters listed on http://docs.python.org/library/re.html I'm wondering if there is a convenient function that can readily convert a string with the special characters to its corresponding regex. For example, "some.thing" => "some\.thing" -- http://mail.python.org/mailma

Re: non-copy slices

2009-11-18 Thread Rami Chowdhury
On Wednesday 18 November 2009 17:47:09 tbour...@doc.ic.ac.uk wrote: > Hi, > > sth == something :) sorry for the abbreviation. I'm talking about the > shallow copy, still it's a copy. I'm not sure you're understanding the point others have been making. A list item is merely another reference to

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Peng Yu
On Wed, Nov 18, 2009 at 8:50 PM, Benjamin Kaplan wrote: > On Wed, Nov 18, 2009 at 9:27 PM, Peng Yu wrote: >> http://www.python.org/dev/peps/pep-0008/ >> >> The above webpage states the following naming convention. Such a >> variable can be an internal variable in a class. I'm wondering what is >>

Re: Invitation to connect on LinkedIn

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 6:16 PM, Jim Qiu wrote: > > LinkedIn > > Jim Qiu requested to add you as a connection on LinkedIn: > > Jaime, > > I'd like to add you to my professional network on LinkedIn. > > - Jim > > > Accept View invitation from Jim Qiu > > > WHY MIGHT CONNECTING WITH JIM QIU BE A GOO

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Peng Yu
On Wed, Nov 18, 2009 at 8:47 PM, Chris Rebert wrote: > On Wed, Nov 18, 2009 at 6:27 PM, Peng Yu wrote: >> http://www.python.org/dev/peps/pep-0008/ >> >> The above webpage states the following naming convention. Such a >> variable can be an internal variable in a class. I'm wondering what is >> th

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Ben Finney
Peng Yu writes: > The above webpage states the following naming convention. Such a > variable can be an internal variable in a class. I'm wondering what is > the naming convention for the method that access such variable. A property http://docs.python.org/library/functions.html#property> named w

Re: convert a string to a regex?

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 6:51 PM, Peng Yu wrote: > There are many special characters listed on > http://docs.python.org/library/re.html > > I'm wondering if there is a convenient function that can readily > convert a string with the special characters to its corresponding > regex. For example, > >

Re: convert a string to a regex?

2009-11-18 Thread Tim Chase
There are many special characters listed on http://docs.python.org/library/re.html I'm wondering if there is a convenient function that can readily convert a string with the special characters to its corresponding regex. For example, "some.thing" => "some\.thing" Did you try bothering to *read

Re: convert a string to a regex?

2009-11-18 Thread Peng Yu
On Wed, Nov 18, 2009 at 9:12 PM, Tim Chase wrote: >> There are many special characters listed on >> http://docs.python.org/library/re.html >> >> I'm wondering if there is a convenient function that can readily >> convert a string with the special characters to its corresponding >> regex. For examp

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-18 Thread Chris Rebert
On Wed, Nov 18, 2009 at 7:04 PM, Peng Yu wrote: > On Wed, Nov 18, 2009 at 8:47 PM, Chris Rebert wrote: >> On Wed, Nov 18, 2009 at 6:27 PM, Peng Yu wrote: >>> http://www.python.org/dev/peps/pep-0008/ >>> >>> The above webpage states the following naming convention. Such a >>> variable can be an i

Qt Python radiobutton: activate event

2009-11-18 Thread Threader Slash
Hi Guys, I am trying to get the choice made by the user on Python Qt with radiobutton. QtCore.QObject.connect(self.radioButton1, QtCore.SIGNAL("toggled()"),self.radio_activateInput) QtCore.QObject.connect(self.radioButton2, QtCore.SIGNAL("toggled()"),self.radio_activateInput) and that QtCore.QO

mechanize login problem with website

2009-11-18 Thread elca
Hello I'm making auto-login script by use mechanize python. Before I was used mechanize with no problem, but http://www.gmarket.co.kr in this site I couldn't make it . whenever i try to login always login page was returned even with correct gmarket id , pass, i can't login and I saw some suspic

Re: Beautifulsoup code that is not running

2009-11-18 Thread Zeynel
Yes, it shows as empty string. But I learned about Scrapy and now I am studying the tutorial. I like it better than BeautifulSoup. For beginners it is better, I think. On Nov 18, 11:50 am, Peter Pearson wrote: > On Tue, 17 Nov 2009 14:38:55 -0800 (PST), Zeynel wrote: > > [snip] > > from Bea

Re: DeprecationWarning on md5

2009-11-18 Thread Zeynel
Thanks. I tried the suppress it but no success. I need to read the documentation more carefully. But since this is not error, I will ignore them for now. On Nov 18, 9:12 pm, Chris Rebert wrote: > On Wed, Nov 18, 2009 at 5:23 PM, Zeynel wrote: > > Hello, > > > I am a newbie both in Scrapy and Py

is there any FIX message handle modules in Python?

2009-11-18 Thread Stephen.Wu
FIX message is the "Financial information Exchange" protocol messages... any 3rd libs we have? -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any FIX message handle modules in Python?

2009-11-18 Thread alex23
On Nov 19, 3:21 pm, "Stephen.Wu" <54wut...@gmail.com> wrote: > FIX message is the "Financial information Exchange" protocol > messages... > any 3rd libs we have? You mean like this one that was the first result when I googled 'python "financial information exchange"'? http://www.quickfixengine.or

Re: IOError: [Errno 28] No space left on device

2009-11-18 Thread Terry Reedy
hong zhang wrote: "cont_x --" doesn't work. So the above can't be the actual code. You never want to post the actual code you're running. That would make it too easy for people to help. It is typo. To avoid typos, copy and paste, as has been suggested many times. -- http://mail.python.

Re: ANN: Urwid 0.9.9 - Console UI Library

2009-11-18 Thread Michel Claveau - MVP
Hi! You forget to write "urwid" do not run under Windows. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Urwid 0.9.9 - Console UI Library

2009-11-18 Thread Michel Claveau - MVP
Hi! You forget to write "urwid" do not run under Windows. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Urwid 0.9.9 - Console UI Library

2009-11-18 Thread Michel Claveau - MVP
Hi! You forget to write "urwid" do not run under Windows. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

python and web pages

2009-11-18 Thread Daniel Dalton
Hi, Here is my situation: I'm using the command line, as in, I'm not starting gnome or kde (I'm on linux.) I have a string of text attached to a variable,. So I need to use one of the browsers on linux, that run under the command line, eg. lynx, elinks, links, links2 and do the following. 1. Open

<    1   2