Re: why no arg, abs methods for comlex type?

2005-08-05 Thread Dan Sommers
More OO, yes. More readable, not IMO. > I would also like to see some more functions to make > calculations with complex number more convenient [ ... ] > maybe there exists some proposals aiming this goal? SciPy or Numeric? Regards, Dan -- Dan Sommers <http://www.tombstoneze

Re: Fat and happy Pythonistas (was Re: Replacement for keyword 'global' good idea? ...)

2005-08-06 Thread Dan Sommers
are permutations of configuration options in the text formatter. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Wheel-reinvention with Python

2005-08-06 Thread Dan Sommers
ow about HTML? Except for toasters, almost every computing device sold these days contains an HTML interpreter, and a great deal of embedded systems create HTML and use HTTP as an administrative interface. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Does FTPLIB have a 'local change directory' ?

2005-08-06 Thread Dan Sommers
On Sun, 07 Aug 2005 01:28:31 GMT, "python newbie" <[EMAIL PROTECTED]> wrote: > I'd like to be able to first > ftplib.lcd( "c:\myfiles\morefiles" ) > and then just > storbinary( picture.gif .. ). > But the python doc doesn't show any L

Re: How to determine that if a folder is empty?

2005-08-08 Thread Dan Sommers
t* imply others. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: don't understand instanse creation

2005-08-09 Thread Dan Sommers
bove line creates a new instance attribute __data1, and binds it to a copy of __data2. > print "__data1: ", self.__data1 > print "__data2: ", self.__data2 [ example snipped ] HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Spaces and tabs again

2005-08-13 Thread Dan Sommers
lash, Python 4.0 will ban leading spaces and require > tabs Why not petition the unicode people to include PYTHON INDENT and PYTHON DEDENT code points, and leave the display up to the text editors? ;-) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for presence of arguments

2005-08-17 Thread Dan Sommers
vateClass: print "required_argument was probably not present" else: print "required_argument was present" It's not impossible fool f, but an external module has to try very hard to do so. (All code untested.) Regards, Dan -- Dan Sommers <

Re: Module Name Conflicts

2005-08-18 Thread Dan Sommers
fix_sys_path_to_find_python_cmd_first() import cmd as python_cmd Obviously, then, 'cmd' does not reference either module; you'd have to use java_cmd and python_cmd as appropriate. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Module Name Conflicts

