Re: Python declarative

2014-01-24 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmpi-kvJAVs2gK+nH5n6q3REkJaKR=czerfzugdk8_v...@mail.gmail.com... > On Fri, Jan 24, 2014 at 11:49 PM, Frank Millman > wrote: >> > [...] I have realised that we unlikely to come to an agreement on this in the near future

Re: Python declarative

2014-01-25 Thread Frank Millman
"Steven D'Aprano" wrote in message news:52e473fc$0$2$c3e8da3$54964...@news.astraweb.com... > On Sat, 25 Jan 2014 09:18:44 +0200, Frank Millman wrote: > >> I have realised that we unlikely to come to an agreement on this in the >> near future, as our phil

Re: Python declarative

2014-01-26 Thread Frank Millman
as hand-crafting my form definitions initially, and as I added features it became unwieldy. Forcing myself to create the schema highlighted a lot of anomalies and I ended up with a much cleaner structure as a result. Secondly, it has picked up a lot of errors in the resulting documents

RE: Python (windows)packet sniffer ARP

2014-01-31 Thread Frank Cui
dering if it possible to create a packet sniffer in windows using > > python that only sniffs for ARP packets. > > A couple of links to get you started: > > http://www.winpcap.org/ > http://code.google.com/p/winpcapy/ > -- > https://mail.python.org/mailman/listinfo

Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
', 3: 'pqr'} >>> sorted(d.items(), key=d.get) [(1, 'abc'), (2, 'xyz'), (3, 'pqr')] It did not crash, but it did not sort. Then I changed the keys to strings, to match Igor's example - >>> d = {'1': 'abc', '2': 'xyz', '3': 'pqr'} >>> sorted(d.items(), key=d.get) [('1', 'abc'), ('3', 'pqr'), ('2', 'xyz')] It works - now I am even more confused. Any hints will be appreciated. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
"Frank Millman" wrote in message news:ld4ocf$9rg$1...@ger.gmane.org... > > "Chris Angelico" wrote in message > news:captjjmqdusdfc1elbu6lf5-up__lae-63ii0uuvaggnem9u...@mail.gmail.com... >> On Sat, Feb 8, 2014 at 6:06 PM, Igor Korot wrote: >>&

Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
"Peter Otten" <__pete...@web.de> wrote in message news:ld4pon$ni9$1...@ger.gmane.org... > Frank Millman wrote: > > Here you can watch the key calculation at work: > >>>> d = {'1': 'abc', '2': 'xyz', '3': &#

Re: Dictionaries

2014-02-08 Thread Frank Millman
ch iteration sets 'x' to the next key in dictionary 'a'. 'x' is a reference to a normal python object. It does not 'know' that it came from dictionary 'a', so you can do whatever you like with it. If you use it to retrieve a value in diction

Problem with sqlite3 and Decimal

2015-12-11 Thread Frank Millman
everts back to two decimal places. If I initialise the value as D('6049.05'), the next value is 6172.5, so it is not the number itself that causes the problem. I tried displaying the type - even when it switches to 6172.4999, it is still a Decimal type. I noticed one oddity - I am

Re: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Frank Millman
"Igor Korot" wrote in message news:CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=e...@mail.gmail.com... Hi, > To: python-list@python.org > From: "Frank Millman" > Subject: Problem with sqlite3 and Decimal > Date: Fri, 11 Dec 2015 11:21:53 +0200 > Lines

Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmor6newucco7xtsswyyfbgwcwz8jt-mjjkysjocfu7...@mail.gmail.com... On Fri, Dec 11, 2015 at 8:21 PM, Frank Millman wrote: > I noticed one oddity - I am asking sqlite3 to store the value as a > string, > but then I am asking it to

Re: Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Frank Millman
people on the sqlite3 ML, is that sqlite3 does not have a true decimal type and therefore uses floating point internally. As we all know from many questions asked on this forum, floating point and exact decimal representation are incompatible. Frank -- https://mail.python.org/mailman/listi

Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmoPXFSnXe1QA8MjjncBZBpqNkztha8YHJv=mbm--ze...@mail.gmail.com... On Sat, Dec 12, 2015 at 4:10 PM, Frank Millman wrote: > I can reproduce your example above. However, if I set the initial value > to > 5678.7, then the seque

Re: Problem with sqlite3 and Decimal

2015-12-11 Thread Frank Millman
"Frank Millman" wrote in message news:n4ei3l$b98$1...@ger.gmane.org... I need to store Decimal objects in a sqlite3 database, using Python 3.4 on Windows 7. I followed the instructions here - http://stackoverflow.com/questions/6319409/how-to-convert-python-decimal-to-sqlite-n

Re: Problem with sqlite3 and Decimal

2015-12-12 Thread Frank Millman
"Frank Millman" wrote in message news:n4gigr$f51$1...@ger.gmane.org... I have found a workaround for my problem, but first I needed to understand what was going on more clearly. This is what I have figured out. [...] The reason for the '#' in the above function is tha

Re: Problem with sqlite3 and Decimal

2015-12-12 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmrfw-qNx-a=3q2qj244fgvxz3mpe4wa-wdusmchxuf...@mail.gmail.com... On Sun, Dec 13, 2015 at 4:00 PM, Frank Millman wrote: > My new solution is to pass a 'scale' factor into my aggregate function. > The > function uses t

Re: Which Python editor has this feature?

2016-01-11 Thread Frank Haun
may have (as usual with emacs!) to choose which you > like best, ie not all are not bound to keys. Emacs is great for python editing. I use elpy-mode on top of emacs python-mode. And company-mode for completion. Frank -- https://mail.python.org/mailman/listinfo/python-list

Stop writing Python 3.5 incompatible code :-)

