converting binary data

2005-04-27 Thread Dan Stromberg
I've written up a page about how to convert native binary data to another platform's native binary data, as I did some fortran data conversions for a client. The programs and documentation are at: http://dcs.nac.uci.edu/~strombrg/converting-binary.html So far, the page includes a variety of pro

Re: Python Challenge ahead [NEW] for riddle lovers

2005-04-30 Thread Dan Bishop
darren kirby wrote: > quoth the Shane Hathaway: > > pythonchallenge wrote: > > > For the riddles' lovers among you, you are most invited to take part > > > in the Python Challenge, the first python programming riddle on the net. > > > > > > You are invited to take part in it at: > > > http://www.py

Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Dan Stromberg
On Sun, Nov 17, 2013 at 11:16 AM, Salvatore DI DIO < salvatore.di...@gmail.com> wrote: > Hello, > > If someone is interested about a fast Python to Javascript translator > (not a compiler like Brython which is another beast) > RapydScript is interesting. Here's a comparison of several Python-in-

Re: sendmail library ?!

2013-11-18 Thread Dan Stromberg
On Tue, Nov 12, 2013 at 8:52 PM, Tamer Higazi wrote: > Hi people! > > I am looking for a python library that does mailing directly through > "sendmail". > I use: http://stromberg.dnsalias.org/svn/mailer/trunk/mailer.py -- https://mail.python.org/mailman/listinfo/python-list

Re: Recursive generator for combinations of a multiset?

2013-11-21 Thread Dan Stromberg
On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan wrote: > > Short story: the subject says it all, so if you have an answer already, > fire away. Below is the long story of what I'm using it for, and why I > think it needs to be recursive. It may even be of more general > interest in terms of filteri

Re: python for everyday tasks

2013-11-22 Thread Dan Stromberg
Teach that Python emphasizes readability. Perhaps talk about bugs / lines_of_code being roughly a constant. Then talk about the fact that Python generally takes fewer lines of code to express the same thing. This implies fewer bugs for many projects. Teach the fundamental types, with difference

Re: Recursive generator for combinations of a multiset?

2013-11-22 Thread Dan Stromberg
On Fri, Nov 22, 2013 at 4:58 PM, John O'Hagan wrote: > On Thu, 21 Nov 2013 12:59:26 -0800 > Dan Stromberg wrote: > > > On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan > > wrote: > > > > > > > > Short story: the subject says it all, so if yo

Re: python for everyday tasks

2013-11-22 Thread Dan Stromberg
I almost forgot: Talk about pypi and pip (or similar) too. On Fri, Nov 22, 2013 at 3:59 PM, wrote: > >> Hello, >> >> I'm about held a short course with the title indicated in the subjects. >> The students are very experienced programmers of our company, with deep >> knoledge on C, C++, C#, Perl a

tkinter bug on mac maverick python 3.3.3

2013-11-27 Thread Dan Wissme
Hi ! Am I the only one to get a bug in GUIs using tkinter on my Mac under maverick and Python 3.3.3 ? When will they get rid of Tcl/Tk which causes recurrent problems at almost each new Python version ! Please, for the rest of us... -dan -- https://mail.python.org/mailman/listinfo/python

Re: any use case of logging.config.listen()?

2013-12-03 Thread Dan Sommers
? Adding a new SocketHandler seems more heavyweight (and more risky) than adjusting the logging level on an existing SocketHandler. HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Recursive generator for combinations of a multiset?

2013-12-05 Thread Dan Stromberg
On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan wrote: > > Short story: the subject says it all, so if you have an answer already, > fire away. Below is the long story of what I'm using it for, and why I > think it needs to be recursive. It may even be of more general > interest in terms of filteri

Re: squeeze out some performance

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence wrote: > On 06/12/2013 16:52, John Ladasky wrote: > >> On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtländer wrote: >> >> I try to squeeze out some performance of the code pasted on the link >>> below. >>> http://pastebin.com/gMnqprST >>>

