Re: Clarification on Immutability please

2020-01-28 Thread Chris Angelico
On Wed, Jan 29, 2020 at 1:50 AM Random832 wrote: > > On Wed, Jan 22, 2020, at 02:34, Stephen Tucker wrote: > > Oh dear, I am sorry. I have created quite a storm. > > > > Moreover, I am sorry because I misremembered what I had typed into Idle. My > > original tuple only had two elements, not three,

Re: Clarification on Immutability please

2020-01-28 Thread Random832
On Wed, Jan 22, 2020, at 02:34, Stephen Tucker wrote: > Oh dear, I am sorry. I have created quite a storm. > > Moreover, I am sorry because I misremembered what I had typed into Idle. My > original tuple only had two elements, not three, so the slicing [:2] didn't > affect the tuple at all - and s

Re: Clarification on Immutability please

2020-01-28 Thread Chris Angelico
On Tue, Jan 28, 2020 at 9:33 PM Daniel Haude wrote: > > Am 27.01.2020 15:23 schrieb Chris Angelico: > > > The way execution works in Python, you first evaluate the object, then > > assign it to the target. The new object HAS to exist before the old > > one is replaced. There's no such thing as "at

Re: Clarification on Immutability please

2020-01-28 Thread Daniel Haude
Am 27.01.2020 15:23 schrieb Chris Angelico: The way execution works in Python, you first evaluate the object, then assign it to the target. The new object HAS to exist before the old one is replaced. There's no such thing as "atomic reassignment" that simultaneously destroys the old object and a

Re: Clarification on Immutability please

2020-01-27 Thread Chris Angelico
On Tue, Jan 28, 2020 at 2:44 AM Souvik Dutta wrote: > > If the two objects have the same value that means that when called all of > them will point to the same object rather than creating the same value - > object pairs twice. Immutability is the characteristics that does not let you > change t

Re: Clarification on Immutability please

2020-01-27 Thread Chris Angelico
On Tue, Jan 28, 2020 at 1:13 AM Musbur wrote: > > Am 21.01.2020 19:38 schrieb Chris Angelico: > > Are you sure that it does? I can't reproduce this. When you slice the > > first two from a tuple, you create a new tuple, and until the > > assignment happens, both the new one and the original coexis

Re: Clarification on Immutability please

2020-01-27 Thread Musbur
Am 21.01.2020 19:38 schrieb Chris Angelico: On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote: and even that the first id(mytup) returns the same address as the second one, I am left wondering exactly what immutability is. Let's look at id()'s documentation: id(object) Return the

Re: Clarification on Immutability please

2020-01-22 Thread Richard Damon
On 1/21/20 8:41 PM, Jon Ribbens via Python-list wrote: Whether we call the link between 'foo' and (1, 2) a pointer or a reference is almost entirely irrelevant, the difference is essentially meaningless. The issue is that in Python, objects and names are fairly distinct. Unlike a language like

Re: Clarification on Immutability please

2020-01-22 Thread Eryk Sun
On 1/21/20, Jon Ribbens via Python-list wrote: > > Whether we call the link between 'foo' and (1, 2) a pointer or a > reference is almost entirely irrelevant, the difference is essentially > meaningless. In programming terms, a "pointer" is always an address in memory, and, at least to me, the te

Re: Clarification on Immutability please

2020-01-21 Thread Stephen Tucker
Oh dear, I am sorry. I have created quite a storm. Moreover, I am sorry because I misremembered what I had typed into Idle. My original tuple only had two elements, not three, so the slicing [:2] didn't affect the tuple at all - and so the second id() gave the same address as the first one. So, y

Re: Clarification on Immutability please

2020-01-21 Thread Michael Torrie
On 1/21/20 6:52 PM, Ethan Furman wrote: > On 01/21/2020 10:55 AM, Michael Torrie wrote: > >> Slicing >> returns a new object whether one is slicing a tuple, list, or a string, >> the latter two are mutable objects. > > Strings are not mutable. Yup I got my items in the wrong order. I meant to sa

Re: Clarification on Immutability please

2020-01-21 Thread MRAB
On 2020-01-22 01:52, Ethan Furman wrote: On 01/21/2020 10:55 AM, Michael Torrie wrote: Slicing returns a new object whether one is slicing a tuple, list, or a string, the latter two are mutable objects. Strings are not mutable. In the case of tuples and strings, if the slicing encompasses th

