Re: A case for "real" multiline comments

2012-04-18 Thread Chris Angelico
On Thu, Apr 19, 2012 at 4:04 PM, Cameron Simpson wrote: > Bah! To get into a function's docstring they need to be parsed by the > Python compiler. Ergo, not comments. > > Calling them comments in disguise is a bit of a stretch. They're fundamentally the same thing as Doxygen/Javadoc/etc comments.

Re: how do i merge two sequence

2012-04-18 Thread Peter Otten
Ervin Hegedüs wrote: > On Wed, Apr 18, 2012 at 10:41:00PM +0200, Peter Otten wrote: >> Python Email wrote: >> >> > how do i merge two seqs alernative; >> > >> > ("xyz", "7890") >> > output: x7y8z90 >> >> >>> import itertools >> >>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890",

Re: Regular expressions, help?

2012-04-18 Thread Jussi Piitulainen
Sania writes: > So I am trying to get the number of casualties in a text. After 'death > toll' in the text the number I need is presented as you can see from > the variable called text. Here is my code > I'm pretty sure my regex is correct, I think it's the group part > that's the problem. > I am

Re: Regular expressions, help?

2012-04-18 Thread Cameron Simpson
On 18Apr2012 23:11, Sania wrote: | So I am trying to get the number of casualties in a text. After 'death | toll' in the text the number I need is presented as you can see from | the variable called text. Here is my code | I'm pretty sure my regex is correct, I think it's the group part | that's t

Re: Regular expressions, help?

2012-04-18 Thread Peter Otten
Sania wrote: > So I am trying to get the number of casualties in a text. After 'death > toll' in the text the number I need is presented as you can see from > the variable called text. Here is my code > I'm pretty sure my regex is correct, I think it's the group part > that's the problem. No. A r

Re: Regular expressions, help?

2012-04-18 Thread Peter Otten
Sania wrote: > Hi, > So I am trying to get the number of casualties in a text. After 'death > toll' in the text the number I need is presented as you can see from > the variable called text. Here is my code > I'm pretty sure my regex is correct, I think it's the group part > that's the problem. N

Re: how do i merge two sequence

2012-04-18 Thread Ervin Hegedüs
hi, On Wed, Apr 18, 2012 at 10:41:00PM +0200, Peter Otten wrote: > Python Email wrote: > > > how do i merge two seqs alernative; > > > > ("xyz", "7890") > > output: x7y8z90 > > >>> import itertools > >>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890", > fillvalue="")) > 'x7y8z90'

Regular expressions, help?

2012-04-18 Thread Sania
Hi, So I am trying to get the number of casualties in a text. After 'death toll' in the text the number I need is presented as you can see from the variable called text. Here is my code I'm pretty sure my regex is correct, I think it's the group part that's the problem. I am using nltk by python. G

Re: A case for "real" multiline comments

2012-04-18 Thread Cameron Simpson
On 19Apr2012 15:13, Chris Angelico wrote: | On Thu, Apr 19, 2012 at 2:29 PM, Cameron Simpson wrote: | > On 18Apr2012 22:07, Jordan Perr wrote: | > | I came across this case while debugging some Python code that contained an | > | error stemming from the use of multiline strings as comments. The

Re: A case for "real" multiline comments

2012-04-18 Thread Chris Angelico
On Thu, Apr 19, 2012 at 2:29 PM, Cameron Simpson wrote: > On 18Apr2012 22:07, Jordan Perr wrote: > | I came across this case while debugging some Python code that contained an > | error stemming from the use of multiline strings as comments. The code > | contained a very long list of objects, and

Re: A case for "real" multiline comments

2012-04-18 Thread Devin Jeanpierre
On Thu, Apr 19, 2012 at 12:29 AM, Cameron Simpson wrote: > I'd just do this: > >  list = [ >  Object1(arg), >  ## Object2(arg), >  ## Object3(arg), >  Object4(arg) >  ] > > Multiple lines of single line comments. Frankly, I find this much easier > to see (all the disabled lines are delineated with

Re: Framework for a beginner

2012-04-18 Thread lkcl
On Apr 11, 9:11 pm, biofob...@gmail.com wrote: > I am new to python and only have read the Byte of Python ebook, but want to > move to the web. I am tired of being a CMS tweaker and after I tried python, > ruby and php, the python language makes more sense (if that makes any "sense" > for the r

Re: A case for "real" multiline comments

2012-04-18 Thread Cameron Simpson
On 18Apr2012 22:07, Jordan Perr wrote: | I came across this case while debugging some Python code that contained an | error stemming from the use of multiline strings as comments. The code | contained a very long list of objects, and I had commented out some of the | objects using the multiline st

Re: Framework for a beginner

2012-04-18 Thread lkcl
On Apr 17, 9:54 am, Bryan wrote: > If by rebuilding your portfolio you mean to position yourself for a > job, then popularity counts a lot. As measured by job openings, Django > is king. yeah i can attest to that. i never get the jobs, though :) -- http://mail.python.org/mailman/listinfo/pyth