One liners

2013-12-06 Thread Dan Stromberg
Does anyone else feel like Python is being dragged too far in the direction of long, complex, multiline one-liners? Or avoiding temporary variables with descriptive names? Or using regex's for everything under the sun? What happened to using classes? What happened to the beautiful emphasis on r

Re: One liners

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 4:10 PM, Michael Torrie wrote: > On 12/06/2013 04:54 PM, Dan Stromberg wrote: > > Does anyone else feel like Python is being dragged too far in the > direction > > of long, complex, multiline one-liners? Or avoiding temporary variables > > wit

Re: One liners

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 6:07 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 06 Dec 2013 15:54:22 -0800, Dan Stromberg wrote: > > > Does anyone else feel like Python is being dragged too far in the > > direction of long, complex, multi

Movie (MPAA) ratings and Python?

2013-12-09 Thread Dan Stromberg
Is anyone using a module or database that gives Python 3.x access to MPAA ratings (EG G, PG, PG-13, etc.)? I explored a few of the possibilities on Pypi, a couple of web interfaces, and the IMDB flat text file with ratings and reasons for those ratings, but I've not been really impressed yet. The

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 12:41 AM, Jai wrote: > > sql = """insert into `category` (url, catagory,price) VAlUES > ('%s', '%s', '%s')"""%(link1,x,y) > Is that VALUES or VAlUES or VAIUES? It probably should be VALUES. -- https://mail.python.org/mailman/listinfo/python-list

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 10:40 PM, Ben Finney wrote: > Dan Stromberg writes: > > > Is anyone using a module or database that gives Python 3.x access to MPAA > > ratings (EG G, PG, PG-13, etc.)? > > What information would you want access to? Why would a library (rather >

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 10:48 PM, Paul Scott wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/12/2013 08:40, Ben Finney wrote: > > Dan Stromberg writes: > > > >> Is anyone using a module or database that gives Python 3.x access > >

Trouble with Multi-threading

2013-12-10 Thread dan . rose
I am running PYTHON 2.7.3 and executing a PYTHON program that uses multi-threading. I am running this on a 64-bit Windows 2008 R2 server (Service Pack 1). Three months ago, I was able to execute this program just fine. I ran the program and opened Task Manager and verified that the program su

Re: Trouble with Multi-threading

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 8:21 AM, wrote: > I am running PYTHON 2.7.3 and executing a PYTHON program that uses > multi-threading. I am running this on a 64-bit Windows 2008 R2 server > (Service Pack 1). > > Three months ago, I was able to execute this program just fine. I ran the > program and op

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 1:07 PM, Petite Abeille wrote: > > On Dec 10, 2013, at 6:25 AM, Dan Stromberg wrote: > > > The IMDB flat text file probably came the closest, but it appears to > have encoding issues; it's apparently nearly windows-1255, but not quite. > > It&

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 3:34 PM, Ben Finney wrote: > Michael Torrie writes: > > > I'm not sure whether there's actual confusion here on your part, or > > deliberate obtuseness. > > Not confusion, but a desire to avoid guesses based on very vague > requirements. > What part of "movie ratings (EG

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 4:07 PM, Mark Lawrence wrote: > On 10/12/2013 23:50, Dan Stromberg wrote: > >> >> But I believe imdbpy is 2.7 only. >> > > I guess it wouldn't be that difficult to run it through 2to3. Try that > and see what happens? > 2to3

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 10:35 AM, Ned Batchelder wrote: > On 12/10/13 6:50 PM, Dan Stromberg wrote: > Now the question becomes: Why did chardet tell me it was windows-1255? :) > > It probably told you it was Windows-1252 (I'm assuming the last 5 is a > typo). > > Wind

Re: Tracking the status of python script execution

2013-12-11 Thread Dan Stromberg
Long ago, I saw a C program that took another C program as input. It would output a copy of the original C program, interspersed with fprintf's that would display the text of the line current being executed. You might write something similar for Python, perhaps outputting the line being executed

Re: [newbie] trying socket as a replacement for nc

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: > I have an ethernet-rs232 adapter which allows me to connect to a > measurement instrument by means of netcat on a linux system. > e.g. entering nc 10.128.59.63 7000 > allows me to enter e.g. > *IDN? > after which I get an identification string

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 3:24 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 11 Dec 2013 15:07:35 -0800, Dan Stromberg wrote: > > > $ chardet mpaa-ratings-reasons.list > > mpaa-ratings-reasons.list: windows-1255 (confidence: 0.97) >

Re: grab dict keys/values without iterating ?!

2013-12-11 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 4:02 PM, Tamer Higazi wrote: > Hi people! > > Is there a way to get dict by search terms without iterating the entire > dictionary ?! > > Let us assume I have: > > {'Amanda':'Power','Amaly':'Higgens','Joseph':'White',' > Arlington','Black','Arnold','Schwarzenegger'} > > I

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 5:01 PM, Ned Batchelder wrote: > On 12/11/13 6:39 PM, Dan Stromberg wrote: > >> >> On Wed, Dec 11, 2013 at 3:24 PM, Steven D'Aprano >> > <mailto:steve+comp.lang.pyt...@pearwood.info>> wrote: >> >> On

Re:

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:06 AM, marcinmltd wrote: > Hello, > > I'm big fan of multiprocessing module, but recently I started looking at > threading in Python more closely and got couple of questions I hope You can > help me with: > > 1. When I run two or more threads in my python process are the

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois wrote: > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: >> >> I have an ethernet-rs232 adapter which allows me to connect to a measurement >

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards wrote: >> Sockets reserve the right to split one socket.send() into multiple >> socket.recv()'s on the other end of the communication, or to aggregate >> multiple socket.send()'s into a single socket.recv() - pretty much any way >> the relevant IP st

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 7:23 PM, Jean Dubois wrote: > Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg: >> On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois >> wrote: >> >> > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >

Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
> s.close() >> > print 'Received:', data >> > >> > Can anyone here tell me how to do it properly? >> > thanks in advance >> > jean >> Such equipment often implements a telnet protocol. Have use try using the >> telnetlib module

Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
On Fri, Dec 13, 2013 at 8:06 AM, Grant Edwards wrote: > On 2013-12-12, Dan Stromberg wrote: >> On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards >> wrote: >> >>>> Sockets reserve the right to split one socket.send() into multiple >>>> socket.recv()&#

Re: a Python Static Analyzer

2013-12-14 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 4:35 PM, wrote: > Hi, > > I thought it would be worth contributing some awareness of Yin Wang's > PySonar2 Python static analyzer being open sourced, it's here > https://github.com/yinwang0/pysonar2. I recently converted it from being > implemented in Java to being imp

Re: [newbie] trying socket as a replacement for nc

2013-12-15 Thread Dan Stromberg
On Sun, Dec 15, 2013 at 7:35 AM, Jean Dubois wrote: >> You can "svn checkout ". You might try Sliksvn if you're on >> Windows, or if you're on Linux it's in synaptic or yum or whatever. >> You can "wget ". >> You can bring up the URL in a web browser and cut and paste. > I'm using Linux, I did t

Re: Unpacking the structures

2013-12-18 Thread Dan Stromberg
On Wed, Dec 18, 2013 at 8:32 PM, wrote: > > Hi all, >While performing the packing/unpacking of xdr structures of rpc I get an > error as following. > > > x = struct.unpack('>L', data)[0] struct.error: unpack requires a string > argument of length 4. > > Can anybody help me in this regard?

Re: Why Python is like C++

2013-12-21 Thread Dan Stromberg
On Fri, Dec 20, 2013 at 9:34 PM, Mark Lawrence wrote: > On 20/12/2013 14:19, Roy Smith wrote: >> >> http://xkcd.com/1306/ >> > > I believe that to be a very superficial like. They're unlike in that once > C++ people have compiled their code they can head down to the pub, but > Python people have

Re: 2nd Try: Trouble writing lines to file that include line feeds - Newbie

2013-12-22 Thread Dan Healy
Solved. Simply change the 'w' from the file.open method to an 'a' for append On Sunday, December 22, 2013 7:55:28 PM UTC-5, Dan Healy wrote: > Overview: I'm attempting to read strings from a serial port. Each string ends > with a carriage return and line feed. I w

2nd Try: Trouble writing lines to file that include line feeds - Newbie

2013-12-23 Thread Dan Healy
Overview: I'm attempting to read strings from a serial port. Each string ends with a carriage return and line feed. I want to write those strings to a file, like a log file. So, if I send P1 and the P2 on a new line, I would expect to open this file and find (line 1) P1 (line 2) P2. Problem: T

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-23 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 4:25 AM, Chris Angelico wrote: > On Sat, Dec 14, 2013 at 11:12 PM, Jai wrote: >> GUI:-want to learn GUI programming in python , how should i proceed. >> >> There are lots of book here so I am confuse which book i should refer so >> that i don't waste time . please answ

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 10:32 AM, wrote: > i am using 2.7. I need to print the time in seconds from the epoch with > millisecond precision. i have tried many things but have failed. heres my > latest: > > from time import time, strftime > from datetime import datetime, time

Re: How to learn Python effectively

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 6:54 PM, 汪伟斌 wrote: > I am a beginner in Python, and I find that there are various books about > Python. > There are almost the same contents between some, So I want a recommendation > of a > good order of the books, which can make me learn Python more effectively. > Thanks

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:04 PM, Travis McGee wrote: > What's the deal? If I want to make a distributable software package, should > it be 2 or 3? Enquiring minds want to know. 3.x alone isn't a bad option, but it doesn't really have to be an either-or decision. That is, even pretty substantial

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody wrote: > On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg wrote: > As for 2 maybe we need a wiki page. (Or do we have one already?) > Heres my largely ignoramus attempt at starting that: > > 1. print: Use print with (). Dont use funny 2 syntax. In fact,

Python 2.x and 3.x usage survey

2013-12-30 Thread Dan Stromberg
I keep hearing naysayers, nay saying about Python 3.x. Here's a 9 question, multiple choice survey I put together about Python 2.x use vs Python 3.x use. I'd be very pleased if you could take 5 or 10 minutes to fill it out. Here's the URL: https://www.surveymonkey.com/s/N5N5PG2 -- https://mail.

Python 2.x vs 3.x survey

2014-01-03 Thread Dan Stromberg
The results of the survey are at: https://wiki.python.org/moin/2.x-vs-3.x-survey -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a list with holes

2014-01-03 Thread Dan Stromberg
On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico wrote: > Depending on what exactly you need, it's probably worth just using a > dict. In what ways do you need it to function as a list? You can > always iterate over sorted(some_dict.keys()) if you need to run > through them in order. FWIW, sorting

Re: Creating a list with holes

2014-01-03 Thread Dan Stromberg
On Fri, Jan 3, 2014 at 7:00 PM, Chris Angelico wrote: > On Sat, Jan 4, 2014 at 1:58 PM, Dan Stromberg wrote: >> On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico wrote: >>> Depending on what exactly you need, it's probably worth just using a >>> dict. In what ways

Re: Postfix conditionals

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 12:41 PM, Roy Smith wrote: > In article , > Göktu€ Kayaalp wrote: > >>py> for i in [False]: >>... break if not i > > Python is not Perl. Personally, I find the suggested syntax jarring. I'd prefer that it not go into Python. -- https://mail.python.org/mailma

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 2:32 PM, Serhiy Storchaka wrote: > I wonder why nobody complains about the absent of implicit conversion > between int and str. In PHP you can write 2 + "3" and got 5, but in Python > this is an error. So sad! I like Python strongly typed, thank you very much. Please don'

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 4:46 PM, Ethan Furman wrote: > While I don't agree with his assessment of Python 3 in total, I definitely > feel his pain with regards to bytestrings in Py3 -- because they don't > exist. 'bytes' /looks/ like a bytestring, but really it's just a bunch of > integers: > > -->

Re: Learning python networking

2014-01-08 Thread Dan Stromberg
Nice response Chris. Seriously. On Wed, Jan 8, 2014 at 3:29 PM, Chris Angelico wrote: > One extremely critical point about your protocol. TCP is a stream - > you don't have message boundaries. You can't depend on one send() > becoming one recv() at the other end. It might happen to work when you

Re: Learning python networking

2014-01-08 Thread Dan Stromberg
On Wed, Jan 8, 2014 at 4:07 PM, Chris Angelico wrote: > Maybe it's not the best way to do things, but it can be extremely > simple in the code. For small projects, the added complexity doesn't bite you. At least, not much. For large projects, with thousands or millions of callbacks, it can be v

Re: the Gravity of Python 2

2014-01-09 Thread Dan Sommers
On Thu, 09 Jan 2014 09:14:22 -0500, Roy Smith wrote: > Oh, and another thing I can do with a datetime that I can't do with a > unix timestamp. I can represent the day I was born. At the risk of dating myself, the day I was born is -231094800. Dan -- https://mail.python.org/mailm

setup.py issue - some files are included as intended, but one is not

2014-01-11 Thread Dan Stromberg
Hi folks. I have a setup.py problem that's driving me nuts. I have a treap.py file that tries to "import * from pyx_treap.so", and failing that, it'll "import * from py_treap.py" (sans extensions of course). Naturally, all 3 of these should be included - although in the case of pyx_treap.so, it

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-11 Thread Dan Stromberg
On Sat, Jan 11, 2014 at 12:07 AM, pintreo mardi wrote: > Hi, I've just begun to learn programming, I have an open question for the > group: > Is the Python language an all in one computer language which could replace C, > C++, Java etc.. I only ask becuase I am starting off with python and I wan

Re: setup.py issue - some files are included as intended, but one is not

2014-01-14 Thread Dan Stromberg
On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: > Hi folks. > > I have a setup.py problem that's driving me nuts. Anyone? I've received 0 responses. > I have a treap.py file that tries to "import * from pyx_treap.so", and > failing that, it'll &quo

Re: How to write this as a list comprehension?

2014-01-17 Thread Dan Stromberg
On Fri, Jan 17, 2014 at 3:19 PM, Piet van Oostrum wrote: > Hi, > > I am looking for an elegant way to write the following code as a list > comprehension: > > labels = [] > for then, name in mylist: > _, mn, dy, _, _, _, wd, _, _ = localtime(then) > labels.append(somefunc(mn, day, wd, name)

Re: setup.py issue - some files are included as intended, but one is not

2014-01-17 Thread Dan Stromberg
On Wed, Jan 15, 2014 at 7:18 AM, Piet van Oostrum wrote: > Dan Stromberg writes: > >> On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: >>> Hi folks. >>> >>> I have a setup.py problem that's driving me nuts. >> >> Anyone? I

Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Dan Stromberg
On Sat, Jan 18, 2014 at 10:31 PM, Steven D'Aprano wrote: > On Sat, 18 Jan 2014 14:32:21 -0800, indar kumar wrote: > >> @Roy Smith >> >> Can you help me privately because its an assignment and have to submit >> plagiarism free > > Then don't plagiarise. > > > Plagiarism means YOU copy other people.

Re: 1st Sketch at at ReadOnly dict

2014-01-20 Thread Dan Stromberg
On Mon, Jan 20, 2014 at 12:09 PM, Charles Hixson wrote: > class RODict: > #Instance Variable Doc > ##@var_ddict > #This variable holds the reference to the dict. > > ##Class initializer. > #@paramddictThe data dictionary to which this is a read

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Dan Sommers
were busted early on; I don't know how it all turned out in the end. Dan -- https://mail.python.org/mailman/listinfo/python-list

Python 1.0 - release date?

2014-01-21 Thread Dan Stromberg
Does anyone know when Python 1.0 was released? I want to say August of 1993, but there are apparently those who disagree. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Case insensitive exists()?

2014-01-22 Thread Dan Sommers
n, and I have the benefit of having read all of the other answers, but what about calling "locate" [0] with the "-i" flag? or writing some sort of Python/ctypes wrapper around the part of locate that searches the database? Dan [0] http://savannah.gnu.org/projects/findutils/ -- https://mail.python.org/mailman/listinfo/python-list

Re: buggy python interpretter or am I missing something here?

2014-01-27 Thread Dan Sommers
t('current', arg) > if arg == '-#': > print('next', next(a_iter)) And check out add_argument's "nargs" option: http://docs.python.org/3/library/argparse.html#nargs HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Another surprise from the datetime module

2014-01-30 Thread Dan Sommers
That's how str.replace works, too. *sigh* Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Dan Sommers
On Thu, 30 Jan 2014 15:21:35 +, Grant Edwards wrote: > On 2014-01-30, wxjmfa...@gmail.com wrote: > >> The temperature unit is the "Kelvin", not the "Degree Kelvin". >> One writes: 0 K, 275.15 K > > And remember to say "Kelvins" not "Kelvin" when speaking about > temperatures other than 1 K.

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Dan Sommers
On Fri, 31 Jan 2014 04:37:16 +, Steven D'Aprano wrote: > On Fri, 31 Jan 2014 04:08:46 +0000, Dan Sommers wrote about temperatures: > >> And -1 K. > > You josh, but there are negative temperatures in Kelvin. They're hotter > than infinitely hot. &g

Re: pytz question: GMT vs. UTC

2014-01-31 Thread Dan Sommers
On Fri, 31 Jan 2014 17:42:30 +1100, Chris Angelico wrote: > On Fri, Jan 31, 2014 at 5:28 PM, Dan Sommers wrote: >> ObPython: My program retrieves temperatures (in Kelvins) from an >> external device (the details of which I am not at liberty to discuss) >> and stores them

Re: Calculator Problem

2014-02-04 Thread Dan Sommers
On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: > In article , > David Hutto wrote: > >> Can anyone point out how using an int as a var is possible > > one = 42 > > (ducking and running) int = 42 (ducking lower and running faster) -- https://mail.python.org/mailman/listinfo/python-lis

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Dan Sommers
w to avoid this type of error in the future? I think you just mentioned the best suggestions: (a) have a good collection of unit tests (where "good" means data and branch coverage), and (b) look carefully, or have someone else look carefully, at every commit. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about `list.insert`

2014-02-06 Thread Dan Stromberg
On Thu, Feb 6, 2014 at 3:59 PM, cool-RR wrote: > Hi, > > I'm curious. If I append an item to a list from the left using `list.insert`, > will Python always move the entire list one item to the right (which can be > super-slow) or will it check first to see whether it can just allocate more > me

RE: does the order in which the modules are placed in a file matters ?

2015-12-16 Thread Dan Strohl
ches using "as" etc...) Note, using * is dis-recommended, though pretty often done, for more information on using *, see: https://docs.python.org/2/tutorial/modules.html#importing-from-a-package Dan Strohl -Original Message- From: Python-list [mailto:python-list-bounces+d

Re: raise None

2016-01-03 Thread Dan Sommers
On Mon, 04 Jan 2016 16:19:51 +1100, Steven D'Aprano wrote: > (1) reminding people that the part of the code which determines the > existence of an error need not be the part of the code which actually > calls raise [...] Do chained exceptions scratch your itch? I don't have experience with Pytho

Re: Make a unique filesystem path, without creating the file

2016-02-14 Thread Dan Sommers
On Mon, 15 Feb 2016 11:08:52 +1100, Ben Finney wrote: > I am unconcerned with whether there is a real filesystem entry of that > name; the goal entails having no filesystem activity for this. I want > a valid unique filesystem path, without touching the filesystem. That's an odd use case. If it'

RE: Question on keyword arguments

2016-02-18 Thread Dan Strohl
there a large enough benefit in processing that you want to be able to use it multiple ways without having to regenerate the list. (note that this is the last criteria, unless performance is really critical, readability and predictability is normally much more important than what is prob

RE: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread Dan Strohl
Disadvantages of python... (compared to VB) That's a hard one, but here are my thoughts: (keep in mind that these kinds of discussions are subjective and much is based on the background and experience of the coder, these are also assuming that 100% of your audience is on windows, as soon as yo

RE: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-18 Thread Dan Strohl
va app for mobile clients or Linux ones?) Also, looking at existing frameworks and expandable apps out there that you might be able to do less work but still meet your goals with because 80% of the work was done for you... things like django, splunk, tableau, etc... Dan > -Ori

Weird python 2.7 import thing

2016-02-18 Thread Dan Stromberg
OK, I'd rather be on 3.x, but that's not going to happen today. So 2.7. I have added directories to my sys.path hundreds of times before importing from them, and know what to expect from that. I confess, I don't have a lot of package or egg experience. However, I have a somewhat special (appare

Re: Weird python 2.7 import thing

2016-02-19 Thread Dan Stromberg
On Thu, Feb 18, 2016 at 5:40 PM, Dan Stromberg wrote: > > BTW, this is not a package I pip installed from pypi - it's an > internal-only project. I need to correct this: It's not installed from pypi.python.org, but it probably is installed from our internal pypi server.

Re: Weird python 2.7 import thing

2016-02-19 Thread Dan Stromberg
On Fri, Feb 19, 2016 at 10:33 AM, Dan Stromberg wrote: > On Thu, Feb 18, 2016 at 5:40 PM, Dan Stromberg wrote: > >> >> BTW, this is not a package I pip installed from pypi - it's an >> internal-only project. > > I need to correct this: It's not installed

nosepipe error

2016-02-23 Thread Dan Stromberg
) 'Unha' ...but I'm not sure where to go with that from there. The authors appear to be: John J. Lee, Dan McCombs, and Vadim Markovtsev. I've e-mailed John and Dan - though that was only last night. I don't know how to get in touch with Vadim. Are there any nosepipe users

