Re: Question about compiling python 30 from subversion repository on OSX

2011-04-23 Thread Ned Deily
In article , Anthony Kong wrote: > I have checked out source code from this url > http://svn.python.org/projects/python/branches/py3k, then run > > ./configure --with-universal-archs=64-bit > make > > First of all, I got this message: > > --- > Mo

Question about compiling python 30 from subversion repository on OSX

2011-04-23 Thread Anthony Kong
Hi, all, I have checked out source code from this url http://svn.python.org/projects/python/branches/py3k, then run ./configure --with-universal-archs=64-bit make First of all, I got this message: --- Modules/Setup.dist is newer than Modules/Setup;

Re: Closing generators

2011-04-23 Thread Thomas Rachel
Am 23.04.2011 04:15, schrieb Terry Reedy: .close() methods that release operating system resources are needed *because* there is no guarantee of immediate garbage collection. They were not needed when CPython was the only Python. The with statement was added partly to make it easier to make sure

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Steven D'Aprano wrote: If that's a "serious" flaw, it's a flaw shared by the vast majority of programming languages. Yes, agreed. As for the question of "consistency", I would argue the opposite: that auto-promoting strings to numbers arguably is useful, but that is what is inconsistent, n

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Cameron Simpson wrote: | folks are not aware that 'bc' also has arbitrary precision floating | point math and a standard math library. Floating point math? I thought, historically at least, that bc is built on dc (arbitrary precision integer math, reverse polish syntax) and that consequently bc

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Cameron Simpson
On 23Apr2011 19:37, harrismh777 wrote: [...] | Yes, my "big num" research stuff was initially done in REXX, on | VM/CMS. I later ported my libraries over to OS/2 and continued with | that well into the '90s, when I discovered Unix and 'bc'. Many | folks are not aware that 'bc' also has arbitrary

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Chris Angelico
On Sun, Apr 24, 2011 at 10:42 AM, Steven D'Aprano wrote: > This is much like my experience with Apple's Hypertalk, where the only > data structure is a string. I'm very fond of Hypertalk, but it is hardly > designed with machine efficiency in mind. If you think Python is slow > now, imagine how sl

Re: When is PEP necessary?

2011-04-23 Thread Jean-Paul Calderone
On Apr 23, 5:09 pm, Daniel Kluev wrote: > On Sat, Apr 23, 2011 at 11:16 PM, Disc Magnet wrote: > > Is PEP necessary to add a new package to the standard library? > > *skip* > > Don't forget that Python is not limited to CPython. Other > implementations need these PEPs to provide compliant package

Re: Input() in Python3

2011-04-23 Thread harrismh777
Chris Rebert wrote: Well, it pretty much*was* totally removed; it was prone to misuse and had very few legitimate uses. It's just that raw_input() also got renamed simultaneously. What were you using it for? There are often much better alternatives. For the purpose pretty much described in PEP

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Steven D'Aprano
On Fri, 22 Apr 2011 01:38:21 -0500, harrismh777 wrote: > Heiko Wundram wrote: >> The difference between strong typing and weak typing is best described >> by: >> >> Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 >> (release) 1] on cygwin Type "help", "copyright", "credits" or

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread harrismh777
Chris Angelico wrote: Wow, someone else who knows REXX and OS/2! REXX was the first bignum language I met, and it was really cool after working in BASIC and 80x86 assembly to suddenly be able to work with arbitrary-precision numbers! Yes, my "big num" research stuff was initially done in REXX,

Re: A question about Python Classes

2011-04-23 Thread Steven D'Aprano
On Sat, 23 Apr 2011 13:30:02 -0700, chad wrote: > On Apr 22, 12:47 pm, Carl Banks wrote: >> On Thursday, April 21, 2011 11:00:08 AM UTC-7, MRAB wrote: >> > On 21/04/2011 18:12, Pascal J. Bourguignon wrote: >> > > chad  writes: >> >> > >> Let's say I have the following >> >> > >> class BaseHan

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > Thomas 'PointedEars' Lahn wrote: >> Chris Rebert wrote: >>> Daniel Geržo wrote: [f.newlines is None after f.readlines() when f = codecs.open(…, mode='rU', encoding='ascii'), but not when f = codecs.open(…, mode='rU')] >>> >>> […] >>> I would speculate that th

Re: When is PEP necessary?

2011-04-23 Thread Daniel Kluev
On Sat, Apr 23, 2011 at 11:16 PM, Disc Magnet wrote: > Is PEP necessary to add a new package to the standard library? > *skip* Don't forget that Python is not limited to CPython. Other implementations need these PEPs to provide compliant packages. While its not that important for pure-python modu

Re: When is PEP necessary?

2011-04-23 Thread Martin v. Loewis
Am 23.04.2011 14:16, schrieb Disc Magnet: > Is PEP necessary to add a new package to the standard library? A PEP is necessary if the proposed change is contentious. If there is widespread agreement that the change is desirable, no PEP is needed. > What if the community just wants to add a new mod

Re: A question about Python Classes

2011-04-23 Thread chad
On Apr 22, 12:47 pm, Carl Banks wrote: > On Thursday, April 21, 2011 11:00:08 AM UTC-7, MRAB wrote: > > On 21/04/2011 18:12, Pascal J. Bourguignon wrote: > > > chad  writes: > > > >> Let's say I have the following > > > >> class BaseHandler: > > >>      def foo(self): > > >>          print "He

Re: detecting newline character