2005-08-18 Thread Dan Sommers
On Thu, 18 Aug 2005 16:46:42 -0700, Robert Kern <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: [ something that obviously doesn't work ] > That doesn't work. The first module is recorded as 'cmd' in > sys.modules and gets reused on the second import. Yes, y

Re: stdin -> stdout

2005-08-19 Thread Dan Sommers
On Fri, 19 Aug 2005 15:26:27 GMT, "max(01)*" <[EMAIL PROTECTED]> wrote: > ps: in perl you ca do this: > ... > while ($line = ) >{ > print STDOUT ("$line"); >} > ... import fileinput import sys for line in fileinput.input(): sys.st

Re: List of integers & L.I.S.

2005-09-07 Thread Dan Sommers
y # ascending and also pruning sequences that obviously can't "win" It's not much to go on, but that bit after the ";" is the algorithm I use. I can't tell you how fast it runs in big-O notation, but my old 500 MHz PowerMac G4 digested lists of tens or hundre

Access to formatting controls from within __repr__ or __str__?

2005-02-17 Thread Dan Sommers
on of "set output format" methods is possible, but that solution makes me cringe. Thank you, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Never play leapfrog with a unicorn. -- http://mail.python.org/mailman/listinfo/python-list

Re: Access to formatting controls from within __repr__ or __str__?

2005-02-18 Thread Dan Sommers
On 18 Feb 2005 01:25:06 -0800, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> So my question is: Is there a way to pass options "through" a format >> string to the __str__ and __repr__ functions? For example, can I >>

Re: python2.4 generator expression > python2.3 list expression

2005-02-21 Thread Dan Sommers
. My algorithm is less clear at first glance (and even second and third glance), but nearly idiomatic to those of us who spent lots of time writing embedded assembly code. If you have the space to spare, a lookup table (pre-calculated or created during your program's initial

Re: python2.4 generator expression > python2.3 list expression

2005-02-22 Thread Dan Sommers
the "+=" operator over those same bits again. Make that *three* sets of bits. I stand humbled. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: how to interrupt time.sleep ?

2005-02-22 Thread Dan Sommers
t; > If it can't be canceled what's the other solution to > "wait certain time/or press any button to continue" problem ? Use the select module. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: accessor/mutator functions

2005-02-28 Thread Dan Sommers
27;s my basic thought process. Sorry about the rant. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: accessor/mutator functions

2005-02-28 Thread Dan Sommers
On Mon, 28 Feb 2005 23:08:04 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote: > On Mon, 28 Feb 2005 15:50:22 -0500, Dan Sommers wrote: >> The reason their code is so inflexible is that they've filled their >> classes with boiler plate get/set methods. >> >> Wh

Re: accessor/mutator functions

2005-02-28 Thread Dan Sommers
On Tue, 01 Mar 2005 01:39:13 +0100, Thomas Lotze <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> I think I'd add a change_temperature_to method that accepts the >> target temperature and some sort of timing information, depending on >> how the rest of the pro

Re: accessor/mutator functions

2005-02-28 Thread Dan Sommers
On Tue, 01 Mar 2005 02:27:03 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote: > Me: >>> What's wrong with the use of attributes in this case and how >>> would you write your interface? > Dan Sommers: >> I think I'd add a change_temperature_to method t

Re: accessor/mutator functions

2005-03-01 Thread Dan Sommers
e time, and we think it came down to the particular (ab)uses of C++ involved. > Really, of course, the only things you need to make explicit are the > ones that readers don't understand :-) +1 QOTW We used to have holy wars over the appropriate level of comments i

Re: accessor/mutator functions

2005-03-01 Thread Dan Sommers
uld probably be done through a defined interface. I wish I'd said it that well in the first place myself. :-) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

[OT] Who Knows of a Good Computational Physics Textbook?

2005-03-13 Thread Dan Sommers
aspects of the course. If you know of some place I can go in order to find the right questions to ask (and possibly the right place to ask them!), then don't be afraid to let me know that, too. Thanks, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c =

Re: [OT] Who Knows of a Good Computational Physics Textbook?

2005-03-16 Thread Dan Sommers
Thank you beliavsky, Sean, and Scott for the pointers. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Dan Sommers
er came up. I'm not sure how to separate the two cases (accumulating scalars vs. accumulating a list), though. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Dan Sommers
On Sat, 19 Mar 2005 15:17:59 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > [Dan Sommers] >> Curious that in this lengthy discussion, a method name of >> "accumulate" never came up. I'm not sure how to separate the two >> cases (a

Re: database questions ala newbie pythonist

2004-12-02 Thread Dan Sommers
theory, already been debugged). See also PEP 249, <http://www.python.org/peps/pep-0249.html>. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Never play leapfrog with a unicorn. -- http://mail.python.org/mailman/listinfo/python-list

Re: DB-API format string conventions

2004-12-28 Thread Dan Sommers
OH, I am a very big fan of the cohesion and layering concepts I learned from years and years of structured programming, and a lot of my ideas of what should be separate from what have fallen by the wayside. > So ... anybody for a DB-API 2.1 with mandatory pyformat support and

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-29 Thread Dan Sommers
tty sure that  and  were guillmots, but google sure > preferred the sea bird when I asked it. They're guillemets (with an "e"); this is a [relatively] well-known Adobe SNAFU. (A quick google search or two failed to find an authoritative reference, but I know that such references are o

Re: Version Number Comparison Function

2005-03-25 Thread Dan Sommers
>> '3.2.2' < '3.4' True >>> Beyond that, there seems to be sufficient variation between version number schemes, and something "interesting" often happens immediately before the final version (e.g. "1.0rc4" becomes "1.0"), that yo

Re: Are circular dependencies possible in Python?

2005-04-09 Thread Dan Sommers
d function > B could call function A - or is that not possible? Perhaps if you can post a minimal example that shows us what you're running into, someone here will know how to help. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a very specific type of embedded GUI kit

2005-04-12 Thread Dan Sommers
on/howto/curses/>. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Slight discrepancy with filecmp.cmp

2005-04-18 Thread Dan Sommers
out your wife's eyes debugging your brain, but since I would like to remain married, I will not make it. :-/ Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to "generalize" a function?

2005-04-24 Thread Dan Sommers
hey may mean something to you and to people who read your program, but they mean nothing to Python. So just use generic names: for line in conf: if regex.search( line ) theLine = line theLineNum = conf.index( theLine ) etc. HTH, Dan -- Dan Sommers <http://www.to

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

2013-12-03 Thread Dan Sommers
On Wed, 04 Dec 2013 09:34:13 +0800, Zhang Weiwu wrote: > Why would anyone use [logging.config.listen()]? I can't think of use > cases when one need to change logging configuration dynamically > through socket, but not needing the same flexibility on overall > configuration for his application (con

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/mailman/listinfo/pyt

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Dan Sommers
On Tue, 21 Jan 2014 10:32:13 +, Oscar Benjamin wrote: > ... When you set assignments the students will usually learn more if > they work in groups. However at some point you need to try and assess > how much they've individually learned. I find in practice that it's > easy to tell when a stude

Re: Case insensitive exists()?

2014-01-22 Thread Dan Sommers
On Wed, 22 Jan 2014 18:18:32 -0700, Larry Martell wrote: > The issue is that I run a database query and get back rows, each with > a file path (each in a different dir). And I have to check to see if > that file exists. Each is a separate search with no correlation to the > others. I have the full

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

2014-01-27 Thread Dan Sommers
On Mon, 27 Jan 2014 10:23:49 -0600, Zachary Ware wrote: >> Understood, except that some parameters take multiple elements...thus >> why I manually reference the indexes. > > Try this on for size, then: > > a_iter = iter(a) > for arg in a_iter: > print('current', arg) > if arg == '-#': >

Re: Another surprise from the datetime module

2014-01-30 Thread Dan Sommers
On Fri, 31 Jan 2014 11:35:14 +1100, Ben Finney wrote: > However, the existing ‘replace’ methods ‘datetime.date.replace’, > ‘datetime.datetime.replace’, ‘datetime.time.replace’ already work this > way: they create a new value and return it, without modifying the > original object. That's how str.r

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
On Wed, 05 Feb 2014 19:02:09 -0800, msustik wrote: > My changes were elsewhere and I did not notice the above one line > change when I looked at the diffs before commit. I should have noticed > it... > > It was rare that a was 1 and therefore the problem did not show up for > a while. (I know I s

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: 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: [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: Status of side-effecting functions in python

2014-10-25 Thread Dan Sommers
On Sat, 25 Oct 2014 23:41:52 +0200, Wolfgang Maier wrote: > ... It may be rare to use an expression both for its side-effects and > its return value ... A lot of concurrency-related operations work that way. In the old days, it was CPU-level Test and Set (or Compare and Set) instructions. These

Re: Status of side-effecting functions in python

2014-10-26 Thread Dan Sommers
On Sun, 26 Oct 2014 00:45:49 -0700, wxjmfauth wrote: > Ditto for .write(). Why should it return "something" ? > with open('z.txt', 'w') as f: > ... f.write('abc') > ... > 3 OTOH, why shouldn't it return something? In this case, it returns the length of the string written. This va

Re: Classes

2014-11-02 Thread Dan Sommers
On Mon, 03 Nov 2014 03:12:32 +, Denis McMahon wrote: > Quadrilateral > Parallelogram > Square > Rectangle > Rhombus > Diamond (4 sides eq) > Trapezoid > Arrowhead What's the difference between a Diamond and a Rhombus? > Is an arrowhead a trapez

Re: I have no class

2014-11-24 Thread Dan Sommers
On Mon, 24 Nov 2014 16:11:32 +1100, Chris Angelico wrote: > On Mon, Nov 24, 2014 at 3:21 PM, Steven D'Aprano wrote: >> On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote: >> >>> Python is a bit odd in the OO-world in that it prioritizes "Explicit is >>> better than implicit" over convenience.

Re: dict turn to list unexpected at runtime???

2014-12-04 Thread Dan Sommers
On Fri, 05 Dec 2014 15:01:51 +0800, telnetgm...@gmail.com wrote: > Why the following code gives me errors??? And why the print statement run 2 > times? ... > addrnum_dict = {'a':1,'b':2} > def orderaddrtimes(): > global addrnum_dict > print type(addrnum_dict) > > addrnum_dict = sorte

Re: Logger not logging

2015-01-01 Thread Dan Sommers
On Thu, 01 Jan 2015 10:09:13 -0700, Jason Friedman wrote: > What am I missing? > > I expect logger.info("hello") to emit. > > $ python > Python 3.4.0 (default, Apr 18 2014, 19:16:28) > [GCC 4.8.1] on linux > Type "help", "copyright", "credits" or "license" for more information. import loggi

Re: Generate jpg files using line length (pixels) and orientation (degrees)

2015-01-09 Thread Dan Sommers
> Unfortunately getting a new error. > > Traceback (most recent call last): > File "C:\Users\Owner\Desktop\Stimuli Generation\Coordinates\Generate_w > corr.py", line 68, in > makeimg(length, orientation) > File "C:\Users\Owner\Desktop\Stimuli Generation\Coordinates\Generate_w > corr.py

Re: PyWart: Poor Documentation Examples

2015-01-11 Thread Dan Sommers
; expresses "automaton accepts string s" > > Should that go into the doc?? Absolutely. :-) If the docs had explained that reduce is actually a finite state machine framework, then I wouldn't have written my such framework. > I'll leave that to somebody else whose

Re: How can i use a dictionnary

2015-01-13 Thread Dan Sommers
On Tue, 13 Jan 2015 06:56:11 -0800, Novocastrian_Nomad wrote: > On Tuesday, January 13, 2015 at 2:03:30 AM UTC-7, brice DORA wrote: >> i consume a web service that return a element whose the type is >> "instance". but this element seem be a dictionary but when i want to >> use it like a dictionar

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Dan Sommers
On Sat, 17 Jan 2015 18:44:42 +, Grant Edwards wrote: > ... somebody who only knows how to write C++ [though he can do it in > several different languages]. +1 QOTW (brilliant phrases in other threads are off topic and are disqualified) I have also suffered through such maintenance, but I hav

Re: Benchmarking some modules - strange result

2015-01-25 Thread Dan Sommers
On Sun, 25 Jan 2015 13:24:40 +0100, Peter Otten wrote: > Dan Stromberg wrote: > >> I've been benchmarking some python modules that are mostly variations >> on the same theme. >> >> For simplicity, let's say I've been running the suite of performance >> tests within a single interpreter - so I te

Re: Python is DOOMED! Again!

2015-01-26 Thread Dan Sommers
On Tue, 27 Jan 2015 11:11:45 +1100, Steven D'Aprano wrote: > random...@fastmail.us wrote: >> (header files in the 1970s didn't even actually include function >> signature information) - which did not even participate in >> compilation at all. > If C compilers didn't use the header files, what we

Re: What behavior would you expect?

2015-02-19 Thread Dan Sommers
On Fri, 20 Feb 2015 07:11:13 +1100, Chris Angelico wrote: > On Fri, Feb 20, 2015 at 7:03 AM, Denis McMahon > wrote: >> On the one hand, the return type of a function (when it returns, >> rather than raising an exception) should be consistent to itself, >> even if using a language where types are

Re: What behavior would you expect?

2015-02-19 Thread Dan Sommers
On Fri, 20 Feb 2015 16:16:50 +1100, Chris Angelico wrote: > On Fri, Feb 20, 2015 at 3:54 PM, Dan Sommers wrote: >> if there are no >> values to return, then return an empty collection. > > That one makes sense only if you were going to return a collection > anyway, thou

Re: What behavior would you expect?

2015-02-19 Thread Dan Sommers
On Thu, 19 Feb 2015 22:51:57 -0700, Jason Friedman wrote: >> >> I'd still advise using my_list.sort() rather than sorted(), as you >> don't need to retain the original. >> >> > Hmm. > > Trying to figure out what that looks like. > If I understand correctly, list.sort() returns None. > What would

Re: Python programming

2014-02-12 Thread Dan Sommers
On Wed, 12 Feb 2014 22:56:56 -0500, William Ray Wing wrote: > OK, and how many of you remember the original version of the > tongue-in-cheek essay "Real Programmers Don't Use Pascal" from the > back page of Datamation? And the April issue of Compubyte (or something like that) with a cover showing

Re: exec and locals

2014-02-26 Thread Dan Sommers
On Thu, 27 Feb 2014 00:25:45 +, Steven D'Aprano wrote: > By the way, if anyone cares what my actual use-case is, I have a > function that needs to work under Python 2.4 through 3.4, and it uses > a with statement. With statements are not available in 2.4 (or 2.5, > unless you give a from __fut

Re: Python programming

2014-03-05 Thread Dan Sommers
On Wed, 05 Mar 2014 20:19:56 -0800, Beowulf wrote: > Once you master one language it is easy to understand other ... Once you master one language, the next one is hard. After that, they get easier. -- https://mail.python.org/mailman/listinfo/python-list

Re: How is unicode implemented behind the scenes?

2014-03-08 Thread Dan Sommers
On Sun, 09 Mar 2014 03:50:49 +, Steven D'Aprano wrote: > ... UTF-16 ... the letter "A" is stored as two bytes 0x0041 (or 0x4100 > depending on your platform's byte order) ... At the risk of being pedantic, the two bytes are 0x00 and 0x41, and the order in which they appear in memory depends o