2016-01-13 Thread Frank Millman
ged! Now, if 0 rows are returned, the message is 'not enough values to unpack'. Luckily the other message has not changed, so now my test is - except ValueError as e: if str(e).startswith('too many'): # > 1 rows returned else: # 0 rows returned Now it

Re: Stop writing Python 3.5 incompatible code :-)

2016-01-13 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmps+vfu33tulae5oivrvn_otfuxrp8yluy68qmu36-...@mail.gmail.com... On Thu, Jan 14, 2016 at 5:27 PM, Frank Millman wrote: > Using LBYL, one would retrieve the row(s) and check the length. I found > a > way to use EAFP, as follow

Re: Stop writing Python 3.5 incompatible code :-)

2016-01-14 Thread Frank Millman
"Frank Millman" wrote in message news:n77j78$ld0$1...@ger.gmane.org... cur.execute(...) try: row = next(cur) except StopIteration: # 0 rows returned try: next(cur) except StopIteration: pass else: # >1 rows returned For the record, I just tried this and found an

Re: Single format descriptor for list

2016-01-20 Thread Frank Millman
"format" still doesn't quite do the job: >>> a = range(4, 8) >>> print ('th\n'.join(map(str,a))) 4th 5th 6th 7 Is there an elegant way to print-format an arbitrary length list? How about this - a = range(4, 8) print('\n'.join(['{}t

Installing on linux - missing devel packages

2016-01-20 Thread Frank Millman
there an easy way to find out all the missing components, so that when the installation is complete I can be sure I have the entire standard lib? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Installing on linux - missing devel packages

2016-01-21 Thread Frank Millman
On 2016-01-21, Chris Angelico wrote: On Thu, Jan 21, 2016 at 6:18 PM, Frank Millman wrote: Fedora 22 comes standard with Python 3.4.2. I want to install 3.5.1. It is easy enough to download the source and run ./configure;make;make altinstall. But then I find that I cannot import gzip because

Question about asyncio and blocking operations

2016-01-23 Thread Frank Millman
if what I am going through sounds normal, or if I am doing something fundamentally wrong. Thanks for any input Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about asyncio and blocking operations

2016-01-23 Thread Frank Millman
"Frank Millman" wrote in message news:n8038j$575$1...@ger.gmane.org... So I thought I would ask here if anyone has been through a similar exercise, and if what I am going through sounds normal, or if I am doing something fundamentally wrong. Thanks for any input Just a qui

Re: Question about asyncio and blocking operations

