Re: Input() in Python3

2011-04-21 Thread Chris Angelico
On Fri, Apr 22, 2011 at 4:49 PM, Chris Angelico wrote: > U NO. NO NO NO. What if someone enters "os.exit()" as their > number? You shouldn't eval() unchecked user input! Whoops, I meant sys.exit() - but you probably knew that already. ChrisA -- http://mail.python.org/mailman/listinfo/py

Re: Input() in Python3

2011-04-21 Thread Chris Angelico
On Fri, Apr 22, 2011 at 4:22 PM, harrismh777 wrote: > now we get this for input(): > >   raw_input("prompt>") --> string I would have to say that the 2.x behaviour of input() is a mistake that's being corrected in 3.x. With a simple name like input(), it should do something simple and straightfor

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread harrismh777
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 "license" for more information. >>> 1+'2' Traceback (most recent c

Re: dictionary size changed during iteration

2011-04-21 Thread John Nagle
On 4/20/2011 5:52 AM, Laszlo Nagy wrote: Given this iterator: class SomeIterableObject(object): def __iter__(self): ukeys = self.updates.keys() for key in ukeys: if self.updates.has_key(key): yield self.updates[key] for rec in self.inserts: yield rec How can I get this exce

Input() in Python3

2011-04-21 Thread harrismh777
My interactive scripts are giving errors on the input(). I discovered another fairly significant change in Python3, as discussed in PEP 3111. I was a little flabbergasted to discover that input() was proposed to be removed 'totally' from 3000. Of course I agree with PEP 3111 and am thankful th

Re: Teaching Python

2011-04-21 Thread harrismh777
Westley Martínez wrote: But really, hack >has always been a negative term. It's original definition is chopping, >breaking down, kind of like chopping down the security on someone elses >computer. Now I don't know where the term originally came from, but the >definition the media uses is q

Re: Teaching Python

2011-04-21 Thread harrismh777
MRAB wrote: A computer hacker doesn't write the requirements of the software or draw Jackson Structured Programming diagrams, etc, but just thinks about what's needed and starts writing the code. Very close... ... hackers don't necessarily care what something was designed to do, only what ca

Re: Teaching Python

2011-04-21 Thread harrismh777
MRAB wrote: That's a cowboy coder. A cowboy coder is someone who's bad at coding, a hacker is someone who's good at it. A hacker is someone who loves to code and doesn't really care whether anyone else thinks they're really at it or not... although, yes, they generally are *very* good at it

Re: Closing generators

2011-04-21 Thread Terry Reedy
On 4/21/2011 9:14 PM, Thomas Rachel wrote: Hi folks, it is possible to close a generator. That is (among others) for the following case: I run a for loop over the iterator, but then I break it. Now I can leave the generator to the GC (which is AFAI have been told a thing which I should not do),

Re: Snowball to Python compiler

2011-04-21 Thread Terry Reedy
On 4/21/2011 8:25 PM, Paul Rubin wrote: Matt Chaput writes: I'm looking for some code that will take a Snowball program and compile it into a Python script. Or, less ideally, a Snowball interpreter written in Python. (http://snowball.tartarus.org/) Anyone heard of such a thing? I never saw

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Diego Arias
On Thu, Apr 21, 2011 at 8:20 PM, Dan Stromberg wrote: > > On Thu, Apr 21, 2011 at 9:13 AM, MRAB wrote: > >> On 21/04/2011 15:14, Westley Martínez wrote: >> >>> On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: >>> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: >>>

Re: A question about Python Classes

2011-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2011 19:00:08 +0100, MRAB wrote: >>> How can HomeHandler call foo() when I never created an instance of >>> BaseHandler? >> >> But you created one! >> > No, he didn't, he created an instance of HomeHandler. > >> test is an instance of HomeHandler, which is a subclass of BaseHandler

Re: Argument count mismatch

2011-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2011 12:33:09 -0700, RVince wrote: > I am getting the following: > > Error - : cmseditorlinemethod() takes > exactly 2 arguments (1 given) > > When I make the following call: > > http://localhost/eligibility/cmseditorlinemethod/474724434 That's not a call, that's a URL. It's als

Re: Vectors

2011-04-21 Thread Gregory Ewing
Algis Kabaila wrote: the Vector3 class is available without any prefix euclid: import euclid v = Vector3(111.., 222.2, 333.3) Doesn't work that way for me: Python 2.7 (r27:82500, Oct 15 2010, 21:14:33) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "lic

Re: Teaching Python

2011-04-21 Thread Westley Martínez
On Fri, Apr 22, 2011 at 01:25:00AM +0100, MRAB wrote: > On 21/04/2011 23:36, Westley Martínez wrote: > >On Thu, Apr 21, 2011 at 05:11:32PM +0100, MRAB wrote: > >>On 21/04/2011 14:58, Westley Martínez wrote: > >>>On Thu, Apr 21, 2011 at 06:02:08AM +0200, Stefan Behnel wrote: > Ben Finney, 20.04.

Closing generators

2011-04-21 Thread Thomas Rachel
Hi folks, it is possible to close a generator. That is (among others) for the following case: I run a for loop over the iterator, but then I break it. Now I can leave the generator to the GC (which is AFAI have been told a thing which I should not do), or I can clean up myself. Example: f

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Dan Stromberg
On Thu, Apr 21, 2011 at 9:13 AM, MRAB wrote: > On 21/04/2011 15:14, Westley Martínez wrote: > >> On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: >> >>> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila >>> wrote: >>> False: Python IS strongly typed, without doubt (though the >>

Re: About threads in python

2011-04-21 Thread Dan Stromberg
On Thu, Apr 21, 2011 at 6:19 AM, dutche wrote: > Hi folks, how are ya? > > Here's the thing...I had to make a program with threads and after > finished, I found some posts and articles in Google about Python and > threads, raising the question about if it really implements thread > programming or

Re: is there a difference between one line and many lines

2011-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2011 14:35:25 +0200, Peter Otten wrote: > Steven D'Aprano wrote: > >> but: >> > a = 1001; b = 10001; a is b >> False > > I would hope so ;) Doh! >> The point is that Python is free to re-use immutable objects, or not >> re- use them, as it sees fit. > > Indeed, and I eve

Re: Snowball to Python compiler

2011-04-21 Thread Paul Rubin
Matt Chaput writes: > I'm looking for some code that will take a Snowball program and > compile it into a Python script. Or, less ideally, a Snowball > interpreter written in Python. > > (http://snowball.tartarus.org/) > > Anyone heard of such a thing? I never saw snowball before, it looks kind o

Re: Teaching Python

2011-04-21 Thread MRAB
On 21/04/2011 23:36, Westley Martínez wrote: On Thu, Apr 21, 2011 at 05:11:32PM +0100, MRAB wrote: On 21/04/2011 14:58, Westley Martínez wrote: On Thu, Apr 21, 2011 at 06:02:08AM +0200, Stefan Behnel wrote: Ben Finney, 20.04.2011 02:06: Dan Stromberg writes: On Tue, Apr 19, 2011 at 4:03 PM,

Re: Snowball to Python compiler

2011-04-21 Thread Matt Chaput
A third (more-than-) possible solution: google("python snowball"); the first page of results has at least 3 hits referring to Python wrappers for Snowball. There are quite a few wrappers for the C-compiled snowball stemmers, but I'm looking for a pure-Python solution. It doesn't seem like there

Re: Snowball to Python compiler

2011-04-21 Thread John Machin
On Friday, April 22, 2011 8:05:37 AM UTC+10, Matt Chaput wrote: > I'm looking for some code that will take a Snowball program and compile > it into a Python script. Or, less ideally, a Snowball interpreter > written in Python. > > (http://snowball.tartarus.org/) If anyone has done such things

Re: Argument count mismatch

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 12:33:09PM -0700, RVince wrote: > I am getting the following: > > Error - : cmseditorlinemethod() takes > exactly 2 arguments (1 given) > > When I make the following call: > > http://localhost/eligibility/cmseditorlinemethod/474724434 > > Which invokes: > > def cmsedito

Re: Teaching Python

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 05:11:32PM +0100, MRAB wrote: > On 21/04/2011 14:58, Westley Martínez wrote: > >On Thu, Apr 21, 2011 at 06:02:08AM +0200, Stefan Behnel wrote: > >>Ben Finney, 20.04.2011 02:06: > >>>Dan Stromberg writes: > >>> > On Tue, Apr 19, 2011 at 4:03 PM, geremy condra wrote: > >>>

Snowball to Python compiler

2011-04-21 Thread Matt Chaput
On the slim chance that (a) somebody worked on something like this but never uploaded it to PyPI, and (b) the person who did (a) or heard about it is reading this list ;) -- I'm looking for some code that will take a Snowball program and compile it into a Python script. Or, less ideally, a Sno

Re: Argument count mismatch

2011-04-21 Thread John Gordon
In RVince writes: > def cmseditorlinemethod(self, ssn): > c.details = > Session.query(MSPResponse).filter(MSPResponse.beneficiaryssn == > ssn).all() > content = render('/cmseditorline.mako') > return content Is cmseditorlinemethod() a member of a class? The presence of

Re: Finding empty columns. Is there a faster way?

2011-04-21 Thread Jon Clements
On Apr 21, 5:40 pm, nn wrote: > time head -100 myfile  >/dev/null > > real    0m4.57s > user    0m3.81s > sys     0m0.74s > > time ./repnullsalt.py '|' myfile > 0 1 Null columns: > 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 > > real    1m28.94s > user    1m28.11s > sys     0m0.

Re: Argument count mismatch

2011-04-21 Thread Chris Angelico
On Fri, Apr 22, 2011 at 5:33 AM, RVince wrote: > I am getting the following: > > Error - : cmseditorlinemethod() takes > exactly 2 arguments (1 given) > > When I make the following call: > > http://localhost/eligibility/cmseditorlinemethod/474724434 > > Which invokes: > > def cmseditorlinemethod(s

Re: Argument count mismatch

2011-04-21 Thread Wolfgang Rohdewald
On Donnerstag 21 April 2011, RVince wrote: > When I make the following call: > > http://localhost/eligibility/cmseditorlinemethod/474724434 broken link - I have no /eligilibity on my localhost -- Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Argument count mismatch

2011-04-21 Thread RVince
I am getting the following: Error - : cmseditorlinemethod() takes exactly 2 arguments (1 given) When I make the following call: http://localhost/eligibility/cmseditorlinemethod/474724434 Which invokes: def cmseditorlinemethod(self, ssn): c.details = Session.query(MSPResponse).filter(MS

Re: Remote Connection

2011-04-21 Thread Irmen de Jong
On 20-04-11 05:26, ray wrote: The speech commands will scripted in Python. Dragonfly is the Python project to coordinate this but does not address connectivity. So I am wondering if there have been any Python projects to address the connectivity. ray I'm not quite sure what you want exactly

Re: Groups in regular expressions don't repeat as expected

2011-04-21 Thread Vlastimil Brom
2011/4/20 MRAB : > On 20/04/2011 20:20, John Nagle wrote: >> >> Here's something that surprised me about Python regular expressions. >> >> ... > You should take a look at the regex module on PyPI. :-) > -- > Ah well... sorry for possibly destroying the point and the aha! effect ... vbr -- htt

Re: A question about Python Classes

2011-04-21 Thread Ethan Furman
chad wrote: Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call foo() when I never created an instance of BaseHandler? Yo

Re: A question about Python Classes

2011-04-21 Thread MRAB
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 "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call fo

Re: A question about Python Classes

2011-04-21 Thread Terry Reedy
On 4/21/2011 11:43 AM, chad wrote: Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call foo() when I never created an ins

Re: Python 3.2 on CentOS 5.6 & compatibility concerns

2011-04-21 Thread Terry Reedy
On 4/21/2011 8:02 AM, Rob McGillivray wrote: Hi All, Does anyone know if it is ‘safe’ to install Python 3.2 on CentOS? By ‘safe’ I mean not breaking the existing base Python 2.4.x installation upon which various CentOS/RHEL services (like yum) depend. Will the ‘make install’ install 3.2 in paral

Re: A question about Python Classes

2011-04-21 Thread Pascal J. Bourguignon
chad writes: > Let's say I have the following > > class BaseHandler: > def foo(self): > print "Hello" > > class HomeHandler(BaseHandler): > pass > > > Then I do the following... > > test = HomeHandler() > test.foo() > > How can HomeHandler call foo() when I never created an in

Re: A question about Python Classes

2011-04-21 Thread Benjamin Kaplan
On Apr 21, 2011 12:55 PM, "chad" wrote: > > On Apr 21, 9:30 am, Jean-Michel Pichavant > wrote: > > chad wrote: > > > Let's say I have the following > > > > > class BaseHandler: > > > def foo(self): > > > print "Hello" > > > > > class HomeHandler(BaseHandler): > > > pass > > >

Re: A question about Python Classes

2011-04-21 Thread chad
On Apr 21, 9:30 am, Jean-Michel Pichavant wrote: > chad wrote: > > Let's say I have the following > > > class BaseHandler: > >     def foo(self): > >         print "Hello" > > > class HomeHandler(BaseHandler): > >     pass > > > Then I do the following... > > > test = HomeHandler() > > test.fo

Finding empty columns. Is there a faster way?

2011-04-21 Thread nn
time head -100 myfile >/dev/null real0m4.57s user0m3.81s sys 0m0.74s time ./repnullsalt.py '|' myfile 0 1 Null columns: 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 real1m28.94s user1m28.11s sys 0m0.72s import sys def main(): with open(sys.argv[2

Re: A question about Python Classes

2011-04-21 Thread Jean-Michel Pichavant
chad wrote: Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call foo() when I never created an instance of BaseHandler? Cha

shared dictionary of dictionaries with Manager

2011-04-21 Thread Darío Suárez Gracia
Hi all, I was trying to share a dictionary of dictionaries of arrays with Manager from multiprocessing. Without multiprocessing the code works perfectly, but with the current example the last print does not show the correct result. Any hint? Thanks, Darío Suárez#!/usr/local/bin/python2.7

Re: A question about Python Classes

2011-04-21 Thread Rafael Durán Castañeda
You did: >>> class BaseHandler: ... def foo(self): ... print "Hello" ... >>> class HomerHandler(BaseHandler): ... pass ... >>> test = HomerHandler() >>> test.foo() Hello >>> isinstance(test, BaseHandler) True >>> isinstance(test, HomerHandler) True >>> You could say test is a

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread MRAB
On 21/04/2011 15:14, Westley Martínez wrote: On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: False: Python IS strongly typed, without doubt (though the variables are not explicitly declared.) Strongly duck-typed though. If

Re: Teaching Python

2011-04-21 Thread MRAB
On 21/04/2011 14:58, Westley Martínez wrote: On Thu, Apr 21, 2011 at 06:02:08AM +0200, Stefan Behnel wrote: Ben Finney, 20.04.2011 02:06: Dan Stromberg writes: On Tue, Apr 19, 2011 at 4:03 PM, geremy condra wrote: When you say 'hacking', you mean ? Presumably he meant the real meaning

Re: How deal with the coding

2011-04-21 Thread MRAB
On 21/04/2011 07:27, 1011_wxy wrote: Dear All: I got a coding problem when I use python to read html from web which is encode with gb2312, ater I insert the data I read from web into Oracle DB with coding gbk, I found messy code by select from PL/SQL. I tried the way ".encode('gbk','ignore')" bef

A question about Python Classes

2011-04-21 Thread chad
Let's say I have the following class BaseHandler: def foo(self): print "Hello" class HomeHandler(BaseHandler): pass Then I do the following... test = HomeHandler() test.foo() How can HomeHandler call foo() when I never created an instance of BaseHandler? Chad -- http://m

Python-URL! - weekly Python news and links (Apr 21)

2011-04-21 Thread Cameron Laird
QOTW: "Python is a pragmatic language, so all the rules come pre- broken." - Mel http://groups.google.com/group/comp.lang.python/msg/208face4a8e00062 Look! In the sky! It's a SciPy demonstration! It's a business! No, it's ForecastWatch: http://goo.gl/AvzqZ EuroPython 201

Re: Problem receiving UDP broadcast packets.

2011-04-21 Thread Grant Edwards
On 2011-04-21, Dan Stromberg wrote: > On Wed, Apr 20, 2011 at 7:21 AM, Grant Edwards > wrote: >> On 2011-04-20, Dan Stromberg wrote: >>> On Tue, Apr 19, 2011 at 8:12 PM, Dan Stromberg wrote: I agree though that you're kind of pushing IP in a direction it wasn't intended to go. >>> >>

Re: is there a difference between one line and many lines

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 02:38:52AM -0700, vino19 wrote: > Hello, I'm a newbie. > What's the defference between > > >>>a=-6; b=-6; a is b > >>>True > > and > > >>>a=-6 > >>>b=-6 > >>>a is b > >>>False > > ? > -- > http://mail.python.org/mailman/listinfo/python-list Depends on how the interpret

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote: > On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: > > False: Python IS strongly typed, without doubt (though the > > variables are not explicitly declared.) > > Strongly duck-typed though. If I create a class that has all the r

Re: Vectors

2011-04-21 Thread Anssi Saari
Andreas Tawn writes: > You might also want to consider http://code.google.com/p/pyeuclid/ Thanks, I was studying quaternions recently and had to use two packages to get some stuff done. And of course one of them used ass-backwards declaration for a quaternion and one didn't... -- http://mail.py

Re: About threads in python

2011-04-21 Thread Stefan Behnel
dutche, 21.04.2011 15:19: Here's the thing...I had to make a program with threads and after finished, I found some posts and articles in Google about Python and threads, raising the question about if it really implements thread programming or not, because of GIL and the way Python needs to lock s

Re: Teaching Python

2011-04-21 Thread Westley Martínez
On Thu, Apr 21, 2011 at 06:02:08AM +0200, Stefan Behnel wrote: > Ben Finney, 20.04.2011 02:06: > >Dan Stromberg writes: > > > >>On Tue, Apr 19, 2011 at 4:03 PM, geremy condra wrote: > >>>When you say 'hacking', you mean ? > >> > >>Presumably he meant the real meaning of the word, not what the p

Re: Groups in regular expressions don't repeat as expected

2011-04-21 Thread Vlastimil Brom
2011/4/20 John Nagle : > Here's something that surprised me about Python regular expressions. > krex = re.compile(r"^([a-z])+$") s = "abcdef" ms = krex.match(s) ms.groups() > ('f',) > >... > "If a group is contained in a part of the pattern that matched multiple > times, the la

About threads in python

2011-04-21 Thread dutche
Hi folks, how are ya? Here's the thing...I had to make a program with threads and after finished, I found some posts and articles in Google about Python and threads, raising the question about if it really implements thread programming or not, because of GIL and the way Python needs to lock some o

Re: Groups in regular expressions don't repeat as expected

2011-04-21 Thread Neil Cerutti
On 2011-04-20, John Nagle wrote: > Findall does something a bit different. It returns a list of > matches of the entire pattern, not repeats of groups within > the pattern. > > Consider a regular expression for matching domain names: > > >>> kre = re.compile(r'^([a-zA-Z0-9\-]+)(?:\.([a-z

Re: is there a difference between one line and many lines

2011-04-21 Thread Peter Otten
Steven D'Aprano wrote: > but: > a = 1001; b = 10001; a is b > False I would hope so ;) > The point is that Python is free to re-use immutable objects, or not re- > use them, as it sees fit. Indeed, and I even found a Python implementation on my harddisk that does what you intended to sh

Re: is there a difference between one line and many lines

2011-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2011 02:55:52 -0700, vino19 wrote: > Sure, I understand that "is" is not "==", cause "is" just compares > id(a)==id(b). > > I have a win32 CPython and the range of "singletons" is from -5 to 256 > on my machine. > > I am asking about what happens in Python interpreter? Why is ther

Python 3.2 on CentOS 5.6 & compatibility concerns

2011-04-21 Thread Rob McGillivray
Hi All, Does anyone know if it is 'safe' to install Python 3.2 on CentOS? By 'safe' I mean not breaking the existing base Python 2.4.x installation upon which various CentOS/RHEL services (like yum) depend. Will the 'make install' install 3.2 in parallel with the existing 2.x installation, or

Re: Hello Sweet Friends

2011-04-21 Thread Krzysztof Bieniasz
Dnia Thu, 21 Apr 2011 01:11:34 -0600, Ian Kelly napisał(a): > On Thu, Apr 21, 2011 at 12:28 AM, harrismh777 > wrote: >>   I don't like SPAM with my eggs and ham... > > Nor do the rest of us, so please don't help it circumvent our spam > filters by reposting it. Hey, this is comp.lang.python, it

Reposting meat-like products [was Re: Hello Sweet Friends]

2011-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2011 01:11:34 -0600, Ian Kelly wrote: > On Thu, Apr 21, 2011 at 12:28 AM, harrismh777 > wrote: >>   I don't like SPAM with my eggs and ham... > > Nor do the rest of us, so please don't help it circumvent our spam > filters by reposting it. Harris did cut out the URL though, so he

Re: is there a difference between one line and many lines

2011-04-21 Thread Jean-Michel Pichavant
vino19 wrote: Sure, I understand that "is" is not "==", cause "is" just compares id(a)==id(b). I have a win32 CPython and the range of "singletons" is from -5 to 256 on my machine. I am asking about what happens in Python interpreter? Why is there a difference between running one line like "

Re: is there a difference between one line and many lines

2011-04-21 Thread Peter Otten
vino19 wrote: > Hello, I'm a newbie. > What's the defference between > a=-6; b=-6; a is b True > > and > a=-6 b=-6 a is b False > > ? When you write it as a single line the assignments to a and b are part of the same compilation process, and as an optimization CPython

Re: is there a difference between one line and many lines

2011-04-21 Thread vino19
Python 2.7.1 (downloaded from python.org a week ago) You see, if I save this to a file and then run from CMD: "python test1.py" the result will be the same: "True" When I use IDLE or IPython or DreamPie or maybe something else then result is not the same. So maybe as Chris Angelico said it is t

Re: Feature suggestion -- return if true

2011-04-21 Thread Thomas Rachel
Am 13.04.2011 01:06, schrieb Ethan Furman: --> def func(): --> var1 = something() --> var2 = something_else('this') --> return? var1.hobgle(var2) --> var3 = last_resort(var1) --> return var3.wiglat(var2) This makes me think of a decorator which can mimic the wantend behaviour: def getfirst(f)

Re: is there a difference between one line and many lines

2011-04-21 Thread Heiko Wundram
Am 21.04.2011 11:59, schrieb Heiko Wundram: > Am 21.04.2011 11:55, schrieb vino19: >> I am asking about what happens in Python interpreter? Why is there a >> difference between running one line like "a=1;b=1" and two lines like "a=1 >> \n b=1"? Does it decide to locate memory in different types d

Re: is there a difference between one line and many lines

2011-04-21 Thread Daniel Kluev
On Thu, Apr 21, 2011 at 8:38 PM, vino19 wrote: > Hello, I'm a newbie. > What's the defference between >*skip* What is version of CPython? In 2.7.1 and 3.1.3 both versions return True, and moreover, are compiled to identical bytecode. >>> def test1(): ... a=-6; b=-6; c = a is b ... return

Re: is there a difference between one line and many lines

2011-04-21 Thread Chris Angelico
On Thu, Apr 21, 2011 at 7:55 PM, vino19 wrote: > Sure, I understand that "is" is not "==", cause "is" just compares > id(a)==id(b). > > I have a win32 CPython and the range of "singletons" is from -5 to 256 on my > machine. > > I am asking about what happens in Python interpreter? Why is there a

Re: is there a difference between one line and many lines

2011-04-21 Thread Heiko Wundram
Am 21.04.2011 11:55, schrieb vino19: > I am asking about what happens in Python interpreter? Why is there a > difference between running one line like "a=1;b=1" and two lines like "a=1 \n > b=1"? Does it decide to locate memory in different types depend on a code? There is no difference between

Re: is there a difference between one line and many lines

2011-04-21 Thread vino19
Sure, I understand that "is" is not "==", cause "is" just compares id(a)==id(b). I have a win32 CPython and the range of "singletons" is from -5 to 256 on my machine. I am asking about what happens in Python interpreter? Why is there a difference between running one line like "a=1;b=1" and two

Re: is there a difference between one line and many lines

2011-04-21 Thread Chris Angelico
On Thu, Apr 21, 2011 at 7:38 PM, vino19 wrote: > Hello, I'm a newbie. > What's the defference between > a=-6; b=-6; a is b True > > and > a=-6 b=-6 a is b False You may want to use the == operator rather than "is". When you use "is", you're asking Python if the two variabl

is there a difference between one line and many lines

2011-04-21 Thread vino19
Hello, I'm a newbie. What's the defference between >>>a=-6; b=-6; a is b >>>True and >>>a=-6 >>>b=-6 >>>a is b >>>False ? -- http://mail.python.org/mailman/listinfo/python-list

How deal with the coding

2011-04-21 Thread 1011_wxy
Dear All: I got a coding problem when I use python to read html from web which is encode with gb2312, ater I insert the data I read from web into Oracle DB with coding gbk, I found messy code by select from PL/SQL. I tried the way ".encode('gbk','ignore')" before insert Oracle by using cx_Oracle

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Heiko Wundram
Am 21.04.2011 09:19, schrieb Chris Angelico: > On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: >> False: Python IS strongly typed, without doubt (though the >> variables are not explicitly declared.) > > Strongly duck-typed though. If I create a class that has all the right > members, it ca

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread harrismh777
Algis Kabaila wrote: [quote] Python is completely object oriented, and not "strongly typed" [/quote] False: Python IS strongly typed, without doubt (though the variables are not explicitly declared.) Playing the advocate for a moment here, this is something that I was confused about early o

Re: Vectors

2011-04-21 Thread Algis Kabaila
On Thursday 21 April 2011 01:49:57 Andreas Tawn wrote: > > On Apr 20, 6:43 am, Andreas Tawn wrote: > > > > Algis Kabaila writes: > > > > > Are there any modules for vector algebra (three > > > > > dimensional vectors, vector addition, subtraction, > > > > > multiplication [scalar and vector]. Co

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Chris Angelico
On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila wrote: > False: Python IS strongly typed, without doubt (though the > variables are not explicitly declared.) Strongly duck-typed though. If I create a class that has all the right members, it can simultaneously be a file, an iterable, a database, an

Re: Hello Sweet Friends

2011-04-21 Thread Ian Kelly
On Thu, Apr 21, 2011 at 12:28 AM, harrismh777 wrote: >   I don't like SPAM with my eggs and ham... Nor do the rest of us, so please don't help it circumvent our spam filters by reposting it. -- http://mail.python.org/mailman/listinfo/python-list

Re: learnpython.org - an online interactive Python tutorial

2011-04-21 Thread Algis Kabaila
On Thursday 21 April 2011 03:15:50 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 we