Re: nosepipe error

2016-02-23 Thread Dan Stromberg
On Tue, Feb 23, 2016 at 9:43 AM, Chris Angelico wrote: > On Wed, Feb 24, 2016 at 4:36 AM, Dan Stromberg wrote: >> Message: Unhandled exception in thread started by >> sys.excepthook is missing >> lost sys.stderr >> >> That 1433299041 looks like ASCII: >

"from module import data; print(data)" vs "import module; print(module.data)"

2016-02-24 Thread Dan Stromberg
Could people please compare and contrast the two ways of doing imports in the Subject line? I've long favored the latter, but I'm working in a code base that prefers the former. Is it fair to say that the former increases the surface area of your shared (sometimes mutable) state? It's clear that

Re: "from module import data; print(data)" vs "import module; print(module.data)"

2016-02-25 Thread Dan Stromberg
On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano wrote: > On Thursday 25 February 2016 12:07, Dan Stromberg wrote: > >> Could people please compare and contrast the two ways of doing imports >> in the Subject line? > > from module import data; print(data) > &g

Re: "from module import data; print(data)" vs "import module; print(module.data)"

2016-02-25 Thread Dan Stromberg
On Thu, Feb 25, 2016 at 8:15 AM, Dan Stromberg wrote: > On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano > wrote: >> On Thursday 25 February 2016 12:07, Dan Stromberg wrote: >> >>> Could people please compare and contrast the two ways of doing imports >>&g