Re: md5 check

2012-04-18 Thread Dan Sommers
On Thu, 19 Apr 2012 09:31:05 +0800 contro opinion wrote: > i have download file (gpg4win-2.1.0.exe from > http://www.gpg4win.org/download.html) > when i run : > > Type "help", "copyright", "credits" or "license" for > >>> import md5 > >>> f=open('c:\gpg4win-2.1.0.exe','r') > >>> print md5.new(

Re: md5 check

2012-04-18 Thread contro opinion
>>> import md5 >>> f=open('c:\gpg4win-2.1.0.exe','rb') >>> print md5.new(f.read()).hexdigest() ad6245f3238922bb7afdc4a6d3402a65 it is still not equal f619313cb42241d6837d20d24a814b81a1fe7f6d please try it on your computer , what is wrong? 2012/4/19 Dan Sommers > On Thu, 19 Apr 2012 09:31:05

Re: md5 check

2012-04-18 Thread MRAB
On 19/04/2012 02:43, Jerry Hill wrote: On Wed, Apr 18, 2012 at 9:31 PM, contro opinion wrote: i have download file (gpg4win-2.1.0.exe from http://www.gpg4win.org/download.html) when i run : Type "help", "copyright", "credits" or "license" for import md5 f=open('c:\gpg4win-2.1.0.exe','

A case for "real" multiline comments

2012-04-18 Thread Jordan Perr
I came across this case while debugging some Python code that contained an error stemming from the use of multiline strings as comments. The code contained a very long list of objects, and I had commented out some of the objects using the multiline string. This caused a string to be appended to the

Re: md5 check

2012-04-18 Thread Dan Sommers
On Thu, 19 Apr 2012 09:31:05 +0800 contro opinion wrote: > >>> import md5 > >>> f=open('c:\gpg4win-2.1.0.exe','r') > >>> print md5.new(f.read()).hexdigest() > 'd41d8cd98f00b204e9800998ecf8427e' > > it is not = f619313cb42241d6837d20d24a814b81a1fe7f6d > gpg4win-2.1.0.exe please see :gpg4win-2

Re: md5 check

2012-04-18 Thread Jerry Hill
On Wed, Apr 18, 2012 at 9:31 PM, contro opinion wrote: > i have download  file (gpg4win-2.1.0.exe  from > http://www.gpg4win.org/download.html) > when i run : > > Type "help", "copyright", "credits" or "license" for import md5 f=open('c:\gpg4win-2.1.0.exe','r') print md5.new(f.read(

md5 check

2012-04-18 Thread contro opinion
i have download file (gpg4win-2.1.0.exe from http://www.gpg4win.org/download.html) when i run : Type "help", "copyright", "credits" or "license" for >>> import md5 >>> f=open('c:\gpg4win-2.1.0.exe','r') >>> print md5.new(f.read()).hexdigest() 'd41d8cd98f00b204e9800998ecf8427e' it is not = f61

Re: inquery

2012-04-18 Thread Simon Cropper
On 19/04/12 08:32, Lovda, Kathryn wrote: Hello, I'm having trouble trying to script for a fellow graduate student who is doing research on frogs and their homeranges. He asked me to help him by using python to manipulate his data on ArcMap 10. Here is a summary of the situation: "A fellow gradu

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Steven D'Aprano
On Wed, 18 Apr 2012 17:16:08 -0700, Miki Tebeka wrote: >> So I'm interested in suggestions/examples where a user can update a >> config file to specify by which means they want (in this case) the ssh >> functionality to be supplied. > You can do something like that (it's called a factory): > > CO

Re: how python dir works

2012-04-18 Thread Steven D'Aprano
On Wed, 18 Apr 2012 08:56:24 -0700, cheung wrote: > how does the function "dir" works, where can I get the python-c source > of dir in py2.7 project. Look for the function builtin_dir in Python/bltinmodule.c of the source code. > I looked the python_c source for hours, can't find how dir wor

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Miki Tebeka
> So I'm interested in suggestions/examples where a user can update a > config file to specify by which means they want (in this case) the ssh > functionality to be supplied. You can do something like that (it's called a factory): COMMANDS = { 'win32': 'win32 command goes here', 'linux2':

Re: system call that is killed after n seconds if not finished

2012-04-18 Thread Miki Tebeka
> I would like to execute shell commands, but only if their execution > time is not longer than n seconds. Like so: See example at http://docs.python.org/library/signal.html#example -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Richard Shea
On Apr 19, 2:28 am, tinn...@isbd.co.uk wrote: > Richard Shea wrote: > > On a *nix box this is a reasonable bit of Python : > > > cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, > > user, dns, "echo CONNECTION READY", tmp_file) > > result = os.system(cmd) > > > ... on a Window

A Design Pattern Question for Functional Programers

2012-04-18 Thread Xah Lee
Functional programing is getting the presses in mainstream. I ran across this dialogue where a imperative coder was trying to get into functional programing: A: What are the design patterns that help structure functional systems? B: Design patterns? Hey everyone, look at the muggle try to get

inquery

2012-04-18 Thread Lovda, Kathryn
Hello, I'm having trouble trying to script for a fellow graduate student who is doing research on frogs and their homeranges. He asked me to help him by using python to manipulate his data on ArcMap 10. Here is a summary of the situation: "A fellow graduate student working in the Boone Herp

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Dan Stromberg
On Wed, Apr 18, 2012 at 7:02 AM, Richard Shea wrote: > On Apr 19, 1:56 am, Irmen de Jong wrote: > > On 18-4-2012 15:35, Richard Shea wrote: > > > > > ... which I think would work and be sufficiently flexible to deal with > > > alternatives to putty.exe but is there a more established (... > > >

Re: How to determine if IO redirection is occurring with the output from a Python program?

2012-04-18 Thread Dan Stromberg
On Tue, Apr 17, 2012 at 5:52 PM, Chris Angelico wrote: > > isatty() is supported on Windows (the underlying C API is different, > but the beauty of a high-level language is that you no longer need to > care), but the standard Windows console doesn't support ANSI > sequences. I think there is a wa

Re: how python dir works

2012-04-18 Thread Terry Reedy
On 4/18/2012 11:56 AM, cheung wrote: how does the function "dir" works, > where can I get the python-c source of dir in py2.7 project. Interesting question. The CPython source is here: hg.python.org/cpython/ From there, select branches, 2.7, and browse. From there, Python/bltinmodule.c has so

Re: how do i merge two sequence

2012-04-18 Thread Peter Otten
Python Email wrote: > how do i merge two seqs alernative; > > ("xyz", "7890") > output: x7y8z90 >>> import itertools >>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890", fillvalue="")) 'x7y8z90' -- http://mail.python.org/mailman/listinfo/python-list

how do i merge two sequence

2012-04-18 Thread Python Email
how do i merge two seqs alernative; ("xyz", "7890")  output: x7y8z90 any help would be appreciated.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in Python

2012-04-18 Thread Terry Reedy
On 4/18/2012 10:22 AM, Kiuhnm wrote: The bug was confirmed and a patch is now available: http://bugs.python.org/issue14612 And applied to 2.7, 3.2, and 3.3. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Get stack trace from C

2012-04-18 Thread Eric Frederich
There are several things I'd like to do with the exceptions. Printing the 3rd party applications log via their own printf-like function. Also, calling one of their functions that stores an error string on a stack. In either case, I need access to the error string as a char*. On Tue, Apr 17, 2012 a

Re: Need some assistance on Regular expression in python

2012-04-18 Thread MRAB
On 18/04/2012 19:36, vijay swaminathan wrote: Hi Experts, I'm a new bie to python and need some assistance in the usage of regular expression. I have a string something like this: New builds available Version: 20120418-abcdef-1 (based on SDK 0.0.0.1) from the above string I want to ex

Need some assistance on Regular expression in python

2012-04-18 Thread vijay swaminathan
Hi Experts, I'm a new bie to python and need some assistance in the usage of regular expression. I have a string something like this: New builds available Version: 20120418-abcdef-1 (based on SDK 0.0.0.1) from the above string I want to extract the following text using regular expre

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-18 Thread Jeffrey Britton
I was sent via email an alternative solution which is working even better for me. In Python code use: class AppFileHandler(logging.FileHandler): def __init__(self, *args): filename, mode = args if not os.path.isabs(filename): filename = os.path.join(os.environ['APPD

Re: how python dir works

2012-04-18 Thread Vincent Vande Vyvre
Le 18/04/12 18:15, Ian Kelly a écrit : > On Wed, Apr 18, 2012 at 9:56 AM, cheung wrote: >> how does the function "dir" works, where can I get the python-c source of >> dir in py2.7 project. >> >> I looked the python_c source for hours, can't find how dir works. > http://hg.python.org/cpython/fi

Re: how python dir works

2012-04-18 Thread Ian Kelly
On Wed, Apr 18, 2012 at 9:56 AM, cheung wrote: > how does the function  "dir" works, where can I get the python-c  source of > dir in py2.7 project. > > I looked the python_c source for hours, can't find how dir works. http://hg.python.org/cpython/file/67be12ab8948/Objects/object.c#l1957 > for

how python dir works

2012-04-18 Thread cheung
how does the function "dir" works, where can I get the python-c source of dir in py2.7 project. I looked the python_c source for hours, can't find how dir works. for example: if a user input a *.py source file like foo.py, i wanna parse the file, and find all the functions and all the cla

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Chris Rebert
On Wed, Apr 18, 2012 at 6:35 AM, Richard Shea wrote: > On a *nix box this is a reasonable bit of Python : > > cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, > user, dns, "echo CONNECTION READY", tmp_file) > result = os.system(cmd) It's slightly less reasonable considering t

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Grant Edwards
On 2012-04-18, tinn...@isbd.co.uk wrote: > Richard Shea wrote: >> On a *nix box this is a reasonable bit of Python : >> >> cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, >> user, dns, "echo CONNECTION READY", tmp_file) >> result = os.system(cmd) >> >> ... on a Windows box

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread tinnews
Richard Shea wrote: > On a *nix box this is a reasonable bit of Python : > > cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, > user, dns, "echo CONNECTION READY", tmp_file) > result = os.system(cmd) > > ... on a Windows box it will fail because 'ssh' isn't part of Windows.

Re: Bug in Python

2012-04-18 Thread Kiuhnm
The bug was confirmed and a patch is now available: http://bugs.python.org/issue14612 Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Richard Shea
On Apr 19, 1:56 am, Irmen de Jong wrote: > On 18-4-2012 15:35, Richard Shea wrote: > > > ... which I think would work and be sufficiently flexible to deal with > > alternatives to putty.exe but is there a more established (... > > better !) way of doing this stuff ? > > Perhaps install Cygwin and

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread pat
Paramiko provides SSH2 support and is platform-independent (implemented purely in Python). Try it and see if it works for you. Link: http://www.lag.net/paramiko/.. On 04/18/2012 04:35 PM, Richard Shea wrote: On a *nix box this is a reasonable bit of Python : cmd = "ssh -o StrictHostKeyCheckin

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Irmen de Jong
On 18-4-2012 15:35, Richard Shea wrote: > ... which I think would work and be sufficiently flexible to deal with > alternatives to putty.exe but is there a more established (... > better !) way of doing this stuff ? Perhaps install Cygwin and use its ssh.exe? Or use the paramiko library? (which, I

Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Richard Shea
On a *nix box this is a reasonable bit of Python : cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, user, dns, "echo CONNECTION READY", tmp_file) result = os.system(cmd) ... on a Windows box it will fail because 'ssh' isn't part of Windows. There *are* ways of achieving the

python kinterbasdb - check default charset of db or table

2012-04-18 Thread miamia
Hello, I am using python 2.7 and kinterbasdb. How could I find out default charset used by database? I need to check it and then according to used charset decode returned strings. thank you -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Pyjamas-Gitweb 0.1 released

2012-04-18 Thread Luke Kenneth Casson Leighton
http://pypi.python.org/pypi/Pyjamas-GitWeb/0.1 Pyjamas-Gitweb is a pure python git repository browser, comprising an independent JSONRPC back-end service written in 130 lines that can be used by any JSONRPC client (a python command-line example is included), and a front-end python (pyjamas) writte

Re: Simple TLS NPN negotiation not working on socket server

2012-04-18 Thread Antoine Pitrou
Alek Storm gmail.com> writes: > > Connecting with either Firefox 11 or Chrome (which both support NPN) causes > this to print None, rather than a protocol name. What's going on? Ok, I've just tried with Firefox 11. You have to go in "about:config" and set "network.http.spdy.enabled" to true. The

Re: Bug in Python

2012-04-18 Thread Kiuhnm
On 4/18/2012 6:47, Hans Mulder wrote: On 18/04/12 03:08:08, Kiuhnm wrote: print(1) print(2) print(3) with open('test') as f: data = f.read() with open('test') as f: data = f.read() I get the same result with Pythin 3.3.0a0 on MacOS X 10.6: 93> ./python.exe -m pdb /tmp/script.py /

Re: Pyjamas 0.8.1~+alpha1 released

2012-04-18 Thread lkcl
Terry randomly wrote: > > Pyjamas is slowly converting to running its own infrastructure using pyjamas > > applications (which also operate as Desktop applications). This includes: > > > > * http://pyjs.org/pygit/ - a git repository viewer using python-git > seems to work fine yaay. thanks fo

Re: logging.config.fileConfig FileHandler configure to write to APP_DATA

2012-04-18 Thread Jean-Michel Pichavant
Jeffrey Britton wrote: Hi, An alternative is to subclass FileHandler with a handler customized for your app. class AppFileHandler(FileHandler): def __init__(filename): if not os.path.isabs(filename): filename = os.path.join(os.environ['APPDATA'], 'whateverdir', filename) Fil