Re: Clarification on Immutability please

2020-01-21 Thread Ethan Furman
On 01/21/2020 10:55 AM, Michael Torrie wrote: Slicing returns a new object whether one is slicing a tuple, list, or a string, the latter two are mutable objects. Strings are not mutable. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Clarification on Immutability please

2020-01-21 Thread Jon Ribbens via Python-list
On 2020-01-21, Chris Angelico wrote: > On Wed, Jan 22, 2020 at 8:01 AM Jon Ribbens via Python-list > wrote: >> On 2020-01-21, Chris Angelico wrote: >> > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker >> > wrote: >> >> I am left concluding that mytup is not actually a tuple (even though type >>

Re: Clarification on Immutability please

2020-01-21 Thread Cameron Simpson
On 22Jan2020 09:15, Cameron Simpson wrote: It doesn't say anything about the contents of the internal objects: >>> mytup = (1, [2, 3], (4, 5)) [...] >>> mytupl[1] = [7, 8] Traceback (most recent call last): File "", line 1, in NameError: name 'mytupl' is not defined Please igno

Re: Clarification on Immutability please

2020-01-21 Thread Cameron Simpson
On 21Jan2020 17:40, Stephen Tucker wrote: I am sure this has been answered many times before, but I need to ask it again. Given that the following is valid Python 2.7.10 (when keyboarded into Idle): mytup = ("q", "w", "e") id(mytup) mytup = mytup [:2] id(mytup) and even that the first id(myt

Re: Clarification on Immutability please

2020-01-21 Thread Chris Angelico
On Wed, Jan 22, 2020 at 8:01 AM Jon Ribbens via Python-list wrote: > > On 2020-01-21, Chris Angelico wrote: > > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker > > wrote: > >> I am left concluding that mytup is not actually a tuple (even though type > >> (mytup) tells me that it is). > > > > If

Re: Clarification on Immutability please

2020-01-21 Thread Jon Ribbens via Python-list
On 2020-01-21, Chris Angelico wrote: > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote: >> I am left concluding that mytup is not actually a tuple (even though type >> (mytup) tells me that it is). > > If type(mytup) is tuple, then mytup really truly is a tuple. There is > no other conclusio

Re: Clarification on Immutability please

2020-01-21 Thread Chris Angelico
On Wed, Jan 22, 2020 at 5:56 AM Michael Torrie wrote: > > On 1/21/20 11:38 AM, Chris Angelico wrote: > > Are you sure that it does? I can't reproduce this. When you slice the > > first two from a tuple, you create a new tuple, and until the > > assignment happens, both the new one and the original

Re: Clarification on Immutability please

2020-01-21 Thread Michael Torrie
On 1/21/20 11:38 AM, Chris Angelico wrote: > Are you sure that it does? I can't reproduce this. When you slice the > first two from a tuple, you create a new tuple, and until the > assignment happens, both the new one and the original coexist, which > means they MUST have unique IDs. And furthermo

Re: Clarification on Immutability please

2020-01-21 Thread Chris Angelico
On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote: > > Hi Python-list folk, > > I am sure this has been answered many times before, but I need to ask it > again. > > Given that the following is valid Python 2.7.10 (when keyboarded into Idle): > > mytup = ("q", "w", "e") > id(mytup) > mytup = my

Clarification on Immutability please

2020-01-21 Thread Stephen Tucker
Hi Python-list folk, I am sure this has been answered many times before, but I need to ask it again. Given that the following is valid Python 2.7.10 (when keyboarded into Idle): mytup = ("q", "w", "e") id(mytup) mytup = mytup [:2] id(mytup) and even that the first id(mytup) returns the same add

Re: Psycopg2 pool clarification

2017-06-10 Thread israel
m the psycopg2.pool module documentation, "This module offers a few pure Python classes implementing *simple* connection pooling directly in the client application" (emphasis added). The advertised list of features at http://initd.org/psycopg/features/ doesn't even mention connection p

Re: Psycopg2 pool clarification

2017-06-08 Thread Ian Kelly
On Thu, Jun 8, 2017 at 10:47 AM, Israel Brewster wrote: >> On Jun 7, 2017, at 10:31 PM, dieter wrote: >> >> israel writes: >>> On 2017-06-06 22:53, dieter wrote: >>> ... >>> As such, using psycopg2's pool is essentially >>> worthless for me (plenty of use for it, i'm sure, just not for me/my >>>

Re: Psycopg2 pool clarification

2017-06-08 Thread Israel Brewster
--- Israel Brewster Systems Analyst II Ravn Alaska 5245 Airport Industrial Rd Fairbanks, AK 99709 (907) 450-7293 --- > On Jun 7, 2017, at 10:31 PM, dieter wrote: > > israel writes: >> On 2017-06-06 22:53

Re: Psycopg2 pool clarification

2017-06-07 Thread dieter
israel writes: > On 2017-06-06 22:53, dieter wrote: > ... > As such, using psycopg2's pool is essentially > worthless for me (plenty of use for it, i'm sure, just not for me/my > use case). Could you not simply adjust the value for the "min" parameter? If you want at least "n" open connections, t

Re: Psycopg2 pool clarification

2017-06-07 Thread israel
On 2017-06-06 22:53, dieter wrote: israel writes: Since I've gotten no replies to this, I was wondering if someone could at least confirm which behavior (my expected or my observed) is *supposed* to be the correct? Should a psycopg2 pool keep connections open when returned to the pool (if close

Re: Psycopg2 pool clarification

2017-06-06 Thread dieter
israel writes: > Since I've gotten no replies to this, I was wondering if someone could > at least confirm which behavior (my expected or my observed) is > *supposed* to be the correct? Should a psycopg2 pool keep connections > open when returned to the pool (if closed is False), or should it > cl

Re: Psycopg2 pool clarification

2017-06-06 Thread israel
Since I've gotten no replies to this, I was wondering if someone could at least confirm which behavior (my expected or my observed) is *supposed* to be the correct? Should a psycopg2 pool keep connections open when returned to the pool (if closed is False), or should it close them as long as th

Psycopg2 pool clarification

2017-06-02 Thread Israel Brewster
I've been using the psycopg2 pool class for a while now, using code similar to the following: >>> pool=ThreadedConnectionPool(0,5,) >>> conn1=pool.getconn() >>> >>> pool.putconn(conn1) repeat later, or perhaps "simultaneously" in a different thread. and my understanding was that the pool l

Re: a clarification on the "global" statement sought

2016-03-11 Thread Chris Angelico
On Fri, Mar 11, 2016 at 8:09 PM, Charles T. Smith wrote: > "Python deals with variables the other way around. >They are local, if not otherwise declared. >... > def f(): > print(s) > s = "I love Paris in the summer!" > f() > ... > As there is no local variable

Re: a clarification on the "global" statement sought

2016-03-11 Thread Peter Otten
Charles T. Smith wrote: > On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote: > >> Usefully? Never. >> >> Simple question - simple answer :) >> >> ChrisA > > > Right, that was the expected answer as well. I just ran into that in > legacy code, checked out the documentation and couldn't