Re: Github down?

2014-03-21 Thread Dan Sommers
On Fri, 21 Mar 2014 14:51:54 +0100, Chris “Kwpolska” Warrick wrote: > (though GitHub could qualify as social media for some…) +1 QOTW -- https://mail.python.org/mailman/listinfo/python-list

Re: YADTR (Yet Another DateTime Rant)

2014-03-26 Thread Dan Sommers
On Thu, 27 Mar 2014 00:16:57 +, Steven D'Aprano wrote: > py> divmod(-30, 24) > (-2, 18) > > If an event happened 30 hours ago, it is correct to say that it > occurred "18 hours after 2 days ago", but who talks that way? Well, not *exactly*, but: If today happens to be Wednesday, and an even

Re: Python to be replaced by the new language called Cookie !

2014-04-01 Thread Dan Sommers
On Wed, 02 Apr 2014 02:19:38 +1100, Chris Angelico wrote: > These improvements are absolutely critical to the language, and should > be made in Python 2.5.7, 2.6.9, and 3.0.2. Anyone using a newer > version of Python is paying the price for early adoption, and should > back-level immediately to a

Re: how to insert the elements in a list properly?

2014-04-09 Thread Dan Sommers
On Wed, 09 Apr 2014 21:09:37 +0800, length power wrote: > words = ["x1", "x2", "x3", "x4", "x5"] > words.append(words.pop(2)) > words.append(words.pop(2)) > words > ['x1', 'x2', 'x5', 'x3', 'x4'] > why i can't write it as: > > [words.append(words.pop(2)) for i in range(0,2)] > [words.append

