Re: Python Feature Request: Explicit variable declarations

2007-04-20 Thread Eduardo \"EdCrypt\" O. Padoan
> The thoughts of the inventor of Python on "Adding Optional Static > Typing to Python" are at > http://www.artima.com/weblogs/viewpost.jsp?thread=86641 > . I wonder if the idea will be implemented in Python 3.0. No. He says it in another newer post and in PEP 3099, AFAIK. -- EduardoOPadoan (e

Re: How to detect what type a variable is?

2006-11-29 Thread Eduardo \"EdCrypt\" O. Padoan
> > One might prefer to check for string-ness, as strings can > duck-type somewhat like lists: > > my_list = ['my', 'brain', 'hurts'] > my_string = 'Are you the brain specialist?' > > for test in [my_list, my_string]: > try: > for thing in test: > process_list_item(thing)

Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> def myFunc(listA): > listB = listA > work on & modify listB > return(listB) def my_func(listA): listB = listA[:] #work on & modify listB return listB Attribution makes the name t the left 'point' to the result of the expression at the right. In your myFunc the expersion at

re: Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> Won't do for the OP's needs - he wants to modify the objects contained > in listB without impacting the ones in listA (or at least that's what I > understand). Sorry. That is true - the items referenced on the [:] copy are the same as in the original. Rereading what the OP msg, I think we agree

Re: File system API

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
On 2/2/07, Tal Einat <[EMAIL PROTECTED]> wrote: > > I think that there aready exists a proposal for an Abstract FS Layer > > for Python somewere. > > I haven't been able to find any mention of it. Maybe you could point me in > the right direction? > > - Tal > http://wiki.python.org/moin/CodingProje

re: compound statement from C "?:"

2007-02-02 Thread Eduardo \&quot;EdCrypt\" O. Padoan
http://effbot.org/pyfaq/is-there-an-equivalent-of-c-s-ternary-operator.htm -- EduardoOPadoan (eopadoan->altavix::com) Bookmarks: http://del.icio.us/edcrypt Blog: http://edcrypt.blogspot.com Jabber: edcrypt at jabber dot org ICQ: 161480283 GTalk: eduardo dot padoan at gmail dot com MSN: eopadoan a

Re: lambda functions ?

2007-02-06 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> This means that "f" is not a pointer to make_incrementor but rather to > the internal (copied?) function. "returned" function isthe right here. As any returned object from a function. > > > This style is very common in Scheme programming so you might read a > > Scheme book if you want to underst

Re: Object type check

2007-02-07 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> Of cource i restrict them to particular types! In C# you cannot pass > something bad > this way because the compiler will just catch it! And you cant pass something 'good' that immitates another object interface (a file-like object for example) > I see what you mean by "duck typing". So you sug

Re: idea for testing tools

2007-02-08 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> #!/usr/bin/python > > a = 1 > b = 2 > > def test_some(): > assert a == b > > didn't reveal the values for a and b, though some more complex cases > showed something. def test_some(): print 'a:', a, 'b:', b assert a == b http://codespeak.net/py/current/doc/test.html#debug-w

Re: idea for testing tools

2007-02-08 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> That's hardly desirable. If one is writing a test library that goes as > far as reparsing the assert statements, I can't see the point of > requiring the user to clutter his test suite with such spurious print > statements. After all, that's one of the main points of test suites in > the first pl

Re: The Python interactive interpreter has no command history

2007-02-15 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> Hello, > > How to configure Python2.5's interactive interpreter to get command > history ? > > I always got ^[[A and ^[[B . > Are you using Ubuntu? The last comes with 2.4.x and 2.5. This only occurs on 2.5. This happens when you compile Python with libreadline installed, AFAIK. FIll a bug in th

Re: Pep 3105: the end of print?

2007-02-16 Thread Eduardo \&quot;EdCrypt\" O. Padoan
On 2/15/07, Edward K Ream <[EMAIL PROTECTED]> wrote: > > Isn't the very concept of major releases (1.x, 2.x, 3.x) that they *can* > > be not backwards-compatible with previous releases? > > Not at all. [...] It is the only intent of Python 3.0: be free of backward compatibity constraints. There ar

Re: why I don't like range/xrange

2007-02-16 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> But this long int => int issue should not exist in a future python > version any more, IIRC int and long int is scheduled to be merged > somehow. (Or isn't it?) It is done. http://mail.python.org/pipermail/python-3000-checkins/2007-January/000251.html -- EduardoOPadoan (eopadoan->altavix::com

Re: NEWBIE: Extending a For Statement.

2007-05-21 Thread Eduardo \&quot;EdCrypt\" O. Padoan
> > Perhaps you meant that second one to be: > > (key, mydict[key] for key in mydict if key in xrange(60, 69) or key == > > 3) > > > Clearly not! Its called *list*-comprehension, not tuple-comprehension. ;) With () instead of [], it is a generator expression. http://docs.python.org/ref/genexpr.html

Re: strange PyLint configuration (was: PEP 8 style enforcing program)

2007-05-31 Thread Eduardo \&quot;EdCrypt\" O. Padoan
On 5/31/07, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Alexander Eisenhuth wrote: > > > Pylint is one of them (http://www.logilab.org/857) > > BTW: Why does pylint want all names with underscores? I tested it > and it complains about malformed names in e.g. the following cases > that are conf