2016-01-25 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... On Sat, Jan 23, 2016 at 7:38 AM, Frank Millman wrote: > Here is the difficulty. The recommended way to handle a blocking > operation > is to run it as task in a diff

Re: Question about asyncio and blocking operations

2016-01-25 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidngogpx+cpmvba8vpefuq4-bwmvs0gz3shb0owzi0b...@mail.gmail.com... On Sat, Jan 23, 2016 at 7:38 AM, Frank Millman wrote: > Here is the difficulty. The recommended way to handle a blocking > operation > is to run it as task in a diff

Re: Question about asyncio and blocking operations

2016-01-26 Thread Frank Millman
"Frank Millman" wrote in message news:n8038j$575$1...@ger.gmane.org... I am developing a typical accounting/business application which involves a front-end allowing clients to access the system, a back-end connecting to a database, and a middle layer that glues it al

Re: Question about asyncio and blocking operations

2016-01-27 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidk-RBkB-vi6CgcEeoFHQrsoTFvqX9MqzDD=rny5boc...@mail.gmail.com... On Tue, Jan 26, 2016 at 7:15 AM, Frank Millman wrote: > > If I return the cursor, I can iterate over it, but isn't this a blocking > operation? As far as I know,

Re: Question about asyncio and blocking operations

2016-01-27 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidn6tvn9w-2qnn2jyvju8nhzn499nptfjn9ohjddceb...@mail.gmail.com... On Wed, Jan 27, 2016 at 7:40 AM, Frank Millman wrote: > > Assume a slow function - > > async def slow_function(arg1, arg2): >[do stuff] > > It now

Re: Question about asyncio and blocking operations

2016-01-27 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidk-RBkB-vi6CgcEeoFHQrsoTFvqX9MqzDD=rny5boc...@mail.gmail.com... On Tue, Jan 26, 2016 at 7:15 AM, Frank Millman wrote: > > If I return the cursor, I can iterate over it, but isn't this a blocking > operation? As far as I know,

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
io.Queue to send results back to the caller, which can call 'await q.get()'. I ran a quick test and it seems to work. What do you think? Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmr162+k4lzefpxrur6wxrhxbr-_wkrclldyr7kst+k...@mail.gmail.com... On Thu, Jan 28, 2016 at 8:13 PM, Frank Millman wrote: > Run the database handler in a separate thread. Use a queue.Queue to send > requests to the handler. Use an async

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidnGbz7kM=d7mkua2ta9-csfn9u0ohl0w-x5bbixpcw...@mail.gmail.com... On Jan 28, 2016 4:13 AM, "Frank Millman" wrote: > > I *think* I have this one covered. When the caller makes a request, it creates an instance of an asyncio.Queue

Re: Question about asyncio and blocking operations

2016-01-28 Thread Frank Millman
owever, having found something that seems to work and that I feel comfortable with, I plan to run with this for the time being. Thanks to all for the very stimulating discussion. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about asyncio and blocking operations

2016-01-29 Thread Frank Millman
"Frank Millman" wrote in message news:n8et0d$hem$1...@ger.gmane.org... I have read the other messages, and I can see that there are some clever ideas there. However, having found something that seems to work and that I feel comfortable with, I plan to run with this for the time

Cannot step through asynchronous iterator manually

2016-01-30 Thread Frank Millman
cannot find it. I can achieve the desired result by calling 'await aiter.__anext__()', but this is clunky. Am I missing something? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzid=ssdsm8hdan+orj54a_jeu9wc8103iqgkaah8mrj-...@mail.gmail.com... On Jan 29, 2016 11:04 PM, "Frank Millman" wrote: > > Hi all > > To loop though an iterator one usually uses a higher-level construct > such as a '

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Frank Millman
nc for _ in ait: raise TooManyRows() return row Also nice - thanks. I now have a few to choose from without needing an 'anext()'. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmoAmVNTCKq7QYaDRNQ67Gcg9TxSXYXCrY==s9djjna...@mail.gmail.com... On Sat, Jan 30, 2016 at 7:22 PM, Frank Millman wrote: > We had a recent discussion about the best way to do this, and ChrisA > suggested the followin

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Frank Millman
m at my leisure and pick the most readable one. Thanks Frank -- https://mail.python.org/mailman/listinfo/python-list