Re: The “does Python have variables?” debate

2014-05-07 Thread Dan Sommers
On Thu, 08 May 2014 01:27:08 +, Steven D'Aprano wrote: > If I have understood correctly, and I welcome confirmation or > correction, one can have any combination of: > * dynamic typing and name binding (e.g. Python and Ruby); > * static typing and name binding (e.g. Java); > * dynamic typing

Re: hashing strings to integers

2014-05-27 Thread Dan Sommers
On Tue, 27 May 2014 17:02:50 +, Steven D'Aprano wrote: > - rather than "zillions" of them, there are few enough of them that > the chances of an MD5 collision is insignificant; > (Any MD5 collision is going to play havoc with your strategy of > using hashes as a proxy for the real string

[OT] Re: Is MVC Design Pattern good enough?

2014-06-01 Thread Dan Sommers
On Sun, 01 Jun 2014 10:37:24 -0700, Ernest Bonat, Ph.D. wrote: > ... MVC design pattern ... defined the Model layer as the data > management of the application domain and business logic implementation > ... Can we implement the application business logic in another layer? > Yes or no? Why? Explai

Re: new to While statements

2013-08-06 Thread Dan Sommers
On Wed, 07 Aug 2013 07:20:28 +0200, Vito De Tullio wrote: > Joshua Landau wrote: > > >> while "asking for reponse": > >> while "adventuring": > > that's a funny way to say `while True:`... Funny, perhaps, the first time you see it, but way more informative than the other way t

