Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25585

Re: Foxpro goto command and deleted records

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'exception': 0.03; 'column': 0.07; 'closest': 0.09; 'option:': 0.09; 'record.': 0.09; 'subject:command': 0.09; 'typed': 0.09; 'stored': 0.10; ';-)': 0.11; 'anyway': 0.11; 'index': 0.13; 'boolean': 0.16; 'deleted,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'index;': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'pythonic': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'tables,': 0.16; 'wrote:': 0.17; 'pointer': 0.17; 'memory': 0.18; 'module': 0.19; 'skip:p 30': 0.20; 'names.': 0.22; 'raise': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'possibly': 0.27; "doesn't": 0.28; 'skip:( 20': 0.28; 'decide': 0.28; 'record': 0.28; '(possibly': 0.29; 'attempting': 0.29; 'received:192.168.1.3': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'code': 0.31; 'towards': 0.32; 'good.': 0.32; 'received:84': 0.32; 'print': 0.32; 'certain': 0.33; 'to:addr :python-list': 0.33; 'entry': 0.33; 'false': 0.35; 'options:': 0.35; 'pm,': 0.35; 'too.': 0.35; 'next': 0.35; 'but': 0.36; 'visual': 0.36; 'should': 0.36; 'possible': 0.37; 'does': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'possible.': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'list,': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'remove': 0.61; "you'll": 0.62; 'jul': 0.65; 'treat': 0.65; 'header:Reply-To:1': 0.68; 'records': 0.68; 'believe': 0.69; 'reply-to:no real name:2**0': 0.72; 'furman': 0.84; 'good!': 0.84; 'reply-to:addr:python.org': 0.84; 'seventh': 0.84; 'approach.': 0.91; 'ethan': 0.91; 'subject:records': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=FLuZNpUs c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=YsUzL_8ObRgA:10 a=NAy-WIAmZUIA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=ljRBaB7nXxQp6jh3MvYA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Wed, 18 Jul 2012 18:57:49 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: Foxpro goto command and deleted records
References <5005EDC0.6050608@stoneleaf.us> <8416AFAF-E201-4F89-B306-D89F920A00FE@leafe.com> <5006F0F7.8030004@stoneleaf.us> <485D3051-777B-49DA-8FD9-383F5807F827@leafe.com>
In-Reply-To <485D3051-777B-49DA-8FD9-383F5807F827@leafe.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2276.1342634273.4697.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342634273 news.xs4all.nl 6984 [2001:888:2000:d::a6]:42315
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25585

Show key headers only | View raw


On 18/07/2012 18:28, Ed Leafe wrote:
> On Jul 18, 2012, at 12:16 PM, Ethan Furman wrote:
>
>> Your memory is good!  I typed it in wrong.
>
> 	Well, I was an MVP for Visual Foxpro for 10 years, so...
>
> 	;-)
>
>> I see four other options:
>>
>> 0) don't move the pointer (listed for completeness)
>> 1) go to that record anyway
>> 2) go to the next undeleted record
>> 3) go to the seventh undeleted record (possibly the least practical)
>> 4) raise an exception
>>
>> I still don't like it.  Any opinion on the other four choices?  I'm leaning towards 1, possibly with 4 as an option:
>
> 	#4 is probably the most Pythonic approach. The calling code can then decide how to react to attempting to access a deleted record. Even if you're accessing data stored in VFP tables, your module should be as Pythonic as possible.
>
I disagree. I think that if you can see it should be able to go to it.

I think that the closest analogue is a list, although maybe you should
be able to hide any records which are marked for deletion.

# Print all of the names.
records.include_deleted = True
print("There are {} names".format(len(records)))
for r in records:
     if r.deleted:
         print("\t{} (deleted)".format(r["name"]))
     else:
         print("\t{}".format(r["name"]))

# Print all but the deleted names.
records.include_deleted = False
print("There are {} names".format(len(records)))
for r in records:
     print(r["name"])

>> Part of the reason I feel this is reasonable is that with my dbf module it is possible to create an index that does /not/ include certain records:
>
> 	Deleting a record in VFP doesn't remove it from the index; I believe it marks that index entry as deleted, too. I think that as long as you treat the deleted status as the same as any other boolean column you'll be good.
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Foxpro goto command and deleted records MRAB <python@mrabarnett.plus.com> - 2012-07-18 18:57 +0100

csiph-web