Question about official API

2016-02-05 Thread Frank Millman
to in the documentation for 'task_done()'. I tried it out, and it does exactly what I want. However, it is not mentioned in the documentation. How do I know if it is safe to rely on this? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about official API

2016-02-05 Thread Frank Millman
at will settle the question one way or the other. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about official API

2016-02-05 Thread Frank Millman
"Frank Millman" wrote in message news:n91ndn$sc1$1...@ger.gmane.org... Thanks for the link, Lutz. Unfortunately I may have asked the wrong question. In my specific case, how do I know if it is safe to use the attribute 'unfinished_tasks' in the class queue.Queue? It

asyncio - how to stop background task cleanly

2016-02-06 Thread Frank Millman
sleep' using wait() with a timeout value, but reacts instantly when set() is called, so it was ideal. Is there a way to achieve this using asyncio? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - how to stop background task cleanly

2016-02-06 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87lh6ys052@elektro.pacujo.net... "Frank Millman" : > When shutting the main program down, I want to stop the task, but I > cannot figure out how to stop it cleanly - i.e. wait until it has > finished the current tas

Re: asyncio - how to stop background task cleanly

2016-02-06 Thread Frank Millman
syncio.CancelledError: await perform_cleanup() At startup - task = asyncio.ensure_future(background_task()) At shutdown - task.cancel() await asyncio.wait([task]) Works perfectly - thanks again. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - how to stop background task cleanly

2016-02-06 Thread Frank Millman
"Frank Millman" wrote in message news:n96kjr$mvl$1...@ger.gmane.org... "Marko Rauhamaa" wrote in message news:8737t5shhp@elektro.pacujo.net... > Actually, cancellation is specially supported in asyncio ( https://docs.python.org/3/library/asyncio-task.html#asy

Re: asyncio - how to stop background task cleanly

2016-02-07 Thread Frank Millman
y, but if you press it in between 'start' and 'done', it waits for the task to complete before it closes. Frank = import asyncio, time import threading def main(): loop = asyncio.get_event_loop() task = asyn

Re: asyncio - how to stop background task cleanly

2016-02-07 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:871t8orhua@elektro.pacujo.net... "Frank Millman" : > I have never been able to get Ctrl+C to work properly on Windows, so I > use a separate thread that simply waits for Enter. Now you are leaving my realm of expertise, a

asyncio and blocking - an update

2016-02-08 Thread Frank Millman
ing function to process each row, the overhead of call_soon_threadsafe() would be minimised and my approach might be effective. For now, however, I will regretfully abandon my approach and stick with run_in_executor(). Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling transactions in Python DBI module

2016-02-10 Thread Frank Millman
esets the state to 'not'. I learned the hard way that it is important to use conn.commit() and not cur.execute('commit'). Both succeed in committing, but the second does not reset the state, therefore the next statement does not trigger a 'BEGIN', with possible unfortunate side-effects. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling transactions in Python DBI module

2016-02-10 Thread Frank Millman
hich one). Because psycopg2 silently executes 'BEGIN TRANSACTION', your SELECTs always happen inside a transaction whether you specify it or not. If you do not issue a conn.commit(), the locks do not get cleared. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio and blocking - an update

2016-02-10 Thread Frank Millman
"Frank Millman" wrote in message news:n9c4p3$gmp$1...@ger.gmane.org... Some of you may have been following my attempts to modify my asyncio app so that it does not block when accessing the database. Here is an update. Here is an update to my update ... I came up with what f

Re: asyncio and blocking - an update

2016-02-10 Thread Frank Millman
rn_queue.get() return self.rows.pop(0) Hope this makes sense. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio and blocking - an update

2016-02-11 Thread Frank Millman
be other non-database tasks running concurrently, and they should also be more responsive. It would be quite difficult to simulate all of this, so I confess that I am relying on gut instinct at the moment. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: Does anyone here use wxGlade on Linux?