Re: Testing whether the VPN is running?

2016-02-25 Thread Dan Stromberg
On Thu, Feb 18, 2016 at 1:45 AM, Ervin Hegedüs wrote: > Hi Adam, > > On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: >> I'd like to test (inside a python 3 program) whether the VPN is >> running or not. The only thing I can think of so far is to use >> subprocess to run the 'ifconfig'

Re: How to read from a file to an arbitrary delimiter efficiently?

2016-02-27 Thread Dan Sommers
On Sat, 27 Feb 2016 21:40:17 +1100, Steven D'Aprano wrote: > Thanks for finding the issue, but the solutions given don't suit my > use case. I don't want an iterator that operates on pre-read blocks, I > want something that will read a record from a file, and leave the file > pointer one entry pas

RE:

2016-03-01 Thread Dan Strohl
ent everything exactly, that is a really stupid design!", that, I suspect would get a really good argument going! In any case, responding to your *actual* statement, good luck with finding co-workers that you can work with, I know how frustrating it can be not liking your co-workers. Dan

Re: [Still off-top] Physics [was Requests author discusses MentalHealthError exception]

2016-03-04 Thread Dan Sommers
On Fri, 04 Mar 2016 12:38:28 +0200, Marko Rauhamaa wrote: > As for the existence of a negative mass, it is interesting to note > that the (rest) mass of an alpha particle is less than the sum of the > (rest) masses of its constituents. About 1% of the mass is "missing." https://en.wikipedia.org/w

