Re: why not?

2013-01-21 Thread Josh Benner
On Mon, Jan 21, 2013 at 7:56 AM, Lie Ryan wrote: > On 22/01/13 04:02, kwakukwat...@gmail.com wrote: > >> f = open(r'c:\text\somefile.txt') >> for i in range(3): >> print str(i) + ': ' + f.readline(), >> please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i) >> + f.readli

understanding operator overloading

2012-06-01 Thread Josh Benner
n(self.data) -> self.data = [1, 2, 4] __getitem__(index) -> index = slice(-1, 9223372036854775807, None) [4] printing blist[-2] __getitem__(index) -> index = -2 2 Best, Josh Benner -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regular expression in python

2011-08-18 Thread Josh Benner
On Thu, Aug 18, 2011 at 4:03 PM, Matt Funk wrote: > Hi guys, > > thanks for the suggestions. I had tried the white space before as well (to > no > avail). So here is the expression i am using (based on suggestions), but > still > no success: > > instance_linetype_pattern_str =\ >r'(([-+]?

Re: removing nested iffs

2011-07-29 Thread Josh Benner
On Fri, Jul 29, 2011 at 1:07 PM, Wolfgang Rohdewald wrote: > On Freitag 29 Juli 2011, Josh Benner wrote: > > if args.build not None: > > which python version understands this? > > -- > Wolfgang > Apparently the version running in my head understands it ;-) Sorr

removing nested iffs

2011-07-29 Thread Josh Benner
I'm writing a function to create a string that gets longer iff an argument is defined. In there a more elegant way than nesting all those ifs? def format_rsync_src_string(args, server="RSYNC"): """ Format an rsync source directory string. """ if args.server is None: raise CopyNigh

Re: text file

2011-06-30 Thread Josh Benner
import os lst = [] for x in xrange(1, 5001): lst.append(r"Data\ma{0}.wav Data\ma{0}.mfc".format(x)) lst.insert(x-1, r"Data\ja{0}.wav Data\ja{0}.mfc".format(x)) with open("filename.txt", "w") as fd: sep = os.linesep fd.write(sep.join(lst)) On Thu, Jun 30, 2011 at 5:19 PM, Sibonis

Re: Arrays/List, filters, Pytho, Ruby

2011-02-11 Thread Josh Benner
On Fri, Feb 11, 2011 at 1:51 PM, Dan Stromberg wrote: > On Fri, Feb 11, 2011 at 1:43 PM, André Roberge > wrote: > > On Friday, February 11, 2011 5:24:15 PM UTC-4, LL.Snark wrote: > >> Hi, > >> > >> I'm looking for a pythonic way to translate this short Ruby code : > >> t=[6,7,8,6,7,9,8,4,3,6,7]

Re: Python use growing fast

2011-01-11 Thread Josh Benner
his article ... http://neopythonic.blogspot.com/2009/11/python-in-scientific-world.html ... the answer is python. Josh Benner -- http://mail.python.org/mailman/listinfo/python-list