Re: the Gravity of Python 2

2014-01-09 Thread Tim Golden
On 09/01/2014 16:30, Mark Lawrence wrote: > On 09/01/2014 16:21, Roy Smith wrote: >> >> No, it would be solved by a built-in method. Recipes are a cop-out. >> If something is complicated enough to require a recipe, and used >> frequently enough to be worth writing that recipe up and documenting >

Re: Python Fast I/o

2014-01-14 Thread Tim Chase
On 2014-01-14 05:50, Ayushi Dalmia wrote: > I need to write into a file for a project which will be evaluated > on the basis of time. What is the fastest way to write 200 Mb of > data, accumulated as a list into a file. > > Presently I am using this: > > with open('index.txt','w') as f: > f

Re: Printer list value problem

2014-01-14 Thread Tim Chase
On 2014-01-14 11:24, Mike wrote: > Hello, > I confudsed,need printer the value of list (this is reaer from > csv) . The reader is ok, but my problem is in the print moment > because printer only the last value. For example my csv is: > > [] > us...@example.com;user1;lastName;Name > us...@e

Re: dictionary with tuples

2014-01-14 Thread Tim Chase
On 2014-01-14 13:10, Igor Korot wrote: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more > information. > >>> dict = {} > >>>

Re: Chanelling Guido - dict subclasses

2014-01-15 Thread Tim Chase
On 2014-01-15 01:27, Steven D'Aprano wrote: > class TextOnlyDict(dict): > def __setitem__(self, key, value): > if not isinstance(key, str): > raise TypeError > super().__setitem__(key, value) > # need to override more methods too > > > But reading Guido, I thin

Re: Python declarative