Re: a clarification on the "global" statement sought

2016-03-11 Thread eryk sun
On Fri, Mar 11, 2016 at 2:13 AM, Charles T. Smith wrote: > When might a "global" statement be used in the outermost level of a module? You wouldn't need this in a normal module, because locals and globals are the same. It may be useful if you're using exec with separate locals and globals, and ne

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 08:31:22 +, Mark Lawrence wrote: > Never. Hopefully this > http://www.python-course.eu/python3_global_vs_local_variables.php can > explain it better than I can :) The article is good, I'm glad to have confirmed what I have so empirical stumbled over. ... Irrespective of t

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote: > Usefully? Never. > > Simple question - simple answer :) > > ChrisA Right, that was the expected answer as well. I just ran into that in legacy code, checked out the documentation and couldn't really make that out. So I figured I bet

Re: a clarification on the "global" statement sought

2016-03-11 Thread Mark Lawrence
On 11/03/2016 08:13, Charles T. Smith wrote: When might a "global" statement be used in the outermost level of a module? Never. Hopefully this http://www.python-course.eu/python3_global_vs_local_variables.php can explain it better than I can :) (whereby, I assume a module is equivalent to

Re: a clarification on the "global" statement sought

2016-03-11 Thread Chris Angelico
On Fri, Mar 11, 2016 at 7:13 PM, Charles T. Smith wrote: > When might a "global" statement be used in the outermost level of a module? > > (whereby, I assume a module is equivalent to a python file, correct?) > Usefully? Never. Simple question - simple answer :) ChrisA -- https://mail.python.o