Re: WP-A: A New URL Shortener

2016-03-19 Thread Dan Sommers
On Thu, 17 Mar 2016 23:08:24 +1100, Chris Angelico wrote: > So you would need to come up with a system that's distributed (such > that one computer's inaccessibility doesn't bring everything down) and > permanent (keep on circulating that information!). It could be a > rather fun problem to tackle

Re: Why do you use python?

2016-03-20 Thread Dan Sommers
On Mon, 21 Mar 2016 15:13:22 +1100, Chris Angelico wrote: > On Mon, Mar 21, 2016 at 2:59 PM, wrote: >> instead, to be efficient, it is best to combine tools to solve >> problems that contain complexities where there is nothing available >> off the shelve that does the job. c# is free, free VS s

Re: List of Functions

2016-03-28 Thread Dan Sommers
On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote: > As for Python, I don't feel a great need for anonymous functions. > However, I keep running into a need for anonymous classes, or, rather, > classless objects. Not a biggie. I just create a one-off inner class > and instantiate it, but I

Re: (test) ? a:b

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 2:05 AM, wrote: > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: >> Hello >> >> >> >> Is there in Python something like: >> >> >> >> j = (j >= 10) ? 3 : j+1; >> >> >> >> as in C language ? >> >> >> >> thx > > without not: > j = [j+1, 3][j>=10] > w

Re: When to use assert

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 9:01 AM, Chris Angelico wrote: > On Thu, Oct 23, 2014 at 2:49 AM, Steven D'Aprano > wrote: >> Chris Angelico wrote: > I agree that the assert is preferable to the comment. But maybe my > level of paranoia is just lower than most people's, as I wouldn't > bother checking th

Re: (test) ? a:b

2014-10-24 Thread Dan Stromberg
On Fri, Oct 24, 2014 at 1:38 AM, Steven D'Aprano wrote: > I don't get why that's considered hard to read. > So why is it hard to read when the index is a flag? > > value = [f, g][cond]() It's clear to you, it's clear to me, but is it clear to everyone? I very much doubt it. Also, you've gone t

Re: Status of side-effecting functions in python

2014-10-25 Thread Dan Sommers
ctions. These days, we have Python's threading.Lock.acquire. Dan -- https://mail.python.org/mailman/listinfo/python-list

<    8   9   10   11   12   13   14   15   16   17   >