2014-01-15 Thread Tim Chase
On 2014-01-16 10:09, Chris Angelico wrote: > myWindow = Window( > title="Hello World", > children=[Button( > label="I'm a button", > onClick=exit > )] > ) This also solves the problem that **kwargs are just a dict, which is inherently unordered. So with the previo

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Tim Chase
On 2014-01-16 14:07, Steven D'Aprano wrote: > The unicode type in Python 2.x is less-good because: > > - it is missing some functionality, e.g. casefold; Just for the record, str.casefold() wasn't added until 3.3, so earlier 3.x versions (such as the 3.2.3 that is the default python3 on Debian St

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 05:06, Chris Angelico wrote: > > You might want to add the utf8 bom too: '\xEF\xBB\xBF'. > > I'd actually rather not. It would tempt people to pollute UTF-8 > files with a BOM, which is not necessary unless you are MS Notepad. If the intent is to just sniff and parse the file acco

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a hundred JPEGs named P001.jpg, P002.jpg, P003.jpg etc. I need to write a python script that

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:50, vasishtha.sp...@gmail.com wrote: On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: The usual go-to library for PDF generation is ReportLab. I haven't used it for a long while but I'm quite certain it would have no problem including images. Do

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 20:07, Tim Golden wrote: This should walk down the Python directory, s/the Python directory/some directory/ (Sorry, I initially had it walking os.path.dirname(sys.executable)) TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread Tim Chase
On 2014-01-17 00:24, Nac Temha wrote: > Hi everyone, > > I want to do operation with chars in the given string. Actually I > want to grouping the same chars. > > For example; > > input : "3443331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "34131237" > > How can

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 11:14, Chris Angelico wrote: > UTF-8 specifies the byte order > as part of the protocol, so you don't need to mark it. You don't need to mark it when writing, but some idiots use it anyway. If you're sniffing a file for purposes of reading, you need to look for it and remove it from

Re: Converting folders of jpegs to single pdf per folder

2014-01-17 Thread Tim Golden
On 17/01/2014 05:42, vasishtha.sp...@gmail.com wrote: > On Thursday, January 16, 2014 12:07:59 PM UTC-8, Tim Golden wrote: >> >> Here's a quick example. This should walk down the Python directory, >> creating a text file for each directory. The textfile will contain >

Re: Converting folders of jpegs to single pdf per folder

2014-01-17 Thread Tim Golden
On 17/01/2014 05:42, vasishtha.sp...@gmail.com wrote: > try: > n = 0 > for dirpath, dirnames, filenames in os.walk(root): > PdfOutputFileName = os.path.basename(dirpath) + ".pdf" > c = canvas.Canvas(PdfOutputFileName) > if n > 0 : >for filena

Re: Python 3.x adoption

2014-01-17 Thread Tim Chase
On 2014-01-17 15:27, Grant Edwards wrote: > > What's wrong?... > > Python 2.7 still does everything 99% of us need to do, and we're too > lazy to switch. And in most distros, typing "python" invokes 2.x, and explicitly typing "python3" is almost 17% longer. We're a lazy bunch! :-) -tkc --

Re: Guessing the encoding from a BOM

2014-01-17 Thread Tim Chase
On 2014-01-17 09:10, Mark Lawrence wrote: > Slight aside, any chance of changing the subject of this thread, or > even ending the thread completely? Why? Every time I see it I > picture Inspector Clouseau, "A BOM!!!" :) In discussions regarding BOMs, I regularly get the "All your base" meme from

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-17 Thread Tim Delaney
d obtain the data in an unambiguous manner to verify against my parser. The only way to truly protect code is to not ship any version of it (compiled or otherwise), but have the important parts hosted remotely under your control (and do your best to ensure it doesn't become compromised). Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: Python declarative

2014-01-18 Thread Tim Roberts
27;s a huge difference. If you want your layout to BE Python code, then you have little alternative except to use the suggestions offered. But if you simply want your scripts to be interpreted by a Python program, then you can do whatever you want. -- Tim Roberts, t...@probo.com Providenza &

Re: numpy.where() and multiple comparisons

2014-01-18 Thread Tim Roberts
p; (a > 7) works because numpy.array has an override for the "&" operator. So, that expression is compiled as numpy.array.__and__( numpy.array.__lt__(2, a), numpy.array.__lt__(a, 7) ) As Peter said, there's no way to override the "and" operator. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

Re: Early retirement project?

2014-01-21 Thread Tim Chase
On 2014-01-21 00:00, xeysx...@gmail.com wrote: > Well, I retired early, and I guess now I've got some spare time to > learn about programming, which always seemed rather mysterious. I > am using an old mac as my main computer, and it runs os x 10.4 is > this too old? It fills my needs, and I am on

Re: import file without .py into another module

2014-01-21 Thread Tim Chase
On 2014-01-21 07:13, kevinber...@gmail.com wrote: >On Tuesday, January 21, 2014 10:06:16 AM UTC-5, MRAB wrote: >> configModuleObject = imp.load_source(fileName, filePath) >> >> imports the module and then binds it to the name >> configModuleObject, >> >> therefore: >> >> print configMod

Re: Separate Address number and name

2014-01-21 Thread Tim Chase
On 2014-01-22 02:46, John Gordon wrote: > > FarmID AddressNumAddressName > > 1 1067 Niagara Stone > > 2 4260 Mountainview > > 3 25Hunter > > 4 1091 Hutchinson > > > I have struggled with this for a while and know there must be a > > simple me

Re: problem with sqlite3: cannot use < in a SQL query with (?)

2014-01-22 Thread Tim Chase
On 2014-01-23 03:32, lgabiot wrote: > >>>cursor = conn.execute("SELECT filename, filepath FROM files > >>>WHERE > max_level<(?)", threshold) > that doesn't work (throw an exception) That last argument should be a tuple, so unless "threshold" is a tuple, you would want to make it sql = "S

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-23 Thread Tim Chase
On 2014-01-23 05:43, Terry Reedy wrote: > A list instead of a tuple does work, but not an iterable, so > 'sequence'. In the OP's case using sqlite drivers, this is true. However, I maintain some old 2.4 code that uses a correspondingly ancient version of mx.ODBC which requires a tuple and raises

Re: Case insensitive exists()?

2014-01-23 Thread Tim Chase
On 2014-01-22 17:58, Larry Martell wrote: > I have the need to check for a files existence against a string, > but I need to do case-insensitively. I cannot efficiently get the > name of every file in the dir and compare each with my string using > lower(), as I have 100's of strings to check for,

Re: Initialise dictionary of dictionary

2014-01-23 Thread Tim Chase
On 2014-01-23 07:15, Ayushi Dalmia wrote: > I need to initialise a dictionary of dictionary with float values. > I do not know the size of the dictionary beforehand. How can we do > that in Python -- Either d = {} or, if you want from collections import defaultdict d = defaultdict(float)

Re: Initialise dictionary of dictionary

2014-01-23 Thread Tim Chase
On 2014-01-23 10:34, Dave Angel wrote: > Unsure of what the floats have to do with it. Perhaps you meant > float KEYS. using floats for keys can be dangerous, as small rounding errors in math can produce keys different enough that they're not found by an exact-match lookup. But yeah, the origin

Re: The potential for a Python 2.8.

2014-01-24 Thread Tim Chase
On 2014-01-24 19:56, Roy Smith wrote: > In article , > Grant Edwards wrote: > > > On 2014-01-24, Roy Smith wrote: > > > In article > > > , Chris > > > Angelico wrote: > > > > > >> On Fri, Jan 24, 2014 at 1:22 PM, Roy Smith > > >> wrote: > > >> >> Python 2.8j? > > >> > > > >> > You're imaginin

Re: Python with 3d cartoon

2014-01-26 Thread Tim Chase
On 2014-01-26 02:46, ngangsia akumbo wrote: > Is it possible to write cartoon with 3D images using python? > > If yes , please locate me some resources. thank Check out Blender which can be scripted using Python. -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: re Questions

2014-01-26 Thread Tim Chase
On 2014-01-26 12:15, Roy Smith wrote: > > The set [A-z] is equivalent to > > [ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz] > > I'm inclined to suggest the regex compiler should issue a warning > for this. > > I've never seen a character range other than A-Z, a-z, or 0-9. > Well,

Re: Lists inside dictionary and how to look for particular value

2014-01-26 Thread Tim Chase
On 2014-01-26 10:47, mick verdu wrote: > z={ 'PC2': ['02:02:02:02:02:02', '192.168.0.2', '200'], > 'PC3': ['03:03:03:03:03:03', '192.168.0.3', '200'], > 'PC1': ['01:01:01:01:01:01', '192.168.0.1', '200'] } > > My solution: > > z=raw_input("Enter Host, Mac, ip and time") > t=z.split() > t[

Re: Help: python 3.3.3 (AMD64) scripts fail as non-admin user on Windows Server 2012 R2

2014-01-27 Thread Tim Golden
On 26/01/2014 22:30, Luis Marsano wrote: > I've installed python for all users with full permissions to all users > (see picture). > Python runs for all users. > However, scripts only work when I run as Administrator. > Running a script always results in an "ImportError: cannot import name" error.

Re: Add directory to sys.path based on variable

2014-01-30 Thread Tim Golden
tory on the fly to sys.path using a variable Certainly: import sys newpath = "c:/users/tim/modules" sys.path.append(newpath) TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Add directory to sys.path based on variable

2014-01-30 Thread Tim Golden
On 30/01/2014 14:03, loial wrote: > Ok, that works fine with the apth hard coded, but I want to do something like > the code below. i.e I am trying to dynamically add a path that is relative to > the path of the current executing python script. > > In this case the import fails. > > import sys

Re: __init__ is the initialiser

2014-02-01 Thread Tim Delaney
mentation is a bug in either the documentation or the implementation. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: __init__ is the initialiser

2014-02-02 Thread Tim Delaney
e it will call the subclass method before the subclass constructor is actually run, meaning that instance variables will have their default values (null for objects). When the base class constructor is eventually run the instance variables will be assigned the values in the class definition (replacing a

Re: Unable to Launch Python 2.7 after Windows 8.1 Update

2014-02-03 Thread Tim Golden
On 02/02/2014 15:39, Allison Gray wrote: I recently obtained a new laptop with Windows 8.1 and installed Python 2.7. Everything was working fine. Then after my first update, I was unable to launch Python. After clicking the Python icon, the thinking cursor activated, but Python never opened. I re

Re: [newbie] copying identical list for a function argument

2014-02-03 Thread Tim Chase
On 2014-02-03 13:36, Jean Dupont wrote: > I have a list like this: > [1,2,3] > > The argument of my function should be a repeated version e.g. > [1,2,3],[1,2,3],[1,2,3],[1,2,3] (could be a different number of > times repeated also) > > what is the prefered method to realize this in Python? > > a

Re: Finding size of Variable

2014-02-04 Thread Tim Chase
On 2014-02-04 14:21, Dave Angel wrote: > To get the "total" size of a list of strings, try (untested): > > a = sys.getsizeof (mylist ) > for item in mylist: > a += sys.getsizeof (item) I always find this sort of accumulation weird (well, at least in Python; it's the *only* way in many other

Re: Finding size of Variable

2014-02-04 Thread Tim Golden
On 04/02/2014 19:21, Dave Angel wrote: Ayushi Dalmia Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the "total" size of a list of stri

Re: parse a csv file into a text file

2014-02-05 Thread Tim Chase
On 2014-02-05 16:10, Zhen Zhang wrote: > import csv > file = open('raw.csv') Asaf recommended using string methods to split the file. Keep doing what you're doing (using the csv module), as it attends to a lot of edge-cases that will trip you up otherwise. I learned this the hard way several yea

Re: parse a csv file into a text file

2014-02-05 Thread Tim Chase
On 2014-02-05 19:59, Asaf Las wrote: > On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote: > > On 2014-02-05 16:10, Zhen Zhang wrote: > > Asaf recommended using string methods to split the file. Keep > > doing what you're doing (using the csv module), as

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
On 2014-02-06 17:40, Mark Lawrence wrote: > On 06/02/2014 14:02, Neil Cerutti wrote: > > > > You must open the file in binary mode, as that is what the csv > > module expects in Python 2.7. newline handling can be enscrewed > > if you forget. > > > > file = open('raw.csv', 'b') > > > > I've never

Re: parse a csv file into a text file

2014-02-06 Thread Tim Golden
On 06/02/2014 17:40, Mark Lawrence wrote: On 06/02/2014 14:02, Neil Cerutti wrote: You must open the file in binary mode, as that is what the csv module expects in Python 2.7. newline handling can be enscrewed if you forget. file = open('raw.csv', 'b') I've never opened a file in binary mod

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
[first, it looks like you're posting via Google Groups which annoyingly double-spaces everything in your reply. It's possible to work around this, but you might want to subscribe via email or an actual newsgroup client. You can read more at https://wiki.python.org/moin/GoogleGroupsPython ] On 201

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
On 2014-02-06 18:34, Neil Cerutti wrote: > They do actually mention it. > > From: http://docs.python.org/2/library/csv.html > > If csvfile is a file object, it must be opened with > the ‘b’ flag on platforms where that makes a difference. > > So it's stipulated only for file objects on syst

Re: Question about `list.insert`

2014-02-06 Thread Tim Chase
On 2014-02-06 22:00, Roy Smith wrote: > > list does not promise better than O(1) behavior > > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps > there is O(j), where you just imagine the operation was performed?

Re: Sorting dictionary by datetime value

2014-02-08 Thread Tim Chase
On 2014-02-08 19:29, Chris Angelico wrote: > On Sat, Feb 8, 2014 at 7:25 PM, Igor Korot > wrote: > >> Try this: > >> > >> sorted_items = sorted(my_dict.keys(), key=my_dict.get) > > > > This code fail. > > Actually, it's a list of keys - notice that I changed > my_dict.items() into my_dict.keys()?

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: Finding size of Variable

2014-02-10 Thread Tim Chase
On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: > Python does not save memory at all. A str (unicode string) > uses less memory only - and only - because and when one uses > explicitly characters which are consuming less memory. > > Not only the memory gain is zero, Python falls back to the > wors

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

2014-02-10 Thread Tim Daneliuk
cations in which you do not want the casual reader to be able to derive the meaning of the source code. -- -------- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.o

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

2014-02-10 Thread Tim Daneliuk
. -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list

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

2014-02-10 Thread Tim Daneliuk
On 02/10/2014 11:35 PM, Steven D'Aprano wrote: On Mon, 10 Feb 2014 22:40:48 -0600, Tim Daneliuk wrote: On 02/08/2014 05:54 PM, Sam wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bia

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-11 Thread Tim Chase
On 2014-02-11 06:30, Steven D'Aprano wrote: > You need to understand the difference between syntax and semantics. > This is invalid English syntax: > > "Cat mat on sat the." > > This is valid syntax, but semantically wrong: > > "The mat sat on the cat." > > This is both syntactically and semant

Re: Flag control variable

2014-02-11 Thread Tim Chase
On 2014-02-11 10:16, luke.gee...@gmail.com wrote: > when expandig the script to multiple calcs i got a problem > >>> a = 32 > >>> c = 51 > >>> sign = * > > File "", line 1 > sign = * >^ > SyntaxError: invalid syntax > > is there a way of adding * without quoting marks, because if

Re: Flag control variable

2014-02-11 Thread Tim Chase
On 2014-02-11 10:37, luke.gee...@gmail.com wrote: > command1 = "sudo mpg321 > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > % (a, b, sum) > > when using * i get > > Traceback (most recent call last): > File "./math+.py", line 6, in > b = int(sys.argv[3]) > V

Re: Flag control variable

2014-02-11 Thread Tim Chase
On 2014-02-11 11:06, luke.gee...@gmail.com wrote: > > > > command1 = "sudo mpg321 > > > > > > > > > > > > > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > > > > 1) PLEASE either stop using Google Groups or take the time to remove the superfluous

Re: Understanding Python from a PHP coder's perspective

2015-12-07 Thread Tim Chase
On 2015-12-08 10:09, Chris Angelico wrote: > All three are very different. > > 1) Process state. > > You start up a Python program, and it sits there waiting for a > request. You give it a request, and get back a response; it goes > back to waiting for a request. If you change a global variable,

Re: Understanding Python from a PHP coder's perspective

2015-12-07 Thread Tim Chase
On 2015-12-08 08:40, Chris Angelico wrote: > One advantage of this kind of setup is that your URLs don't depend > on your back end. I could replace all this with a Ruby on Rails > site, and nobody would notice the difference. I could put together > something using Node.js to replace the Ruby site,

Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-22 Thread Tim Chase
On 2015-12-21 23:24, Jon Ribbens wrote: > That sounds a bit confused - if the *intention* of changing the > subject line is to create a new thread, then breaking the thread > is not "breaking threading" ;-) I'm pretty sure that the purpose is not to *break* the thread, but to suggest that the sub-

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-24 Thread Tim Chase
On 2015-12-24 11:36, malitic...@gmail.com wrote: > it is a homework, but we are to figure out the solution first , all > we need is some guidance please and not to be spoon fed like many > thought Ah, with the intended interface as given by the tests, and the code you've already put together, you

Re: Python and multiple user access via super cool fancy website

2015-12-24 Thread Tim Chase
On 2015-12-24 14:39, Aaron Christensen wrote: > I am not sure if this is the correct venue for my question, but I'd > like to submit my question just in case. I am not a programmer but > I do have an incredible interest in it, so please excuse my lack of > understanding if my question isn't very t

Re: We will be moving to GitHub

2016-01-02 Thread Tim Chase
On 2016-01-02 17:43, Steven D'Aprano wrote: > Oh, and talking about DVCS: > > https://bitquabit.com/post/unorthodocs-abandon-your-dvcs-and-return-to-sanity/ The arguments there are pretty weak. Not working offline? I use that *ALL* *THE* *TIME*. Maybe the author lives some place where the main

Re: Trailing zeros of 100!

2016-01-02 Thread Tim Chase
On 2016-01-02 03:49, katye2...@gmail.com wrote: > I'm trying to write a python program to find how many trailing > zeros are in 100! (factorial of 100). I used factorial from the > math module, but my efforts to continue failed. Please help. Pretty easy to do with strings: from math import fact

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Tim Chase
On 2016-01-05 20:38, Steven D'Aprano wrote: > On Tue, 5 Jan 2016 07:53 pm, Tony van der Hoff wrote: > > > Why would someone want to make 400 HTTP requests in a short time? > > For the same reason they want to make 400 HTTP requests over a long > time, except that they're in a hurry. > > Maybe th

Re: Fast pythonic way to process a huge integer list

2016-01-06 Thread Tim Chase
On 2016-01-06 18:36, high5stor...@gmail.com wrote: > I have a list of 163.840 integers. What is a fast & pythonic way to > process this list in 1,280 chunks of 128 integers? That's a modest list, far from huge. You have lots of options, but the following seems the most pythonic to me: # I don'

Re: licenses

2016-01-09 Thread Tim Golden
On 08/01/2016 19:41, Martinez, Jorge Alberto (GE Aviation) wrote: Hello We develop applications here with Python and I want to know if there's issues by using. We use NumPy, PyDaqMx, Py Visa How can we cover this licensing? [copying the answer I've just given over at webmaster@] I'm not sure

Re: Python launcher options

2016-01-09 Thread Tim Golden
On 06/01/2016 00:48, Edward Diener wrote: The Python launcher in Windows is a neat tool for running multiple versions of Python 2 and Python 3 at different times. It allows as options the ability to specify the latest version of either Python 2 or Python 3 defaulting to the 64-bit version if both

Re: Python launcher options

2016-01-10 Thread Tim Golden
On 10/01/2016 05:18, Edward Diener wrote: On 1/9/2016 11:03 AM, Tim Golden wrote: On 06/01/2016 00:48, Edward Diener wrote: The Python launcher in Windows is a neat tool for running multiple versions of Python 2 and Python 3 at different times. It allows as options the ability to specify the

Re: Which Python editor has this feature?

2016-01-10 Thread Tim Chase
On 2016-01-10 17:59, jf...@ms4.hinet.net wrote: > It lets you jump between the current cursor position and the line > the upper level indentation start, something like the bracket > matching in C editor. Because of Python use indentation as its code > block mark, It might be helpful if we can jump

Re: Which Python editor has this feature?

2016-01-11 Thread Tim Chase
On 2016-01-11 03:08, jf...@ms4.hinet.net wrote: > Tim Chase at 2016/1/11 UTC+8 11:16:27AM wrote: > > :nnoremap Q '?^'.repeat(' ', > > (strlen(substitute(getline('.'), '\S.*', '', > > ''))-&sw)).'\S?e&

modifying parts of a urlparse.SplitResult

2016-01-12 Thread Tim Chase
I can successfully parse my URLs. However, I'd like to modify a part then reassemble them. However, like tuples, the parts appear to be unmodifiable >>> URL = 'http://foo/path1/path2/?fragment=foo' >>> import urlparse >>> u = urlparse.urlparse(URL) >>> u ParseResult(scheme='http', ne

Re: modifying parts of a urlparse.SplitResult

2016-01-12 Thread Tim Chase
On 2016-01-12 13:46, Peter Otten wrote: > Tim Chase wrote: > > >>> u = urlparse.urlsplit(URL) > > >>> lst = list(u) # can't manipulate the tuple directly > > >>> lst[3] = "bar=baz" # 3 = query-string index > > >>>

Re: Need solution with this problem

2016-01-13 Thread Tim Golden
On 13/01/2016 05:57, ifeanyioprah--- via Python-list wrote: [... snip yet another homework dump with one more still held in moderation ...] At this point you're basically spamming this list. I won't allow any more of your posts through unless they appear to be engaging with the help shown to you

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-01-13 Thread Tim Golden
On 13/01/2016 14:43, Joel Goldstick wrote: > On Wed, Jan 13, 2016 at 8:37 AM, Chris Angelico wrote: > >> On Thu, Jan 14, 2016 at 12:28 AM, wrote: >>> please kindly inbox me the solution >>> >>> thanks in anticipation of your kind gesture >>> >>> >>> sammhielade...@gmail.com >> >> Don't you get

Re: Writing a stream of bytes

2016-01-15 Thread Tim Chase
On 2016-01-15 16:55, jmp wrote: > Hi pyple ! > > > I'd like to write a stream of bytes into a file. I'd like to use > the struct (instead of bytearray) module because I will have to > write more than bytes. > > let's say I want a file with 4 bytes in that order: > > 01 02 03 04 > > None of the

Re: Writing a stream of bytes

2016-01-15 Thread Tim Chase
[sorry, toddler on my lap clicked before I could type] > import struct > with open('toto', 'wb') as f: f.write(struct.pack('<4B', *[1,2,3,4])) This one does what you want. The problem resides in your check: > I always end up with the following bytes on file: > !hexdump toto > 000 0201 0403

Re: .py file won't open in windows 7

2016-02-04 Thread Tim Golden
On 04/02/2016 12:52, Yossifoff Yossif wrote: > Hallow, > I try to open a .py file (attached), but what I get is a windows DOS window > opening and closing in a couple of seconds. Ran repair of the program, > nothing happened. > I cannot see error messages and don't know where to look for ones. >

Re: .py file won't open in windows 7

2016-02-04 Thread Tim Golden
On 04/02/2016 13:09, Tim Golden wrote: > On 04/02/2016 12:52, Yossifoff Yossif wrote: >> Hallow, >> I try to open a .py file (attached), but what I get is a windows DOS window >> opening and closing in a couple of seconds. Ran repair of the program, >> nothing happ

Re: realtime output and csv files

2016-02-05 Thread Tim Chase
On 2016-02-05 17:57, Bernardo Sulzbach wrote: > CSVs is essentially text separated by commas, so you likely do not > need any library to write it "Just separating with ','" should work > if you are formatting them correctly. > https://mail.python.org/mailman/listinfo/python-list And even if you ha

Re: realtime output and csv files

2016-02-06 Thread Tim Chase
On 2016-02-06 02:53, Bernardo Sulzbach wrote: >> And even if you have things to escape or format correctly, the >> stdlib has a "csv" module that makes this trivially easy: >> > > I supposed it had one. Obviously, I've never used it myself, > otherwise I would be sure about its existence. Nice t

Re: A sets algorithm

2016-02-07 Thread Tim Chase
On 2016-02-07 21:46, Paulo da Silva wrote: > Suppose I have already a class MyFile that has an efficient method > (or operator) to compare two MyFile s for equality. > > What is the most efficient way to obtain all sets of equal files (of > course each set must have more than one file - all single

Re: A sets algorithm

2016-02-07 Thread Tim Chase
On 2016-02-08 00:05, Paulo da Silva wrote: > Às 22:17 de 07-02-2016, Tim Chase escreveu: >> all_files = list(generate_MyFile_objects()) >> interesting = [ >> (my_file1, my_file2) >> for i, my_file1 >> in enumerate(all_files, 1) >> for my_

Importing two modules of same name

2016-02-09 Thread Tim Johnson
n CGI programmer before retiring about 3 years ago. Thanks -- Tim http://www.akwebsoft.com, http://www.tj49.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Importing two modules of same name

2016-02-09 Thread Tim Johnson
* Carl Meyer [160209 15:28]: > Hi Tim, <...> > The proper way to do this in Python 2.7 is to place `from __future__ > import absolute_import` at the top of flask/app/__init__.py (maybe best > at the top of every Python file in your project, to keep the behavior > consistent

Re: There has to be a better way to split this string!

2016-02-09 Thread Tim Chase
On 2016-02-09 19:26, Anthony Papillion wrote: > myfile-2015-02-09-19-08-45-4223 > > Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by > datetime.now() with "-"'s. I'm doing that using the following code > but it's freaking ugly and I KNOW there is a better way to do it. I > just

Re: Importing two modules of same name

2016-02-10 Thread Tim Johnson
function that I used in my own framework when I was developing CGI sites. I never used the globals parameter tho'. If I start -- Tim http://www.akwebsoft.com, http://www.tj49.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Storing a big amount of path names

2016-02-11 Thread Tim Chase
On 2016-02-12 00:31, Paulo da Silva wrote: > What is the best (shortest memory usage) way to store lots of > pathnames in memory where: > > 1. Path names are pathname=(dirname,filename) > 2. There many different dirnames but much less than pathnames > 3. dirnames have in general many chars > > Th

Re: Changing A Subscription Option

2016-02-13 Thread Tim Golden
On 13/02/2016 23:15, Heaven Hodges wrote: Hello. Is there a way to change my subscription option from digest to individual e-mails? I couldn't find any information on the list web page: https://mail.python.org/mailman/listinfo/python-list. At the bottom of that page is a button to "Unsubscribe

Fwd: [python-uk] URGENT: Volunteers for teacher collaboration please... :-)

2016-02-17 Thread Tim Golden
[Forwarding an email from python-uk in the hope that UK-based Pythonistas might see it here who don't hang out there...] From: Nicholas H.Tollervey Reply-To: UK Python Users To: UK Python Users Hi Folks, I realise I must sound like a stuck record about this sort of thing - please accept my si

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-17 Thread Tim Chase
On 2016-02-17 16:51, Steven D'Aprano wrote: > If you want the file to be closed immediately, you must: > > - use a with statement; > > - or explicitly call f.close() I have a lot of pre-"with" code (i.e., Py2.4) that looks like f = open(...) try: do_stuff() finally: f.close() To

Re: Question on keyword arguments

2016-02-18 Thread Tim Chase
On 2016-02-18 09:00, grsm...@atlanticbb.net wrote: > Would this be the correct way to return > a list as a default result. > > Also, would the list be the preferable result (to a python > programmer) ? > > def test(command, return_type='LIST'): > """ Go to database and return data""" > if

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

2016-02-18 Thread Tim Chase
On 2016-02-18 09:58, wrong.addres...@gmail.com wrote: > How long can I depend on VB? Are you talking the VB6-and-before, or VB.Net? Given that MS dropped support for the VB6 line a decade ago (2005-2008 depending on whether you had extended support) with little to no help in transitioning to VB.N

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

2016-02-18 Thread Tim Chase
On 2016-02-18 07:33, wrong.addres...@gmail.com wrote: > Another question I have is regarding reading numerical data from > text files. Is it necessary to read one character at a time, or can > one read like in Fortran and Basic (something like Input #5, X1, > X2, X3)? A lot of my work is extractin

Re: Question on keyword arguments

2016-02-18 Thread Tim Chase
On 2016-02-18 10:57, grsm...@atlanticbb.net wrote: > Tim, the 'crazy-other-result format' is the > result returned by the database, nothing > I can do about that :) then, much like converting byte-strings to unicode strings as early as possible and converting them back to byte

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

2016-02-19 Thread Tim Chase
On 2016-02-19 02:47, wrong.addres...@gmail.com wrote: > 2 12.657823 0.1823467E-04 114 0 > 3 4 5 9 11 > "Lower" > 278.15 > > Is it straightforward to read this, or does one have to read one > character at a time and then figure out what the numbers are? -- It's easy to read. What you do with tha

Re: downloading a CSV

2016-02-19 Thread Tim Chase
On 2016-02-19 10:46, noydb wrote: > I want to be able to download this CSV file and save to disk > >> http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv from urllib.request import urlopen data = urlopen("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.c

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

2016-02-21 Thread Tim Chase
On 2016-02-21 13:16, BartC wrote: > > No need for anyone to re-invent the > > wheel! ;-) > > I keep seeing this in the thread. Python has all this capability, > yet it still requires a lot of fiddly code to be added to get > anywhere near as simple as this: > >read f, a, b, c > > And this i

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

2016-02-28 Thread Tim Delaney
probably going to be most efficient whilst leaving the file position just after the delimiter. If reading from a stream, I think Chris' read a chunk and maintain an internal buffer, and don't give access to the underlying stream. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

<    15   16   17   18   19   20   21   22   23   24   >