Re: Python 2.7.6 help with modules

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 3:31 PM, Scott W Dunning wrote: > I guess I answered my own question and it looks like it wouldn’t matter if > you did it opposite from weeks to seconds. Yep, you've got it! Remember, you can always try things out in the interactive interpreter to see what's happening. H

Re: Python 2.7.6 help with modules

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 3:17 PM, Scott W Dunning wrote: > How to do it from the small end up: > > time = int(raw_input("Enter number of seconds: ")) > seconds = time % 60 > > So here it takes say 100 and divides it by 60 to put in seconds and > spits out the remainder? 100 / 60 is approxi

Re: Python 2.7.6 help with modules

2014-02-09 Thread Scott W Dunning
On Feb 8, 2014, at 11:30 PM, Chris Angelico wrote: OH, I think I figured it out. > time = int(raw_input("Enter number of seconds: “)) 100 > seconds = time % 60 Remainder of 40 <- for seconds. > time /= 60 Here you take 100/60 = 1 (which = time for the next line). > minutes = time %

Re: Python 2.7.6 help with modules

2014-02-09 Thread Scott W Dunning
On Feb 8, 2014, at 11:30 PM, Chris Angelico wrote: I have one more question on this if you don’t mind. I’m a bit confused on how it works this way without it being in seconds? I’ll answer below each step of how it seems to work to me. > How to do it from the small end up: > > time = int(ra

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Dave Angel
Wesley Wrote in message: > >> > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx >> > always exist in pair. So, now, how to change the sequence to >> > a1,b1,...,an,bn, with time complexity as O(n) and space as O(1). >> >> >> >> The two halves of the list are already s

Re: Google Cloud Platform and GlassSolver Project

2014-02-09 Thread Dave Angel
eliasbylar...@gmail.com Wrote in message: > Also I should mention that I will credit whomever writes the scripts. I have > contacted Google on their Compute Engine which would execute these scripts. I > am await a reply! > It might help if you mention that you're talking about the Rubic cube,

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Wesley
[Wesley] This is not homework:-) And actually I am new to algorithm, so you guys can feel free to say anything you want -- https://mail.python.org/mailman/listinfo/python-list

Re: Google Cloud Platform and GlassSolver Project

2014-02-09 Thread eliasbylarsen
Also I should mention that I will credit whomever writes the scripts. I have contacted Google on their Compute Engine which would execute these scripts. I am await a reply! -- https://mail.python.org/mailman/listinfo/python-list

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Wesley
> > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > > time complexity as O(n) and space as O(1). > > > > The two halves of the list are already sorted, yes? [Wesley] No, not sorted

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Wesley
在 2014年2月9日星期日UTC+8下午11时48分17秒,Oscar Benjamin写道: > Please don't top-post. > > On Feb 9, 2014 2:40 PM, "Ni Wesley" wrote: > > > > > > Yes, with no new list, otherwise, space won't to be O(1) > > Did you read the link I posted: > > >> http://en.wikipedia.org/wiki/In-place_matrix_transposition >

[ANN] PyExt 0.6 Released!

2014-02-09 Thread Ryan Gonzalez
PyExt is a set of nifty(and sometimes either overly hackish, overly dangerous, or overly both) extensions to Python. It has things like a switch statement, runtime module creation, function overloading(does NOT work with class methods...yet), and more! Links: PyPI: https://pypi.python.org/pypi/pye

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Roy Smith
In article <52f80bca$0$29972$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 09 Feb 2014 10:05:02 -0500, Roy Smith wrote: > > > Is this a homework problem? > > and then (paraphrasing): > > > working code that solves the problem > > /headdesk I gave him the benefit of t

Google Cloud Platform and GlassSolver Project

2014-02-09 Thread eliasbylarsen
I am fully ready to invest in the Google Cloud Platform, and bring with me my very own idea: Glass Solver (Sometimes called GlaSolver). Long story short, this application for Google Glass will connect to the Cloud to retrieve God's Algorithm for the cube sitting in front of you by doing a series

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Steven D'Aprano
On Sun, 09 Feb 2014 10:05:02 -0500, Roy Smith wrote: > Is this a homework problem? and then (paraphrasing): > working code that solves the problem /headdesk -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: imperative mood in docstrings

2014-02-09 Thread Steven D'Aprano
On Sun, 09 Feb 2014 16:05:59 +0400, bagrat lazaryan wrote: > pep 257 -- docstring conventions, as well as a myriad of books and other > resources, recommend documenting a function's or method's effect as a > command ("do this", "return that"), not as a description ("does this", > "returns that").

Python (?) webserver for WSGI

2014-02-09 Thread Nicholas Cole
On Sunday, 9 February 2014, Asaf Las > wrote: > On Sunday, February 9, 2014 11:05:58 PM UTC+2, Nicholas wrote: > > Dear List, > > > > > > > > What is the latest "best-practice" for deploying a python wsgi > > application into production? > > > > For development, I've been using CherryPyWSGIServer

Re: imperative mood in docstrings

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 4:53 AM, Ethan Furman wrote: > Shouldn't that be: > > class Pig: > def fly(self): > "Soar gracefully through the air if a hot place is very cold." > if hell is frozen: > self.sprout_wings() > self.altitude += 10 >

Re: system wide mutex

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 1:45 AM, Roy Smith wrote: > In article , > Skip Montanaro wrote: > >> As the author of lockfile, I can tell you it only implements advisory >> locking. All programs needing to access the locked resources must >> cooperate. > > This is true of all mutexes, no? > Not quite

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 2:40 AM, Dennis Lee Bieber wrote: > Any opinion on Firebird? Just curiosity given how often the advice > seems to be "start with SQLite, avoid MySQL, end with PostgreSQL" No, because I've never used it. Has anyone here? What are its strengths and weaknesses? Chris

Re: Python (?) webserver for WSGI

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 11:05:58 PM UTC+2, Nicholas wrote: > Dear List, > > > > What is the latest "best-practice" for deploying a python wsgi > application into production? > > For development, I've been using CherryPyWSGIServer which has been > working very well (and the code is small eno

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Steven D'Aprano
On Sun, 09 Feb 2014 04:13:50 -0800, Wesley wrote: > Hi guys, >Here is one question related to algorithm. > Details here: > > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx > always exist in pair. So, now, how to change the sequence to > a1,b1,...,an,bn, with time complex

Google API and Python 2

2014-02-09 Thread Jason Friedman
I started Python programming in the last few years and so I started with version 3 and 99% of my code is in version 3. Much of Google API Python code seems to be Python 2. I can convert the occasional file to version 3 with 2to3, but for an entire 3rd-party library, could it be as simple as using

Python (?) webserver for WSGI

2014-02-09 Thread Nicholas Cole
Dear List, What is the latest "best-practice" for deploying a python wsgi application into production? For development, I've been using CherryPyWSGIServer which has been working very well (and the code is small enough to actually ship with my application). But I would like some way of deploying

Re: imperative mood in docstrings

2014-02-09 Thread Terry Reedy
On 2/9/2014 7:05 AM, bagrat lazaryan wrote: pep 257 -- docstring conventions, as well as a myriad of books and other resources, recommend documenting a function's or method's effect as a command ("do this", "return that"), not as a description ("does this", "returns that"). what's the logic beh

Re: imperative mood in docstrings

2014-02-09 Thread Ethan Furman
On 02/09/2014 08:52 AM, Roy Smith wrote: In article , bagrat lazaryan wrote: pep 257 -- docstring conventions, as well as a myriad of books and other resources, recommend documenting a function's or method's effect as a command ("do this", "return that"), not as a description ("does this", "

Re: imperative mood in docstrings

2014-02-09 Thread Chris “Kwpolska” Warrick
On Sun, Feb 9, 2014 at 5:52 PM, Roy Smith wrote: > In article , > bagrat lazaryan wrote: > >> pep 257 -- docstring conventions, as well as a myriad of books and other >> resources, recommend documenting a function's or method's effect as a command >> ("do this", "return that"), not as a descript

Re: system wide mutex

2014-02-09 Thread Asaf Las
Hi Thanks for replies. It would be good to have blocking implementation. I have to check fcntl if it works in blocking mdoe on CentOS. Meanwhile there is Posix Semaphore made for Python: http://semanchuk.com/philip/posix_ipc/ will try it as well. /Asaf -- https://mail.python.org/mailman/li

Re: imperative mood in docstrings

2014-02-09 Thread Jussi Piitulainen
Mark Lawrence writes: > On 09/02/2014 12:05, bagrat lazaryan wrote: > > > pep 257 -- docstring conventions, as well as a myriad of books and > > other resources, recommend documenting a function's or method's > > effect as a command ("do this", "return that"), not as a > > description ("does this",

Re: imperative mood in docstrings

2014-02-09 Thread Mark Lawrence
On 09/02/2014 12:05, bagrat lazaryan wrote: pep 257 -- docstring conventions, as well as a myriad of books and other resources, recommend documenting a function's or method's effect as a command ("do this", "return that"), not as a description ("does this", "returns that"). what's the logic beh

Re: imperative mood in docstrings

2014-02-09 Thread Roy Smith
In article , bagrat lazaryan wrote: > pep 257 -- docstring conventions, as well as a myriad of books and other > resources, recommend documenting a function's or method's effect as a command > ("do this", "return that"), not as a description ("does this", "returns > that"). what's the logic b

Re: system wide mutex

2014-02-09 Thread Marko Rauhamaa
Asaf Las : > Which one is most recommended to use for mutex alike locking to > achieve atomic access to single resource: > > - fcntl.lockf I recommend fcntl.flock: #!/usr/bin/python3 import sys, fcntl, time with open("te

Re: Help!

2014-02-09 Thread Mark Lawrence
On 09/02/2014 13:52, Moz wrote: On Sunday, February 9, 2014 5:54:16 PM UTC+5, Asaf Las wrote: On Sunday, February 9, 2014 2:25:16 PM UTC+2, Moz wrote: I want to make something that can aid me financially. If you have done something like this please can you provide me with the resources a

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-09 Thread Mark Lawrence
On 09/02/2014 10:47, wxjmfa...@gmail.com wrote: Le dimanche 9 février 2014 06:17:03 UTC+1, Skybuck Flying a écrit : " However there is more... Python may lack some technical language elements like, call by reference, and perhaps other low level codes, like 8 bit, 16 bit, 32 bit integers wh

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Oscar Benjamin
Please don't top-post. On Feb 9, 2014 2:40 PM, "Ni Wesley" wrote: > > Yes, with no new list, otherwise, space won't to be O(1) Did you read the link I posted: >> http://en.wikipedia.org/wiki/In-place_matrix_transposition Oscar -- https://mail.python.org/mailman/listinfo/python-list

Re: system wide mutex

2014-02-09 Thread Skip Montanaro
On Sun, Feb 9, 2014 at 8:45 AM, Roy Smith wrote: > This is true of all mutexes, no? Hmmm... You might well be right. I thought that use of the O_EXLOCK flag in the open(2) system call would prevent other processes from opening the file, but (at least on my Mac) it just blocks until the first proc

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Roy Smith
In article , Wesley wrote: > Hi guys, >Here is one question related to algorithm. > Details here: > > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > time complexity as O(n) and s

Re: system wide mutex

2014-02-09 Thread Roy Smith
In article , Skip Montanaro wrote: > > Which one is most recommended to use for mutex alike locking to > > achieve atomic access to single resource: > > > > - fcntl.lockf > > - os.open() with O_SHLOCK and O_EXLOCK > > - https://pypi.python.org/pypi/lockfile/0.9.1 > > - https://pypi.python.org/py

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Ni Wesley
Yes, with no new list, otherwise, space won't to be O(1) Wesley 2014年2月9日 下午10:31于 "Oscar Benjamin" 写道: > Please reply to the list rather than directly to me so that other > people can see the answer to my question and offer you help. > > On 9 February 2014 14:04, Ni Wesley wrote: > > 2014年2月9日

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Oscar Benjamin
Please reply to the list rather than directly to me so that other people can see the answer to my question and offer you help. On 9 February 2014 14:04, Ni Wesley wrote: > 2014年2月9日 下午9:41于 "Oscar Benjamin" 写道: > >> On 9 February 2014 12:13, Wesley wrote: >> > Hi guys, >> >Here is one questi

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Tim Chase
On 2014-02-09 22:00, Chris Angelico wrote: > On Sun, Feb 9, 2014 at 9:20 PM, Marcel Rodrigues > wrote: > > As Chris said, if your needs are simple, use SQLite back-end. > > It's probably already installed on your computer and Python has a > > nice interface to it in its standard library. > > Al

Re: Help!

2014-02-09 Thread Moz
On Sunday, February 9, 2014 5:54:16 PM UTC+5, Asaf Las wrote: > On Sunday, February 9, 2014 2:25:16 PM UTC+2, Moz wrote: > > > I want to make something that can aid me financially. If you have > > > done something like this please can you provide me with the resources > > > and the libraries s

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Oscar Benjamin
On 9 February 2014 12:13, Wesley wrote: > Hi guys, >Here is one question related to algorithm. > Details here: > > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > time complexity as O(

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Chris Angelico
On Mon, Feb 10, 2014 at 12:27 AM, Asaf Las wrote: > i did it just to test sqlite3 behavior and actually test was related to > simulation of unique incremental sequence number/counter for > independently spawned tasks accessing counter in non deterministic manner. Sure. I would expect that you'd

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 3:14:50 PM UTC+2, Chris Angelico wrote: > On Sun, Feb 9, 2014 at 11:47 PM, Asaf Las wrote: > Thanks > > Also, you're connecting and disconnecting repeatedly... oh, I see why > it didn't work when I tried. You're also using two completely > different database names:

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Chris Angelico
On Sun, Feb 9, 2014 at 11:47 PM, Asaf Las wrote: > i simply tested running 2 independent processes started at same time in > parallel towards same sqlite database and never get 2 in that row > though used exclusive lock on DB. might be i did something wrong. The threading locks aren't doing a

Re: Help!

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 2:25:16 PM UTC+2, Moz wrote: > I want to make something that can aid me financially. If you have > done something like this please can you provide me with the resources > and the libraries so that i may study even further. > > Thanks You! you can try similar to this

Re: Help!

2014-02-09 Thread Moz
On Sunday, February 9, 2014 5:42:09 PM UTC+5, Chris Angelico wrote: > On Sun, Feb 9, 2014 at 11:25 PM, Moz wrote: > > > I have studied python(2.7.2) till classes. I have covered most of the the > > general topics. But i do not know how to apply this. Can someone help me? I > > want to make some

imperative mood in docstrings

2014-02-09 Thread bagrat lazaryan
pep 257 -- docstring conventions, as well as a myriad of books and other resources, recommend documenting a function's or method's effect as a command ("do this", "return that"), not as a description ("does this", "returns that"). what's the logic behind this recommendation? bagratte -- https

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 1:00:58 PM UTC+2, Chris Angelico wrote: > The biggest downside of SQLite3 is concurrency. I haven't dug into the > exact details of the pager system and such, but it seems to be fairly > coarse in its locking. Also, stuff gets a bit complicated when you do > a single tra

Re: Help!

2014-02-09 Thread Chris Angelico
On Sun, Feb 9, 2014 at 11:25 PM, Moz wrote: > I have studied python(2.7.2) till classes. I have covered most of the the > general topics. But i do not know how to apply this. Can someone help me? I > want to make something that can aid me financially. If you have done > something like this plea

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Chris Angelico
On Sun, Feb 9, 2014 at 11:13 PM, Wesley wrote: > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > time complexity as O(n) and space as O(1). The two halves of the list are already sorted,

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 2:13:50 PM UTC+2, Wesley wrote: > Hi guys, >Here is one question related to algorithm. > Details here: > > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > t

Help!

2014-02-09 Thread Moz
I have studied python(2.7.2) till classes. I have covered most of the the general topics. But i do not know how to apply this. Can someone help me? I want to make something that can aid me financially. If you have done something like this please can you provide me with the resources and the libr

Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Wesley
Hi guys, Here is one question related to algorithm. Details here: here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with time complexity as O(n) and space as O(1). Any comments will be appreciate

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Chris Angelico
On Sun, Feb 9, 2014 at 11:04 PM, Marcel Rodrigues wrote: > I just checked in the Python sources and apparently you're right about > SQLite3. The Python distribution includes pysqlite which seems to be a > self-contained SQLite engine. No external dependencies. Sorry for the > confusion. Comes to

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Marcel Rodrigues
I just checked in the Python sources and apparently you're right about SQLite3. The Python distribution includes pysqlite which seems to be a self-contained SQLite engine. No external dependencies. Sorry for the confusion. 2014-02-09 9:00 GMT-02:00 Chris Angelico : > On Sun, Feb 9, 2014 at 9:20

Event::wait with timeout gives delay

2014-02-09 Thread Okko Willeboordse
Running Python 2.6 and 2.7 on Windows 7 and Server 2012 Event::wait causes a delay when used with a timeout that is not triggered because event is set in time. I don't understand why. Can someone explain? The following program shows this; '''Shows that using a timeout in Event::wait (same for

Re: system wide mutex

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 1:00:39 PM UTC+2, Skip Montanaro wrote: > > Which one is most recommended to use for mutex alike locking to > > achieve atomic access to single resource: > > > > - fcntl.lockf > > - os.open() with O_SHLOCK and O_EXLOCK > > - https://pypi.python.org/pypi/lockfile/0.9.1 >

Re: system wide mutex

2014-02-09 Thread Asaf Las
Forget to mentioned - CentOS 6.5 Python v3.3. -- https://mail.python.org/mailman/listinfo/python-list

Re: system wide mutex

2014-02-09 Thread Skip Montanaro
> Which one is most recommended to use for mutex alike locking to > achieve atomic access to single resource: > > - fcntl.lockf > - os.open() with O_SHLOCK and O_EXLOCK > - https://pypi.python.org/pypi/lockfile/0.9.1 > - https://pypi.python.org/pypi/zc.lockfile/1.1.0 > - any other ? As the author

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Chris Angelico
On Sun, Feb 9, 2014 at 9:20 PM, Marcel Rodrigues wrote: > As Chris said, if your needs are simple, use SQLite back-end. It's probably > already installed on your computer and Python has a nice interface to it in > its standard library. Already installed? I thought the point of SQLite3 being in th

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-09 Thread wxjmfauth
Le dimanche 9 février 2014 06:17:03 UTC+1, Skybuck Flying a écrit : > " > > > > > However there is more... Python may lack some technical language elements > > like, call by reference, and perhaps other low level codes, like 8 bit, 16 > > bit, 32 bit integers which play a roll with interfac

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-09 Thread Marcel Rodrigues
Another option is PyMySQL [1]. It's developed in the open at GitHub [2]. It's pure Python, compatible with both Python 2 and Python 3. It's DB-API 2 compliant. It also implements some non-standard bits that are present in MySQLdb, in order to be compatible with legacy code, notably Django (personal

system wide mutex

2014-02-09 Thread Asaf Las
Hi Which one is most recommended to use for mutex alike locking to achieve atomic access to single resource: - fcntl.lockf - os.open() with O_SHLOCK and O_EXLOCK - https://pypi.python.org/pypi/lockfile/0.9.1 - https://pypi.python.org/pypi/zc.lockfile/1.1.0 - any other ? Thanks /Asaf -- htt

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Marcel Rodrigues
As Chris said, if your needs are simple, use SQLite back-end. It's probably already installed on your computer and Python has a nice interface to it in its standard library. [1] If you decide to use MySQL back-end instead, consider using PyMySQL [2]. It's compatible with both Python 2 and Python 3