a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
When might a "global" statement be used in the outermost level of a module? (whereby, I assume a module is equivalent to a python file, correct?) TIA for any thoughts. cts -- https://mail.python.org/mailman/listinfo/python-list

Re: type(), modules: clarification please

2011-10-15 Thread Chris Rebert
On Sat, Oct 15, 2011 at 4:00 PM, Shane wrote: > Hi, > > When one writes, > >> className='Employee' >> baseClasses = ... >> dictionary = { ... } >> newClass = type( className, , dictionary) > > in what module does newClass belong? If it's the current module That does seem to be the case. > what c

re: type(), modules: clarification please

2011-10-15 Thread Shane
Hi, When one writes, > className='Employee' > baseClasses = ... > dictionary = { ... } > newClass = type( className, , dictionary) in what module does newClass belong? If it's the current module what code do I run to print out the name of that module in a.b.c... form? Related: If I want to make

Re: Clarification of notation

2010-09-30 Thread Dave Angel
On 2:59 PM, Bruce W. wrote: So, this kind of notation would be different: args[0][2] verses args[[0][2]] the latter is multidimensional. Can you think of example of using this type of list? I don't know why this had me a bit confused. I've got to get into programming more... I had done mo

Re: Clarification of notation

2010-09-30 Thread Bruce W.
So, this kind of notation would be different: args[0][2] verses args[[0][2]] the latter is multidimensional. Can you think of example of using this type of list? I don't know why this had me a bit confused. I've got to get into programming more... I had done more in the past. Bruce Chriebe

Re: Clarification of notation

2010-09-29 Thread Terry Reedy
On 9/29/2010 10:32 PM, Bruce Whealton wrote: Would you, and could you combine a dictionary with a list in this fashion? A python list is a mutable sequence of Python objects. Extremely mixed example. >>> mixed = [1, 1.0, '1', [1], (1,), {1:1}, set((1,)), list, list.append] >>> mixed.append(m

Re: Clarification of notation

2010-09-29 Thread Chris Rebert
On Wed, Sep 29, 2010 at 7:32 PM, Bruce Whealton wrote: > Hello all, >         I recently started learning python.  I am a bit thrown by a certain > notation that I see.  I was watching a training course on lynda.com and this > notation was not presented.  For lists, when would you use what appears

Re: Clarification of notation

2010-09-29 Thread alex23
Bruce Whealton wrote: > For lists, when would > you use what appears to be nested lists, like: > [[], [], []] > a list of lists? Well, you'd use it when you'd want a list of lists ;) There's nothing magical about a list of lists, it's just a list with objects inside like any other, in this case

Re: Clarification of notation