2016-02-11 Thread Frank Miles
On Thu, 11 Feb 2016 14:29:04 +, cl wrote: > I am trying out wxGlade on Linux, version 0.7.1 of wxGlade on xubuntu > 15.10. > > I have already written something using wxPython directly so I have the > basics (of my Python skills and the environment) OK I think. > > I am having a lot of troubl

Re: asyncio and blocking - an update

2016-02-12 Thread Frank Millman
"Frank Millman" wrote in message news:n9hjfp$ad7$1...@ger.gmane.org... However, my concern is not to maximise database performance, but to ensure that in an asynchronous environment, one task does not block the others from responding. My tests simulate a number of tasks running co

asyncio - run coroutine in the background

2016-02-14 Thread Frank Millman
= BackgroundTask() args = (arg1, arg2 ...) callback = my_callback_function await bg_task.run(coro, args, callback) Although it 'awaits' bk_task.run(), it returns immediately, as it is simply waiting for run_in_executor() to be launched. Hope this is of some interest. Fra

Re: asyncio - run coroutine in the background

2016-02-14 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:8737sumpjl@elektro.pacujo.net... "Frank Millman" : > Using asyncio, there are times when I want to execute a coroutine which > is time-consuming. I do not need the result immediately, and I do not > want to block the curr

Re: asyncio - run coroutine in the background

2016-02-15 Thread Frank Millman
"Paul Rubin" wrote in message news:87h9ha8lt0@jester.gateway.pace.com... "Frank Millman" writes: > The benefit of my class is that it enables me to take the coroutine > and run it in another thread, without having to re-engineer the whole > thing. Th

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
ks perfectly, and is much neater than my effort. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
vity in the background. However, I have not simulated a large number of concurrent users. That could throw up the kinds of problem that you are concerned about. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
g queues) seems to be working well so far, I am sticking with that until I start to experience responsiveness issues. If that happens, my first line of attack will be to switch from threads to processes. Hope this makes sense. Frank -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmqmie4groqnyvhwahcn2mwqeyqxt5kvfivotrhqy-s...@mail.gmail.com... On Wed, Feb 17, 2016 at 2:21 AM, Frank Millman wrote: > I would love to drive the database asynchronously, but of the three > databases I use, only psycopg2 seems

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Frank Millman
hen include the remote table in any sql command. However, it will not enforce foreign key constraints across databases. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:8d747a5biq4rc559tvgju088508bp0o...@4ax.com... > On Sun, 23 Nov 2014 10:21:48 +0200, "Frank Millman" > declaimed the following: > >> >> >>The default is for sqlite3 to ignore foreign key contraints. >>

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:lrr67al6ppa852agu9rq2dstqtue17i...@4ax.com... > On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" > declaimed the following: > >> >>Originally I supported two databases - PostgreSQL and Sql Server. They

Db transactions and locking

2014-11-27 Thread Frank Millman
7;t know if Sql Server and sqlite3 behave the same, but I don't think it can do any harm, so I let it apply across the board. Can anyone see any problem with this? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Db transactions and locking

2014-11-27 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:4loe7at2ls7tfq0oe041ru9svvsm8ak...@4ax.com... > On Thu, 27 Nov 2014 12:24:39 +0200, "Frank Millman" > declaimed the following: > > >>All Python database adaptors that I have used start a transaction when you >&

Re: Db transactions and locking