Re: new to While statements

2013-08-06 Thread Dan Sommers
On Tue, 06 Aug 2013 22:42:42 -0700, snakeinmyboot wrote: > I wish I understood half of what you posted Dan. Time to hit the books So think about the "while" statement: it takes an expression (the part before the colon) and a suite (the part after the colon and before the next statement at the sa

pydoc vs. non-def'd methods

2013-08-21 Thread Dan Sommers
Greetings, I'm hava a class in which there are two equally useful names for one method. Consider this design (there are other approaches, but that's not what my question is about): class Spam1: def eggs(self): '''Return the Meaning of Life.''' return 42 ham = eggs help

Re: pydoc vs. non-def'd methods

2013-08-22 Thread Dan Sommers
On Thu, 22 Aug 2013 06:39:48 +, Steven D'Aprano wrote: > On Thu, 22 Aug 2013 05:13:03 +0000, Dan Sommers wrote: >> class Spam1: >> >> def eggs(self): >> '''Return the Meaning of Life.''' >> return 42 >

Re: user interfaces python3.x

2013-09-02 Thread Dan Sommers
On Mon, 02 Sep 2013 16:08:04 +, Steven D'Aprano wrote: > (If you think text is not a proper interface, you're going to have a > bad time as a programmer. 99% of your programming time will be > writing.) I'm a programmer, and I spend way more than 1% of my programming time drawing, even taking

Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-05 Thread Dan Sommers
On Sun, 06 Oct 2013 12:19:13 +1100, Chris Angelico wrote: > On Sun, Oct 6, 2013 at 12:05 PM, Ben Finney wrote: [ ... ] >> With a separately-installed, far more complex database engine like >> MySQL or PostgreSQL, the Python bindings will only work if they are >> compiled against the correct clie

Re: Python Front-end to GCC

2013-10-25 Thread Dan Sommers
On Fri, 25 Oct 2013 04:55:43 -0700, Mark Janssen wrote: > On Thu, Oct 24, 2013 at 8:40 PM, Mark Lawrence > wrote: >> On 22/10/2013 18:37, Oscar Benjamin wrote: >>> OTOH why in particular would you want to initialise them with zeros? >>> I often initialise arrays to nan which is useful for debug

Re: Python Worst Practices

2015-02-27 Thread Dan Sommers
On Sat, 28 Feb 2015 12:09:31 +1100, Steven D'Aprano wrote: > There's no harm in calling a local variable "id", if you don't use the > built-in id() inside that function. That's one of the reasons why functions > exist, so that the names you use inside a function are distinct from those > outside.

Re: Python Worst Practices

2015-02-27 Thread Dan Sommers
On Sat, 28 Feb 2015 17:36:44 +1100, Steven D'Aprano wrote: > Dan Sommers wrote: >> And thank goodness for that! I've been writing Python code since >> 1997 and version 1.5.,¹ and I still do a double take when >> emacs colors all my ids that faint blue that means &

Re: Newbie question about text encoding

2015-03-07 Thread Dan Sommers
On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote: > On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote: >> Correct. Linux pathnames are octet strings regardless of the locale. >> >> That's why Linux developers should refer to filenames using bytes. >> Unfortunately, Python itself viola

Re: Newbie question about text encoding

2015-03-07 Thread Dan Sommers
On Sun, 08 Mar 2015 05:13:09 +1100, Chris Angelico wrote: > On Sun, Mar 8, 2015 at 5:02 AM, Dan Sommers wrote: >> On Sun, 08 Mar 2015 04:59:56 +1100, Chris Angelico wrote: >> >>> On Sun, Mar 8, 2015 at 4:50 AM, Marko Rauhamaa wrote: >> >>>> Correct. Li

Re: Newbie question about text encoding

2015-03-07 Thread Dan Sommers
On Sat, 07 Mar 2015 19:00:47 +, Mark Lawrence wrote: > Isn't pathlib > https://docs.python.org/3/library/pathlib.html#module-pathlib > effectively a more recent attempt at smoothing or even removing (some > of) the bumps? Has anybody here got experience of it as I've never > used it? I almos

Re: Auto-completion of Unicode names [was why not module name?]

2015-03-17 Thread Dan Sommers
On Wed, 18 Mar 2015 10:29:53 +1100, Steven D'Aprano wrote: > Speaking of tab completion, would anyone be interested in being able > to auto-complete \N{...} unicode character names? I'm considering that > as an enhancement to my tabhistory module. Only if it's fuzzy. One use case is that "openin

Re: Brilliant or insane code?

2015-03-17 Thread Dan Sommers
On Wed, 18 Mar 2015 00:35:42 +, Mark Lawrence wrote: > I've just come across this > http://www.stavros.io/posts/brilliant-or-insane-code/ as a result of > this http://bugs.python.org/issue23695 > > Any and all opinions welcomed, I'm chickening out and sitting firmly > on the fence. According

Re: Brilliant or insane code?

2015-03-17 Thread Dan Sommers
On Wed, 18 Mar 2015 13:25:45 +1100, Steven D'Aprano wrote: > On Wednesday 18 March 2015 12:14, Dan Sommers wrote: >> According to the article itself, "it relies in an implementation >> detail (the order the zip function iterates over the arrays) to >> work."

Re: New to Python - block grouping (spaces)

2015-04-17 Thread Dan Sommers
On Fri, 17 Apr 2015 18:05:52 +0100, BartC wrote: > (Actually *I* would quite like to know why languages don't have > switchable syntax anyway to allow for people's personal preferences.) You want LISP, the programmable programming language. -- https://mail.python.org/mailman/listinfo/python-list

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Dan Sommers
On Sun, 19 Apr 2015 09:03:23 -0700, Rustom Mody wrote: > Now if Thomson and Ritchie (yeah thems the guys) could do it in 1970, > why cant we revamp this 45-year old archaic program=textfile system > today? Revamp? What's to revamp? C, C++, C#, Java, FORTRAN, Python, Perl, Ruby, POSIX shells, Ja

Re: Python xlrd

2015-05-03 Thread Dan Sommers
On Sun, 03 May 2015 10:33:25 -0700, lbertolotti wrote: > lucas@lucas-K55VD:~$ dpkg -l python-xlrd > Desired=Unknown/Install/Remove/Purge/Hold > | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend > |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) > ||/ Name

Re: Throw the cat among the pigeons

2015-05-06 Thread Dan Sommers
On Wed, 06 May 2015 09:12:05 -0400, Dave Angel wrote: > Remember the days when you knew how many cycles each assembly > instruction took, and could simply add them up to compare algorithms? I do! I do! :-) And then the MC68020 came out, and instruction execution overlapped in weird (but predic

Re: Camelot a good tool for me

2015-05-22 Thread Dan Sommers
On Fri, 22 May 2015 09:59:02 +0200, Cecil Westerhof wrote: > Would Camelot be a good tool to get me started, or can I better bite > the bullet and just start with Tkinter and SQLAlchemy? Bite the bullet and learn SQL. SQLAlchemy -> Database :: Python -> Assembly Language. HTH, Dan -- https://m

Re: Most Pythonic way to store (small) configuration

2015-08-02 Thread Dan Sommers
On Sun, 02 Aug 2015 16:11:14 -0500, Tim Chase wrote: > On 2015-08-02 21:54, Ben Finney wrote: >> So, both XML and JSON should be considered write-only, and produced >> only for consumption by a computer; they are a poor choice for >> presenting to a human. [snip] > I second Ben's thoughts again

<    1   2   3   4   5   >