2010-09-29 Thread Seebs
On 2010-09-30, Bruce Whealton wrote: > Next, from the documentation I see and this is just an example (this > kind of notation is seen elsewhere in the documentation: > str.count(sub[, start[, end]]) > This particular example is from the string methods. > Is this a nesting of two lists inside a

Clarification of notation

2010-09-29 Thread Bruce Whealton
Hello all, I recently started learning python. I am a bit thrown by a certain notation that I see. I was watching a training course on lynda.com and this notation was not presented. For lists, when would you use what appears to be nested lists, like: [[], [], []] a list of lists? W

Re: need clarification on -0

2009-11-30 Thread moijes12
On Nov 28, 12:55 pm, Erik Max Francis wrote: > moijes12 wrote: > > I know the value -0 is quite meaningless and makes little sense.But I > > was just fiddling.I am unable to figure out the below result > > -0 and True > > 0 --> (Why is this 0 and not say True or False) > -0 and f

Re: need clarification on -0

2009-11-30 Thread Erik Max Francis
moijes12 wrote: I know the value -0 is quite meaningless and makes little sense.But I was just fiddling.I am unable to figure out the below result -0 and True 0 --> (Why is this 0 and not say True or False) -0 and false 0 -0 or True True Could someone please provide me some resour

Re: need clarification on -0

2009-11-28 Thread Ned Deily
In article <009b4bab$0$26925$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > When it comes to integers, I'm not aware of any mathematical or > programming system which treats -0 and +0 as distinct entities, even if > they have different internal representations. A documented feature of mo

Re: need clarification on -0

2009-11-28 Thread Steven D'Aprano
On Sat, 28 Nov 2009 15:14:31 -0800, Mark Dickinson wrote: >> Actually, there ARE computers where you might not see this result. >> Virtually all of the processors on which Python runs use two's >> complement arithmetic.  In two's complement, there is no separate value >> called -0.  0 and -0 have

Re: need clarification on -0

2009-11-28 Thread Mark Dickinson
On Nov 28, 11:14 pm, Mark Dickinson wrote: > While that's true, I think the implementation of Python is > such that the Python objects -0 and 0 should always be > indistinguishable even on machines where the underlying > architecture represents integers using ones' complement or > sign-magnitude.

Re: need clarification on -0

2009-11-28 Thread Mark Dickinson
On Nov 28, 8:39 pm, Tim Roberts wrote: > moijes12 wrote: > > >I know the value -0 is quite meaningless and makes little sense.But I > >was just fiddling.I am unable to figure out the below result > > -0 and True > >0 --> (Why is this 0 and not say True or False) > -0 and false >

Re: need clarification on -0

2009-11-28 Thread Tim Roberts
moijes12 wrote: > >I know the value -0 is quite meaningless and makes little sense.But I >was just fiddling.I am unable to figure out the below result > -0 and True >0 --> (Why is this 0 and not say True or False) -0 and false >0 -0 or True >True > >Could someone please prov

Re: need clarification on -0

2009-11-28 Thread Steven D'Aprano
On Fri, 27 Nov 2009 23:09:06 -0800, moijes12 wrote: > Hi > > I know the value -0 is quite meaningless and makes little sense. Actually, when it comes to floating point values, it is very useful to be able to distinguish between -0 and +0. > But I > was just fiddling.I am unable to figure out

Re: noob: subprocess clarification

2008-09-15 Thread moogyd
On 14 Sep, 22:06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 14 Sep 2008 02:29:52 -0700 (PDT), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > Can somebody please clarify what the shell=True does, and whether I am > > using it correctly. > > What part of:

Re: noob: subprocess clarification

2008-09-14 Thread Chris Rebert
On Sun, Sep 14, 2008 at 2:29 AM, <[EMAIL PROTECTED]> wrote: > Hi, > > I generally use csh scripts for generally scripting (controlling > simulations). Basically the script processing options, generates the > command line, executes it and then processes the results. > > I would usually use the -f o

noob: subprocess clarification

2008-09-14 Thread moogyd
Hi, I generally use csh scripts for generally scripting (controlling simulations). Basically the script processing options, generates the command line, executes it and then processes the results. I would usually use the -f option on the shebang line to ensure that the environment from the current

Re: Module clarification

2008-07-28 Thread Themis Bourdenas
I would recommend dive into python. Its available free online (just google it) and it tries to teach you python, not programming which unfortunately many books try to do. It assumes that you already have some experience with C++ or Java and contradicts python syntax/semantics to those languages. Ve

Re: Module clarification

2008-07-28 Thread Marcus.CM
Hi Hussein, Basically a module is a FILE and is considered as a singleton model. Yes ur wow.py assumption is correct. I recommend getting Mark Lutz Learning Python book to get you started. Marcus.CM Hussein B wrote: Hi. I'm a Java guy and I'm playing around Python these days... In Java, we o

Re: Module clarification

2008-07-28 Thread Hussein B
On Jul 28, 8:11 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Hussein B <[EMAIL PROTECTED]> wrote: > > If I have a couple of modules, is there a way to package them? or > > there is no such a thing in Python? > > It sounds rather as though you haven't yet gone through the Python > tutorial. You rea

Re: Module clarification

2008-07-28 Thread Brett Ritter
On Jul 28, 4:54 am, Hussein B <[EMAIL PROTECTED]> wrote: > Hi. > I'm a Java guy and I'm playing around Python these days... > In Java, we organize our classes into packages and then jarring the > packages into JAR files. > What are modules in Python? > What is the equivalent of modules in Java? I'

Re: Module clarification

2008-07-28 Thread Duncan Booth
Hussein B <[EMAIL PROTECTED]> wrote: > If I have a couple of modules, is there a way to package them? or > there is no such a thing in Python? > > It sounds rather as though you haven't yet gone through the Python tutorial. You really should read it, even if you just skim through it to see wh

Re: Module clarification

2008-07-28 Thread Diez B. Roggisch
Hussein B wrote: > Hi. > I'm a Java guy and I'm playing around Python these days... > In Java, we organize our classes into packages and then jarring the > packages into JAR files. > What are modules in Python? > What is the equivalent of modules in Java? Read the docs: http://docs.python.org/tu

Re: Module clarification

2008-07-28 Thread Hussein B
On Jul 28, 6:55 am, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: > On Jul 28, 9:54 am, Hussein B <[EMAIL PROTECTED]> wrote: > > > Hi. > > I'm a Java guy and I'm playing around Python these days... > > In Java, we organize our classes into packages and then jarring the > > packages into JAR files. >

Re: Module clarification

2008-07-28 Thread Floris Bruynooghe
On Jul 28, 9:54 am, Hussein B <[EMAIL PROTECTED]> wrote: > Hi. > I'm a Java guy and I'm playing around Python these days... > In Java, we organize our classes into packages and then jarring the > packages into JAR files. > What are modules in Python? An importable or runable (i.e. script) collecti

Module clarification

2008-07-28 Thread Hussein B
Hi. I'm a Java guy and I'm playing around Python these days... In Java, we organize our classes into packages and then jarring the packages into JAR files. What are modules in Python? What is the equivalent of modules in Java? Please correct me if I'm wrong: I saved my Python code under the file

Re: clarification

2007-08-20 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > turn indicates that both implementations actually work about same and > > your "O(n squared)" argument is irrelevant. > > It's indeed irrelevant when the behavior _isn't_ quadratic (as in the > case of intersections) -- but unfortunately it _is_ needle

Re: clarification

2007-08-19 Thread Alex Martelli
samwyse <[EMAIL PROTECTED]> wrote: ... > > brain:~ alex$ python -mtimeit -s'sos=[set(range(x,x+4)) for x in > > range(0, 100, 3)]' 'r=set()' 'for x in sos: r.update(x)' > > 10 loops, best of 3: 18.8 usec per loop > > > > brain:~ alex$ python -mtimeit -s'sos=[set(range(x,x+4)) for x in > > r

Re: clarification

2007-08-19 Thread samwyse
Alex Martelli wrote: > Of course, hoisting the unbound method out of the loops can afford the > usual small optimization. But my point is that, in Python, these > operations (like, say, the concatenation of a sequence of lists, etc) > are best performed "in place" via loops calling mutator method

Re: clarification

2007-08-18 Thread Alex Martelli
samwyse <[EMAIL PROTECTED]> wrote: ... > Finally, does anyone familar with P3K know how best to do the reduction > without using 'reduce'? Right now, sets don't support the 'add' and > 'multiply' operators, so 'sum' and (the currently ficticious) 'product' > won't work at all; while 'any' and

Re: clarification

2007-08-18 Thread Tim Williams
On 17/08/07, Beema shafreen <[EMAIL PROTECTED]> wrote: > hi everybody, > i have a file with data separated by tab > mydata: > fhl1fkh2 > dfp1chk1 > mal3alp14 > mal3moe1 > mal3spi1 > mal3bub1 > mal3bub3 > mal3mph1 > mal3mad3 > hob1nak1 > hob1wsp1 > hob1

Re: clarification

2007-08-18 Thread samwyse
samwyse wrote: > Scott David Daniels wrote: > >> lefts = set() >> rights = set() >> with open('sheet1', 'r') as fh: >> for line in fh: >> trimmed = line.strip() >> if trimmed: # Skip blanks (file end often looks like that) >> left, right = line.strip()

Re: clarification

2007-08-17 Thread samwyse
Scott David Daniels wrote: > lefts = set() > rights = set() > with open('sheet1', 'r') as fh: > for line in fh: > trimmed = line.strip() > if trimmed: # Skip blanks (file end often looks like that) > left, right = line.strip().split('\t') >

Re: clarification

2007-08-17 Thread Scott David Daniels
Laurent Pointal wrote: > Thomas Jollans a écrit : >> On Friday 17 August 2007, Beema shafreen wrote: >>> hi everybody, >>> i have a file with data separated by tab >>> mydata: >>> fhl1fkh2 > >>> shows these two are separated by tab represented as columns >>> i have to check the common data bet

Re: clarification

2007-08-17 Thread Laurent Pointal
Laurent Pointal a écrit : [cleaning] fh = open('sheet1') for line in fh: -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification

2007-08-17 Thread Laurent Pointal
Thomas Jollans a écrit : > On Friday 17 August 2007, Beema shafreen wrote: >> hi everybody, >> i have a file with data separated by tab >> mydata: >> fhl1fkh2 >> shows these two are separated by tab represented as columns >> i have to check the common data between these two coloumn1 an coloumn

Re: clarification

2007-08-17 Thread Thomas Jollans
On Friday 17 August 2007, Beema shafreen wrote: > hi everybody, > i have a file with data separated by tab > mydata: > fhl1fkh2 > dfp1chk1 > mal3alp14 > mal3moe1 > mal3spi1 > mal3bub1 > mal3bub3 > mal3mph1 > mal3mad3 > hob1nak1 > hob1wsp1 > hob1rad3 >

clarification

2007-08-16 Thread Beema shafreen
hi everybody, i have a file with data separated by tab mydata: fhl1fkh2 dfp1chk1 mal3alp14 mal3moe1 mal3spi1 mal3bub1 mal3bub3 mal3mph1 mal3mad3 hob1nak1 hob1wsp1 hob1rad3 cdr2cdc13 cdr2cdc2 shows these two are separated by tab represented as

Re: clarification

2007-08-16 Thread Michael Bentley
On Aug 16, 2007, at 2:42 AM, Beema shafreen wrote: hi every body, i have compared two files: code: fh = open('HPRD_MAIN_20.txt','r') for line in fh.readlines(): data = line.strip().split('#') fh1 = open('NOMENCLATURE_MAIN_20.txt','r') for line1 in fh1.readlines():

clarification

2007-08-16 Thread Beema shafreen
hi every body, i have compared two files: code: fh = open('HPRD_MAIN_20.txt','r') for line in fh.readlines(): data = line.strip().split('#') fh1 = open('NOMENCLATURE_MAIN_20.txt','r') for line1 in fh1.readlines(): data1 = line1.strip().split('#')

Re: WSGI spec clarification regarding exceptions

2007-05-09 Thread Graham Dumpleton
On May 10, 12:07 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On May 10, 8:26 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > > > I'm trying to figure out if there's any defined behaviour in PEP 333 > > for instances where an application returns an iterable as usual > > without error, but that ite

Re: WSGI spec clarification regarding exceptions

2007-05-09 Thread Graham Dumpleton
On May 10, 8:26 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > I'm trying to figure out if there's any defined behaviour in PEP 333 > for instances where an application returns an iterable as usual > without error, but that iterable's next() method eventually raises an > exception. Since any data ther

WSGI spec clarification regarding exceptions

2007-05-09 Thread Adam Atlas
I'm trying to figure out if there's any defined behaviour in PEP 333 for instances where an application returns an iterable as usual without error, but that iterable's next() method eventually raises an exception. Since any data theretofore returned by the iterable must be assumed to have already b

Re: pop() clarification

2007-04-12 Thread Christophe
Carl Banks a écrit : > On Apr 11, 3:10 pm, "7stud" <[EMAIL PROTECTED]> wrote: >> On Apr 11, 10:44 am, "Scott" <[EMAIL PROTECTED]> wrote: >> >> >> >>> As said before I'm new to programming, and I need in depth explaination to >>> understand everything the way I want to know it, call it a personality

Re: pop() clarification

2007-04-12 Thread Bruno Desthuilliers
Hamilton, William a écrit : >> -Original Message- >> From: [EMAIL PROTECTED] > [mailto:python- >> [EMAIL PROTECTED] On Behalf Of Scott >> >> I understand all that. What I don't understand is why all the >> documentation >> I see says, "When removing a specific element from a list using pop

Re: pop() clarification

2007-04-11 Thread [EMAIL PROTECTED]
Carl Banks wrote: > On Apr 11, 3:10 pm, "7stud" <[EMAIL PROTECTED]> wrote: > > On Apr 11, 10:44 am, "Scott" <[EMAIL PROTECTED]> wrote: > > > > > > > > > As said before I'm new to programming, and I need in depth explaination to > > > understand everything the way I want to know it, call it a person

Re: pop() clarification

2007-04-11 Thread Carl Banks
On Apr 11, 3:10 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 11, 10:44 am, "Scott" <[EMAIL PROTECTED]> wrote: > > > > > As said before I'm new to programming, and I need in depth explaination to > > understand everything the way I want to know it, call it a personality quirk > > ;p. > > > With p

Re: pop() clarification

2007-04-11 Thread 7stud
On Apr 11, 10:44 am, "Scott" <[EMAIL PROTECTED]> wrote: > As said before I'm new to programming, and I need in depth explaination to > understand everything the way I want to know it, call it a personality quirk > ;p. > > With pop() you remove the last element of a list and return its value: > > No

RE: pop() clarification

2007-04-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Scott > > I understand all that. What I don't understand is why all the > documentation > I see says, "When removing a specific element from a list using pop() it > must be in this format: list

Re: pop() clarification

2007-04-11 Thread Bruno Desthuilliers
Scott a écrit : > As said before I'm new to programming, and I need in depth explaination to > understand everything the way I want to know it, call it a personality quirk > ;p. > > With pop() you remove the last element of a list and return its value: > > Now I know list is a bad name, but for

Re: pop() clarification

2007-04-11 Thread Facundo Batista
Scott wrote: > Now I know list is a bad name, but for the sake of arguement lets assume its > not a built in sequence> It's easier to use another name, than writing all that parragraph, ;) > I understand all that. What I don't understand is why all the documentation > I see says, "When remov

Re: pop() clarification

2007-04-11 Thread Jerry Hill
On 4/11/07, Scott <[EMAIL PROTECTED]> wrote: > I see says, "When removing a specific element from a list using pop() it > must be in this format: list.pop([i]). The tutorial (http://docs.python.org/tut/node7.html) says the following: pop( [i] ) Remove the item at the given position in the lis

pop() clarification

2007-04-11 Thread Scott
As said before I'm new to programming, and I need in depth explaination to understand everything the way I want to know it, call it a personality quirk ;p. With pop() you remove the last element of a list and return its value: Now I know list is a bad name, but for the sake of arguement lets as

Re: clarification on open file modes

2007-01-06 Thread Stefan Schwarzer
On 2007-01-05 03:46, tubby wrote: > Is this the safest, most portable way to open files on any platform: > > fp = open(file_name, 'rb') > fp.close() > > I understand that doing the following on Windows to a binary file (a > jpeg or exe files for example) can cause file corruption, is that correct?

Re: clarification on open file modes

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 23:46, tubby wrote: I understand that doing the following on Windows to a binary file (a jpeg or exe files for example) can cause file corruption, is that correct? fp = open(file_name, 'r') fp.close() How can a simple open in read mode corrupt data??? You can't corrupt *

clarification on open file modes

2007-01-04 Thread tubby
Does a py script written to open and read binary files on Windows affect files on a Linux or Mac machine in a negative way? My concern is portability and safety. I want scripts written within Windows to work equally well on Linux and Mac computers. Is this the safest, most portable way to open

Re: need clarification with import statements

2006-12-15 Thread Tool69
Hi John, > 1. Your directory/package hierarchy is far too complicated. Flatten it. Ok. > 2. You have circular references: the others module will import from > utils, but utils wants to import from others. This is prima facie > evidence that your modules are not structured properly Yes, that's wh

Re: need clarification with import statements

2006-12-14 Thread John Machin
Tool69 wrote: > Hi, > I've got the following hierarchy: > > mainprog/ > __init__.py > prog.py > utils/ > __init__.py > myutils.py > others/ > __init__.py > myothers.py > > Inside prog.py I need to have full access to myutils.py and > myothers.py; > I

need clarification with import statements

2006-12-14 Thread Tool69
Hi, I've got the following hierarchy: mainprog/ __init__.py prog.py utils/ __init__.py myutils.py others/ __init__.py myothers.py Inside prog.py I need to have full access to myutils.py and myothers.py; Inside myutils.py, I need to access two classe

  1   2   >