2011-04-23 Thread Daniel Geržo
On 23.4.2011 21:33, Thomas 'PointedEars' Lahn wrote: Chris Rebert wrote: On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote: I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self): with contextlib.cl

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 04:48:39PM -0700, Dan Stromberg wrote: > On Thu, Apr 21, 2011 at 11:38 PM, harrismh777 wrote: > > > > > Yes. And you have managed to point out a serious flaw in the overall logic > > and consistency of Python, IMHO. > > > > Strings should auto-type-promote to numbers if app

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Chris Rebert wrote: > On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote: >> I need to detect the newline characters used in the file I am reading. >> For this purpose I am using the following code: >> >> def _read_lines(self): >> with contextlib.closing(codecs.open(self.path, "rU")) as fob

Re: Input() in Python3

2011-04-23 Thread Westley Martínez
On Fri, Apr 22, 2011 at 10:08:20AM -0400, Mel wrote: > Westley Martínez wrote: > > On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: > > >> U NO. NO NO NO. What if someone enters "os.exit()" as their > >> number? You shouldn't eval() unchecked user input! > >> > >> Chris Ang

Re: detecting newline character

2011-04-23 Thread Thomas 'PointedEars' Lahn
Daniel Geržo wrote: > I need to detect the newline characters used in the file I am reading. > For this purpose I am using the following code: > > def _read_lines(self): > with contextlib.closing(codecs.open(self.path, "rU")) as fobj: > fobj.readlines() > if isinstance(fobj

Re: detecting newline character

2011-04-23 Thread Chris Rebert
On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo wrote: > Hello guys, > > I need to detect the newline characters used in the file I am reading. For > this purpose I am using the following code: > > def _read_lines(self): >    with contextlib.closing(codecs.open(self.path, "rU")) as fobj: >        f

detecting newline character

2011-04-23 Thread Daniel Geržo
Hello guys, I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self): with contextlib.closing(codecs.open(self.path, "rU")) as fobj: fobj.readlines() if isinstance(fobj.newlines, tuple):

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Tim Chase
On 04/23/2011 11:51 AM, Dotan Cohen wrote: harrismh777 wrote: If an operation like (+) is used to add 1 + '1' then the string should be converted to int and the addition should take place, returning a reference to object int (2). No, the int 1 should be cast to a string, and the result shoul

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Fri, Apr 22, 2011 at 09:38, harrismh777 wrote: > If an operation like (+) is used to add  1 + '1' then the string should be > converted to int and the addition should take place, returning a reference > to object int (2). > No, the int 1 should be cast to a string, and the result should be the

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 22, 1:38 am, harrismh777 wrote: > Strings should auto-type-promote to numbers if appropriate. No they should not! We do not want a language to "guess" our intentions. We are big boys and girls and should be responsible for own actions. > This behavior should occur in input() as well. If

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread rantingrick
On Apr 23, 1:28 am, Dennis Lee Bieber wrote: > But what if /I/ want >                 "A" + 1 > to return >                 "B" No problem! Python even allows you to create your own functions! I know, amazing! 8-O >>> def succ(s): return chr(ord(s) + 1) >>> succ('a') 'b' >>> succ('B')

Re: Vectors

2011-04-23 Thread sturlamolden
On Apr 23, 2:26 pm, Algis Kabaila wrote: > I do understand that many people prefer Win32 and > appreciate their right to use what they want.  I just am at a > loss to understand *why* ... For the same reason some people prefered OS/2 or DEC to SunOS or BSD. For the same reason some people prefe

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread Dotan Cohen
On Wed, Apr 20, 2011 at 20:15, Ron wrote: > Hey everyone. > > I've written an online interactive Python tutorial atop Google App Engine: > http://www.learnpython.org. > > All you need to do is log in using your Google account and edit the wiki to > add your tutorials. > > Read more on the websit

Re: When is PEP necessary?

2011-04-23 Thread Steven D'Aprano
On Sat, 23 Apr 2011 17:46:26 +0530, Disc Magnet wrote: > Is PEP necessary to add a new package to the standard library? See http://www.python.org/dev/peps/pep-0001/ > What if the community just wants to add a new module to an existing > package? "Just"? Adding a new module is a big step. How

Re: learnpython.org - an online interactive Python tutorial

2011-04-23 Thread flebber
On Apr 23, 4:28 pm, Dennis Lee Bieber wrote: > On Fri, 22 Apr 2011 17:08:53 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > > > I'm not so sure that all strings should autopromote to integer (or > > "numeric" generally). However, adding a string and a number _shoul

Re: Vectors

2011-04-23 Thread Algis Kabaila
On Saturday 23 April 2011 14:13:31 sturlamolden wrote: > On Apr 23, 2:32 am, Algis Kabaila wrote: > > Thanks for that. Last time I looked at numpy (for Python3) > > it was available in source only. I know, real men do > > compile, but I am an old man... I will compile if it is > > unavoidable,

When is PEP necessary?

2011-04-23 Thread Disc Magnet
Is PEP necessary to add a new package to the standard library? What if the community just wants to add a new module to an existing package? What if only a new function has to be added to a module in the standard library? What if only a line or two are to be added to a function in the standard li

Re: suggestions, comments on an "is_subdict" test

2011-04-23 Thread Paul Rubin
Irmen de Jong writes: > I would use: > test_dct.items() <= base_dct.items() I think you need an explicit cast: set(test_dct.items()) <= set(base_dct.items()) -- http://mail.python.org/mailman/listinfo/python-list

Re: suggestions, comments on an "is_subdict" test

2011-04-23 Thread Raymond Hettinger
On Apr 22, 8:18 am, MRAB wrote: > On 22/04/2011 15:57, Irmen de Jong wrote: > > > > > > > > > On 22-4-2011 15:55, Vlastimil Brom wrote: > >> Hi all, > >> I'd like to ask for comments or advice on a simple code for testing a > >> "subdict", i.e. check whether all items of a given dictionary are > >