2014-11-27 Thread Frank Millman
"Frank Millman" wrote in message news:m5924d$nbq$1...@ger.gmane.org... > > > This seems to confirm what I thought, but then I continued, and was > surprised at the result. > > I can repeat these lines at will - > > cur.execute('SELECT * FROM mytable&#x

Re: How to terminate the function that runs every n seconds

2015-01-14 Thread Frank Millman
eout occurs." The benefit is that setting the flag terminates the loop straight away, as opposed to waiting for the sleep to finish. I can show some sample code if anyone is interested. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: How to change the number into the same expression's string and vice versa?

2015-01-19 Thread Frank Millman
1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a1 = 0xf4 >>> a1 244 >>> b1 = '0x{:x}'.format(a1) >>> b1 &

CSV and number formats

2015-01-31 Thread Frank Millman
ndard way of parsing it? If not, I will have to special-case it, but I would prefer to avoid that if possible. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Bad text appearance in IDLE

2015-02-12 Thread Frank Millman
ething seems to have gone wrong with the system font. I don't use IDLE, but I use OutlookExpress and Textpad, and they both show a similar effect. I can live with it for now. I am hoping (with fingers crossed) that enough people will complain to Microsoft that they will issue a fix shortly. F

sqlite3 and dates

2015-02-17 Thread Frank Millman
eturn a date object - >>> cur.execute('SELECT CAST(? AS DATE)', ('2015-03-31',)) >>> cur.fetchone() (2015,) >>> I don't know how easy this would be to implement, but it would be nice if it could be made to work. Is it worth filing a feature request? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 and dates

2015-02-17 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmrB+55CVgN6zTUawRf=rzn9ltavi5tzhjsyvhhywk1...@mail.gmail.com... > On Wed, Feb 18, 2015 at 5:19 PM, Frank Millman wrote: >> However, the following does not return a date object - >> >>>>> cur.execut

Re: sqlite3 and dates

2015-02-18 Thread Frank Millman
"Mark Lawrence" wrote in message news:mc1g3n$q8j$1...@ger.gmane.org... > On 18/02/2015 06:19, Frank Millman wrote: >> Hi all >> >> sqlite3 does not have a DATE type, but the python module does a pretty >> good >> job of providing one - >> >&g

Re: Design thought for callbacks

2015-02-20 Thread Frank Millman
are no longer alive, they are automatically removed from the WeakSet, preventing me from accidentally calling them when they are dead." I found that the reference was not removed immediately, but was waiting to be garbage collected. During that window, I could call the callback, which resul

Re: Design thought for callbacks

2015-02-21 Thread Frank Millman
"Steven D'Aprano" wrote in message news:54e8af1b$0$12976$c3e8da3$54964...@news.astraweb.com... > Frank Millman wrote: > >> I tried something similar a while ago, and I did find a gotcha. >> >> The problem lies in this phrase - "if they are no longer a

Re: Design thought for callbacks

2015-02-23 Thread Frank Millman
he object it is referencing does not exist. My problem was that I had performed a cleanup operation on the listening object before letting it go out of scope, and it was no longer in a valid state to deal with the callback, resulting in an error. If you do not have that situation, your ori

Emacs python-mode.el bug #1207470

2014-02-14 Thread Frank Stutzman
e released code. Frank -- -- https://mail.python.org/mailman/listinfo/python-list

Re: Emacs python-mode.el bug #1207470

2014-02-14 Thread Frank Stutzman
Andreas R?hler wrote: > Re-opened the ticket mentioned. Please subscribe there, so you may get the > bug-mail. I've subscribed at launchpad and have given you a few more details there. Much appreciate you taking the time to look at this. -- Frank Stutzman -- https://mail

Re: decimal numbers

2014-02-15 Thread Frank Millman
thon3 to return a float - >>> 10/3 3.3335 You can reproduce the python3 behaviour in python2 by adding a 'future' directive - >>> from __future__ import division >>> 10/3 3.3335 HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: decimal numbers

2014-02-15 Thread Frank Millman
"Luke Geelen" wrote in message news:ae0da085-6c41-4166-92d2-92611a990...@googlegroups.com... > Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: >> "Luke Geelen" wrote in message >> >> news:ec88852e-1384-4aa5-834b-85135be94...@g

Re: decimal numbers

2014-02-15 Thread Frank Millman
"Frank Millman" wrote in message news:ldngnf$c3r$1...@ger.gmane.org... > > "Luke Geelen" wrote in message > news:ae0da085-6c41-4166-92d2-92611a990...@googlegroups.com... >> Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman:

Re: Emacs python-mode.el bug #1207470

2014-02-15 Thread Frank Stutzman
This has been resolved and I want to publically thank Andreas for finding and fixing this bug so quick. I'm fairly new to open source development and the rapidity that this was fix was gratifying. -- Frank Stutzman -- https://mail.python.org/mailman/listinfo/python-list

Deepcopying a byte string is quicker than copying it - problem?

2014-02-26 Thread Frank Millman
oop C:\>python -m timeit -s "import copy" "copy.deepcopy(b'a'*1000)" 10 loops, best of 3: 11.7 usec per loop As you can see, deepcopying a string is slightly slower than copying it. However, deepcopying a byte string is orders of magnitude quicker than copying

Re: Strange behavior with sort()

2014-02-26 Thread Frank Millman
box.sort() sorts box 'in situ', but does not return anything. That is why the second example prints None. In your second example, you are comparing the return value of box.sort() with [1, 2, 3]. As the return value is None, they are unequal. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Deepcopying a byte string is quicker than copying it - problem?

2014-02-27 Thread Frank Millman
"Frank Millman" wrote in message news:lemm11$18r$1...@ger.gmane.org... > Hi all > > I noticed this a little while ago, but dismissed it as a curiosity. On > reflection, I decided to mention it here in case it indicates a problem. > > This is with python 3.3.2.

Re: Mac vs. Linux for Python Development

2014-03-01 Thread Frank Millman
and python 3.3.2. I have just booted it up now, called up a command prompt, typed 'python' to start the interpreter, and typed 'import decimal'. The interpreter prompt re-appeared in the blink of an eye. Are you talking about something else? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Mac vs. Linux for Python Development

2014-03-01 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmrmJjiGMfqui=PpJco7LjtqVpUjj=xnmtybyqemxg3...@mail.gmail.com... > On Sun, Mar 2, 2014 at 4:51 PM, Frank Millman wrote: >> Which version are you talking about? >> >> I have an old, slow box running Windows Server 2003

Question about Source Control

2014-03-17 Thread Frank Millman
ny machine? Any hints will be appreciated. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about Source Control

2014-03-17 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmqPca5cnNWu8T5BZhpH665X0=mrf7bjalqvrqvmjzw...@mail.gmail.com... > On Tue, Mar 18, 2014 at 12:06 AM, Frank Millman > wrote: [...] >> >> So where should I install the SCM, and how should I set it up so that I >> can

Re: Question about Source Control

2014-03-17 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmqhxh2m3-qgbelv_akgajzmeymbudly8_dkpnhrpsu...@mail.gmail.com... > On Tue, Mar 18, 2014 at 4:39 PM, Frank Millman wrote: >> Two quick questions - >> >> 1. At present the source code is kept on one machine (A), but on

Re: Question about Source Control

2014-03-17 Thread Frank Millman
"Andriy Kornatskyy" wrote in message news:blu0-smtp953c8572b5ca6374830e5091...@phx.gbl... > Frank, > > I would suggest start with an account on https://bitbucket.org. It > supports private repositories so you should be good there. > > From other hand you can setu

Re: Question about Source Control

2014-03-18 Thread Frank Millman
"Ben Finney" wrote in message news:85y508roiw@benfinney.id.au... > "Frank Millman" writes: > >> I feel that I have just not grasped the basics yet, so any assistance >> that >> puts me on the right path is appreciated. > > Here is &qu

Re: Question about Source Control

2014-03-18 Thread Frank Millman
"Frank Millman" wrote in message news:lg6s09$irl$1...@ger.gmane.org... > Hi all > > I know I *should* be using a Source Control Management system, but at > present I am not. I tried to set up Mercurial a couple of years ago, but I > think I set it up wrongly, as

Re: Question about Source Control

2014-03-20 Thread Frank Millman
"Frank Millman" wrote in message news:lgbe6g$j9o$1...@ger.gmane.org... > > > To recap my basic setup, I have machine A which holds the source > directory, machine B which is used to edit the program, and machines B and > C which are both used to run the program. >

Re: Question about Source Control

2014-03-20 Thread Frank Millman
"Cameron Simpson" wrote in message news:20140321013313.ga58...@cskk.homeip.net... > > Someone intending to clone the project and develop will probably > want the whole repository; as Gregory says - they can then easily > push/pull with others. > > For Frank, the size

<    1   2   3   4   5   6   7   8   9   10   >