Re: Import a module from a specific file path

2014-11-21 Thread Ben Finney
Chris Angelico writes: > So can you simply: > > $ python -m foo.fooprog > > ? (or 'python3', either way) So, that's a pretty awful user interface. (The file is named ‘fooprog’ because it's an executable, intended to be run directly at the command line.) That solution would be rather inferior to

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Marko Rauhamaa
Steven D'Aprano : > In Python, we have Unicode strings and byte strings. No, you don't. You have strings and bytes: Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways: [...

Re: Import a module from a specific file path

2014-11-21 Thread Marko Rauhamaa
Ben Finney : > Solutions usually seem to entail contortions of cluttering the import > block by discovering the current path, and fussing around with > ‘sys.path’, before finally doing the import:: > > #! /usr/bin/python3 > > import sys > import os.path > > program_dir = os.path.di

Re: Infinitely nested containers

2014-11-21 Thread Rustom Mody
On Saturday, November 22, 2014 10:40:23 AM UTC+5:30, Chris Angelico wrote: > On Sat, Nov 22, 2014 at 4:02 PM, Rustom Mody wrote: > > Thats not a single expression; which is possible with a lazy > > evaluation language like Haskell. > > Prelude> let ones = 1 : ones > > I'm not sure "lazy evaluatio

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Fri, 21 Nov 2014 15:07:39 -0500, Denis Beauregard wrote: >On Fri, 21 Nov 2014 14:35:14 -0500, Dennis Lee Bieber > wrote in soc.genealogy.computing: > >>On Fri, 21 Nov 2014 10:35:19 +0200, Steve Hayes >>declaimed the following: >> >> >>>This Python script does it for me. >>> >>>year = input("

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Sat, 22 Nov 2014 06:51:15 +1100, Paul Blair wrote: >On 22-Nov-2014 6:35 am, Dennis Lee Bieber wrote: >> On Fri, 21 Nov 2014 10:35:19 +0200, Steve Hayes >> declaimed the following: >> >> >>> This Python script does it for me. >>> >>> year = input("Year: ") >>> age = input("Age: ") >>> born = y

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 4:07 PM, Steve Hayes wrote: > On Fri, 21 Nov 2014 14:50:36 -0500, Dennis Lee Bieber > wrote: > >>On Fri, 21 Nov 2014 12:15:03 +0200, Steve Hayes >>declaimed the following: >> >>>On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico wrote: >>> On Fri, Nov 21, 2014 at 7:3

Re: Infinitely nested containers

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 4:02 PM, Rustom Mody wrote: > Thats not a single expression; which is possible with a lazy > evaluation language like Haskell. > Prelude> let ones = 1 : ones I'm not sure "lazy evaluation" is the key here, unless it also does name lookups lazily. What happens if you do thi

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Fri, 21 Nov 2014 14:50:36 -0500, Dennis Lee Bieber wrote: >On Fri, 21 Nov 2014 12:15:03 +0200, Steve Hayes >declaimed the following: > >>On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico wrote: >> >>>On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes wrote: This Python script does it for me

Re: Infinitely nested containers

2014-11-21 Thread Rustom Mody
On Saturday, November 22, 2014 10:20:36 AM UTC+5:30, Chris Angelico wrote: > On Sat, Nov 22, 2014 at 3:43 PM, Steven D'Aprano wrote: > > random832 wrote: > > > >> There's no reason not to allow it with tuples, but you can't do it. > >> Mainly because doing it in a single literal would require speci

Re: Infinitely nested containers

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 3:43 PM, Steven D'Aprano wrote: > random...@fastmail.us wrote: > >> There's no reason not to allow it with tuples, but you can't do it. >> Mainly because doing it in a single literal would require special >> syntax, whereas you can simply append to a list a reference to its

Re: Infinitely nested containers

2014-11-21 Thread Steven D'Aprano
random...@fastmail.us wrote: > On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: >> Gill Shen : >> >> > How is this [nesting] behavior implemented under the hood? >> >> Pointers. >> >> > And why is this allowed at all? >> >> There's no reason not to. > > There's no reason not to allow it

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Steven D'Aprano
Marko Rauhamaa wrote: > Rustom Mody : > >> Likewise in 2014, and given the arguments, inconsistencies, etc >> remembering the nuts-n-bolts below the strings-represented-as-unicode >> abstraction may be in order. > > No need to hide Unicode, but talking about a > >Unicode string > > is like

Re: GUI toolkit(s) status

2014-11-21 Thread Michael Torrie
On 11/20/2014 02:17 AM, Chris Angelico wrote: > But I agree about the issues with tkinter. So, let's see. Shall we > wait for Tcl/Tk Unicode support? Recommend people switch to PyGTK? To > PyQt? To wxPython? To something else? Personally, I'm quite happy with > GTK2 (though that's with Pike, not Py

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 12:07 PM, Rick Johnson wrote: > On Friday, November 21, 2014 5:59:44 PM UTC-6, Chris Angelico wrote: >> On Sat, Nov 22, 2014 at 10:21 AM, Rick Johnson >> wrote: >> > 1. Use the historical "implicit import" mechanism for most day >> > to day imports, and let Python do all t

Re: Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies")

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 11:37 AM, Ben Finney wrote: > I don't think I'd ever want to specify an absolute file path for the > module. But it would make my Python life immeasurably better if I could > specify *relative* file paths for importing a module. > > Allowing relative paths makes this portab

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 6:33:32 PM UTC-6, Ian wrote: > On Fri, Nov 21, 2014 at 3:25 PM, Rick Johnson > > Why does the code in the main package need to run when i > > *explicitly* and *directly* fetched a "nested resource" > > within the package?[...] > > It has nothing to do with the __init__

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 5:59:44 PM UTC-6, Chris Angelico wrote: > On Sat, Nov 22, 2014 at 10:21 AM, Rick Johnson > wrote: > > 1. Use the historical "implicit import" mechanism for most day > > to day imports, and let Python do all the heavy lifting. > > > > 2. Use the new "explicit import" me

Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies")

2014-11-21 Thread Ben Finney
Chris Angelico writes: > In other words, what you want is: > > # today's method, import based on search path > import sys > # new explicit path method > import '/usr/local/lib/python3.5/lib-dynload/math.cpython-35m.so' I don't think I'd ever want to specify an absolute file path for the module.

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread sohcahtoa82
On Friday, November 21, 2014 3:21:31 PM UTC-8, Rick Johnson wrote: > On Friday, November 21, 2014 4:25:49 PM UTC-6, Rick Johnson wrote: > > > > # STEP 3 # > > #

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ian Kelly
On Fri, Nov 21, 2014 at 3:25 PM, Rick Johnson wrote: >> The only exception is if you're doing "import calendar" from inside >> the ricklib package, and you're using Python 2, and you don't have >> "from __future__ import absolute_import" at the top of your module. >> The solution to this is easy:

Python-friendly IDE (was: Python IDE.)

2014-11-21 Thread Ben Finney
kiloran writes: > I'm very happy with Eclipse Eclipse has many benefits: * It is not Python-specific. I consider it a grave mistake to invest a lot of effort in learning a Python-specific development environment, when there are plenty of good environments that do not tie you especially to

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 10:21 AM, Rick Johnson wrote: > 1. Use the historical "implicit import" mechanism for most day > to day imports, and let Python do all the heavy lifting. > > 2. Use the new "explicit import" mechanism for advanced name > resolutions, but realize that since you are now takin

Re: Python IDE.

2014-11-21 Thread kiloran
On 20/11/2014 19:01, dvenkatj2ee...@gmail.com wrote: Can someone suggest a good python IDE. I'm very happy with Eclipse -- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 4:25:49 PM UTC-6, Rick Johnson wrote: > > # STEP 3 # > > # Make the following changes to the impor

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Michael Torrie
On 11/21/2014 01:29 PM, Rick Johnson wrote: > Not personally. But how will we *ever* know if he refuses to > participate in these discussions? Why should he participate in these discussions? Why should you be in charge of said discussions? By the way, Python has more than certainly borne fruit,

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 1:24:53 PM UTC-6, Ian wrote: > On Fri, Nov 21, 2014 at 11:24 AM, Rick Johnson > > Are you also going to call drivers "fools" because they bought > > a "certain brand" of car only to have the airbag explode in > > their face? > > No, but I'll call them fools if they buy

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 1:06:18 PM UTC-6, Michael Torrie wrote: > On 11/21/2014 11:24 AM, Rick Johnson wrote: > > Why am *i* the fool when it's obvious that > > the creators of Python were either shortsighted and/or > > careless with the designs? The only people who suffer are > > those who pu

Re: Using Python for date calculations

2014-11-21 Thread Paul Blair
On 22-Nov-2014 6:35 am, Dennis Lee Bieber wrote: On Fri, 21 Nov 2014 10:35:19 +0200, Steve Hayes declaimed the following: This Python script does it for me. year = input("Year: ") age = input("Age: ") born = year-age print 'Year of birth:', born It's so simple, so elementary, that it's not

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Fri, 21 Nov 2014 17:03:12 +, duncan smith wrote: >On 21/11/14 08:35, Steve Hayes wrote: >> I've finally found a use for Python. >> >> When, in the course of my genealogy research, I look at census or burial >> records, I often want to work out a person's date of birth from their age. >>

Re: Infinitely nested containers

2014-11-21 Thread Zachary Ware
On Fri, Nov 21, 2014 at 12:37 PM, Ian Kelly wrote: > Here's a nice crash. I thought this might similarly produce a > recursion depth error, but no, it's a seg fault! > > $ cat test.py > import itertools > > l = [] > it = itertools.chain.from_iterable(l) > l.append(it) > next(it) > $ python3 test.p

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ian Kelly
On Fri, Nov 21, 2014 at 11:24 AM, Rick Johnson wrote: > Are you also going to call drivers "fools" because they bought > a "certain brand" of car only to have the airbag explode in > their face? No, but I'll call them fools if they buy a car and the engine catches fire because they never bothered

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Michael Torrie
On 11/21/2014 11:24 AM, Rick Johnson wrote: > Why am *i* the fool when it's obvious that > the creators of Python were either shortsighted and/or > careless with the designs? The only people who suffer are > those who put their trust in the designer, and not the > designer himself -- something is w

Re: Infinitely nested containers

2014-11-21 Thread Ian Kelly
On Fri, Nov 21, 2014 at 10:39 AM, wrote: > On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: >> Gill Shen : >> >> > How is this [nesting] behavior implemented under the hood? >> >> Pointers. >> >> > And why is this allowed at all? >> >> There's no reason not to. > > There's no reason not to a

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 5:24 AM, Rick Johnson wrote: > Of course, I did that a long time ago! But like everything > in Python, when your try to be cleaver... Just so you know, I never try to be one of these. http://img1.wikia.nocookie.net/__cb20110615074214/americanmcgeesalice/images/1/1a/Vorpal

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 9:34:55 AM UTC-6, Ian wrote: > On Thu, Nov 20, 2014 at 8:53 PM, Rick Johnson > > FOR INSTANCE: Let's say i write a module that presents a > > reusable GUI calendar widget, and then i name the module > > "calender.py". > > > > Then Later, when i try to import *MY* GUI wi

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 12:47, Chris Angelico wrote: > You can do it in C, I believe - PyTuple_New() followed by > PyTuple_SetItem(x, 0, x) should do it. Yeah, that's how I did it. I think python 2 crashed and python 3 didn't... or maybe it was the interactive interpreter that crashed and calling

Re: Infinitely nested containers

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 4:39 AM, wrote: > There's no reason not to allow it with tuples, but you can't do it. > Mainly because doing it in a single literal would require special > syntax, whereas you can simply append to a list a reference to itself. > > I think I tried on at least one python ver

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ian Kelly
On Fri, Nov 21, 2014 at 9:12 AM, Tim Chase wrote: > The only time I've been stung by name overloading is in the indirect > case of creating a local email.py file and then importing smtplib > only to have things break in unforeseen ways. If smtplib used > relative imports for $STDLIB/email.py I su

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: > Gill Shen : > > > How is this [nesting] behavior implemented under the hood? > > Pointers. > > > And why is this allowed at all? > > There's no reason not to. There's no reason not to allow it with tuples, but you can't do it. Mainly beca

Re: Infinitely nested containers

2014-11-21 Thread Ian Kelly
On Thu, Nov 20, 2014 at 10:54 PM, Gill Shen wrote: > How is this behavior implemented under the hood? And why is this allowed at > all? Is it just a curiosity or can you do something useful with it? Reference cycles are common in Python and other OO languages. For example, adding a widget to a w

Re: Most gratuitous comments

2014-11-21 Thread Grant Edwards
On 2014-11-21, Marko Rauhamaa wrote: > sohcahto...@gmail.com: > >> My point was that I was making fun of CS professors that demand a >> comment on every line of code, regardless of how clear the line of >> code is. > > Unfortunately, a lot of software houses do a similar thing. Not quite > every l

Re: Using Python for date calculations

2014-11-21 Thread duncan smith
On 21/11/14 08:35, Steve Hayes wrote: > I've finally found a use for Python. > > When, in the course of my genealogy research, I look at census or burial > records, I often want to work out a person's date of birth from their age. > It's a simple matter of mental arithmetic, but I sometimes get i

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 3:36 AM, Marko Rauhamaa wrote: > No need to hide Unicode, but talking about a > >Unicode string > > is like talking about an > >electronic computer > >visible spectrum display > >mouse user interface > >ethernet socket > >magnetic file > >electri

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Marko Rauhamaa
Rustom Mody : > Likewise in 2014, and given the arguments, inconsistencies, etc > remembering the nuts-n-bolts below the strings-represented-as-unicode > abstraction may be in order. No need to hide Unicode, but talking about a Unicode string is like talking about an electronic computer

Re: Python docs disappointing

2014-11-21 Thread Grant Edwards
On 2014-11-20, Steven D'Aprano wrote: > jstnms...@gmail.com wrote: > >> I write this to address the criticism which targets a user's lack of >> responsibility for the real/implied/insinuated failings of the docs. >> As a relatively inexperienced student of programming, [...] After >> all, I'm a l

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Tim Chase
On 2014-11-21 07:52, Rick Johnson wrote: > On Friday, November 21, 2014 4:29:48 AM UTC-6, Tim Chase wrote: > > > What messed-up version of Python are you running? > > Or did you fail to test your conjecture? > > > > $ cat > calendar.py > > print("This is my local calendar.py") > > x=1 > > $ cat

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 3:11 AM, Francis Moreau wrote: > Yes I finally used str() since only setlocale() reported to have some > issues with unicode_literals active in my appliction. > > Thanks Chris for your useful insight. My pleasure. Unicode is a bit of a hobby-horse of mine, so I'm always ha

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Francis Moreau
On 11/20/2014 04:15 PM, Chris Angelico wrote: > On Fri, Nov 21, 2014 at 1:14 AM, Francis Moreau > wrote: >> Hi, >> >> Thanks for the "from __future__ import unicode_literals" trick, it makes >> that switch much less intrusive. >> >> However it seems that I will suddenly be trapped by all modules

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Rustom Mody
On Friday, November 21, 2014 12:06:54 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico : > > > On Fri, Nov 21, 2014 at 5:56 AM, Marko Rauhamaa wrote: > >> I don't really like it how Unicode is equated with text, or even > >> character strings. > > [...] > > Do you have actual text that you're

Re: Using Python for date calculations

2014-11-21 Thread Mark Lawrence
On 21/11/2014 15:50, Steve Hayes wrote: On Fri, 21 Nov 2014 10:20:06 +, Mark Lawrence As I'm using Python 2 and I asked the question, I'm grateful that the answer was given in my dialect. Luddite :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Tim Chase
On 2014-11-22 02:23, Steven D'Aprano wrote: > LATIN SMALL LETTER E > COMBINING CIRCUMFLEX ACCENT > > then my application should treat that as a single "character" and > display it as: > > LATIN SMALL LETTER E WITH CIRCUMFLEX > > which looks like this: ê > > rather than two distinct "characters"

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Rick Johnson
On Friday, November 21, 2014 4:29:48 AM UTC-6, Tim Chase wrote: > What messed-up version of Python are you running? > Or did you fail to test your conjecture? > > $ cat > calendar.py > print("This is my local calendar.py") > x=1 > $ cat > importtest.py > import calendar > print(dir(calendar)) >

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Fri, 21 Nov 2014 10:20:06 +, Mark Lawrence wrote: >On 21/11/2014 08:50, Gary Herron wrote: >> On 11/21/2014 12:35 AM, Steve Hayes wrote: >>> I've finally found a use for Python. >>> >>> When, in the course of my genealogy research, I look at census or burial >>> records, I often want to wo

Re: How to access Qt components loaded from file?

2014-11-21 Thread Mark Lawrence
On 21/11/2014 12:10, Juan Christian wrote: On Fri Nov 21 2014 at 8:05:30 AM alister mailto:alister.nospam.w...@ntlworld.com>> wrote: All of this VVV [...] I'm sorry, I didn't know, but it seems there isn't any option to remove that in the Inbox (new Gmail), do you guys use any spec

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 2:23 AM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> On Fri, Nov 21, 2014 at 11:32 AM, Steven D'Aprano >> wrote: >>> (E.g. there are millions of existing files across the world containing >>> text which use legacy encodings that are not compatible with Unicode.) >>

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ian Kelly
On Thu, Nov 20, 2014 at 8:53 PM, Rick Johnson wrote: > FOR INSTANCE: Let's say i write a module that presents a > reusable GUI calendar widget, and then i name the module > "calender.py". > > Then Later, when i try to import *MY* GUI widget named > "calendar", i will not get *MY* calendar widget,

Re: Using Python for date calculations

2014-11-21 Thread Ned Batchelder
On 11/21/14 9:55 AM, Steven D'Aprano wrote: - Use your OS facilities to run that process in a chroot jail. If you are interested, this is the facility that edX uses to run untrusted Python code on the servers: https://github.com/edx/codejail -- Ned Batchelder, http://nedbatchelder.com -- h

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Nov 21, 2014 at 11:32 AM, Steven D'Aprano > wrote: >> (E.g. there are millions of existing files across the world containing >> text which use legacy encodings that are not compatible with Unicode.) > > Not compatible with Unicode? There aren't many character sets

Re: Using Python for date calculations

2014-11-21 Thread Steven D'Aprano
random...@fastmail.us wrote: > Out of curiosity, is there a way to use eval "safely" (i.e. strictly > limiting what it has access to) across a privilege boundary? This also > comes up for pickle and other serialization formats that can store > arbitrary classes (i.e. call arbitrary constructors).

Re: Using Python for date calculations

2014-11-21 Thread alister
On Fri, 21 Nov 2014 08:54:23 -0500, random832 wrote: > On Fri, Nov 21, 2014, at 05:33, alister wrote: >> the problem with input is code-injection which is very similar to sql >> injection (httpd://xkcd.com/327). >> >> the data entered by the user is processed as if it was python code, >> this mea

Re: GUI toolkit(s) status

2014-11-21 Thread Kevin Walzer
On 11/20/14, 11:34 PM, Terry Reedy wrote: A possible solution for Tk is to replace the non-C Tcl parts of TK with Python (or the CPython API functions as needed for speed). I have no idea how horrendous a project creating Py/Tk would be. It would be very horrendous. See Perl/Tk as the example.

Re: GUI toolkit(s) status

2014-11-21 Thread Kevin Walzer
On 11/20/14, 4:04 AM, Christian Gollwitzer wrote: Apple is a moving target, they pulled the rug from under Tk's feet twice over the past 10 years. Nobody knows if Tk will continue to exist on the mac if Cocoa is withdrawn some day and replaced by a new and completely different windowing framework

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Sat, Nov 22, 2014 at 12:58 AM, wrote: > On Fri, Nov 21, 2014, at 05:47, Chris Angelico wrote: >> Now, maybe you want it to eval. There are times when I conceptually >> want "enter an integer", but it makes good sense to be able to type >> "1+2" and have it act as if I typed "3". That's fine...

Re: *.sdf database access

2014-11-21 Thread Nikhil Joshi
On Saturday, April 21, 2012 6:55:55 AM UTC-4, Alex Willmer wrote: > On Apr 19, 9:18 pm, Page3D wrote: > > Hi, I am trying to connect and access data in a *.sdf file on Win7 > > system using Python 2.7. I have three questions: > > > > 1. What python module should I use? I have looked at sqlite3 and

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:47, Chris Angelico wrote: > Now, maybe you want it to eval. There are times when I conceptually > want "enter an integer", but it makes good sense to be able to type > "1+2" and have it act as if I typed "3". That's fine... but if you > want eval, write eval into your co

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:33, alister wrote: > the problem with input is code-injection which is very similar to sql > injection (httpd://xkcd.com/327). > > the data entered by the user is processed as if it was python code, this > means the user could enter a command (or sequence of commands)

Re: How to access Qt components loaded from file?

2014-11-21 Thread mmoradrrrr
I am in the process of creation of synthesis site looking at other sites, do any of you can aide true value of some books for aggregate roads, aggregate sites, and thank you -- https://mail.python.org/mailman/listinfo/python-list

Request for assistance

2014-11-21 Thread mmoradrrrr
I am in the process of creation of synthesis site looking at other sites, do any of you can aide true value of some books for aggregate roads, aggregate sites, and thank you -- https://mail.python.org/mailman/listinfo/python-list

Re: How to access Qt components loaded from file?

2014-11-21 Thread alister
On Fri, 21 Nov 2014 12:10:21 +, Juan Christian wrote: > On Fri Nov 21 2014 at 8:05:30 AM alister > > wrote: > >> All of this VVV [...] > > > I'm sorry, I didn't know, but it seems there isn't any option to remove > that in the Inbox (new Gmail), do you guys use any special program or >

Re: How to access Qt components loaded from file?

2014-11-21 Thread Juan Christian
On Fri Nov 21 2014 at 8:05:30 AM alister wrote: > All of this VVV > [...] I'm sorry, I didn't know, but it seems there isn't any option to remove that in the Inbox (new Gmail), do you guys use any special program or client to use list? -- https://mail.python.org/mailman/listinfo/python-lis

Re: Python Logging and printf()

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 9:48 PM, Ganesh Pal wrote: > Please provide your input on the below questions. > > (1). How do i guarantee that all console messages will be logged into the > logfile ? > (2) I feel the need to retain few print(), how do I ensure the print() > messages are also logged int

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ned Batchelder
On 11/20/14 10:53 PM, Rick Johnson wrote: If you had taken the time to read my example utilizing a "lobby boy", then you might have understood what i was talking about. Rick, if you are frustrated that people don't know what you are talking about, you should try writing shorter messages, with

Re: Python Logging and printf()

2014-11-21 Thread Stéphane Wirtel
On 21 Nov 2014, at 11:48, Ganesh Pal wrote: Hi Team , Iam using the python logging module to log the events for my application into a log file . I have set the logging level to DEBUG as shown below logging.basicConfig(filename=options.log_file, level=logging.DEBUG,

Python Logging and printf()

2014-11-21 Thread Ganesh Pal
Hi Team , Iam using the python logging module to log the events for my application into a log file . I have set the logging level to DEBUG as shown below logging.basicConfig(filename=options.log_file, level=logging.DEBUG, format='%(asctime)s %(lev

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 9:33 PM, alister wrote: > the data entered by the user is processed as if it was python code, this > means the user could enter a command (or sequence of commands) that cause > serious problems to you computer including but not limited to:- > > Installing a virus > Deleting

Re: Using Python for date calculations

2014-11-21 Thread alister
On Fri, 21 Nov 2014 10:20:06 +, Mark Lawrence wrote: > On 21/11/2014 08:50, Gary Herron wrote: >> On 11/21/2014 12:35 AM, Steve Hayes wrote: >>> I've finally found a use for Python. >>> >>> When, in the course of my genealogy research, I look at census or >>> burial records, I often want to wo

Re: Using Python for date calculations

2014-11-21 Thread alister
On Fri, 21 Nov 2014 12:15:03 +0200, Steve Hayes wrote: > On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico > wrote: > >>On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes >>wrote: >>> This Python script does it for me. >>> >>> year = input("Year: ") >>> age = input("Age: ") >>> born = year-age print

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Tim Chase
On 2014-11-20 19:53, Rick Johnson wrote: > FOR INSTANCE: Let's say i write a module that presents a > reusable GUI calendar widget, and then i name the module > "calender.py". > > Then Later, when i try to import *MY* GUI widget named > "calendar", i will not get *MY* calendar widget, no, i will >

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 9:20 PM, Mark Lawrence wrote: > As we're now firmly heading into the Python 3 era would people please be > kind enough to use the Python 3 links. I know it's only a single character > change but it's the principle to me. TIA. The OP was clearly using Python 2 (as evidenc

Re: How to fix those errors?

2014-11-21 Thread alex23
On 19/11/2014 1:40 PM, Chris Angelico wrote: On Wed, Nov 19, 2014 at 2:02 PM, alex23 wrote: The first time I got a T_PAAMAYIM_NEKUDOTAYIM error, I just about flipped my desk in rage. If that were Hebrew for "scope resolution operator", would it be less rage-inducing? Not especially. I prefe

Re: Using Python for date calculations

2014-11-21 Thread Mark Lawrence
On 21/11/2014 08:50, Gary Herron wrote: On 11/21/2014 12:35 AM, Steve Hayes wrote: I've finally found a use for Python. When, in the course of my genealogy research, I look at census or burial records, I often want to work out a person's date of birth from their age. It's a simple matter of men

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 9:15 PM, Steve Hayes wrote: > On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico wrote: > >>On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes wrote: >>> This Python script does it for me. >>> >>> year = input("Year: ") >>> age = input("Age: ") >>> born = year-age >>> print 'Ye

Re: Using Python for date calculations

2014-11-21 Thread Steve Hayes
On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico wrote: >On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes wrote: >> This Python script does it for me. >> >> year = input("Year: ") >> age = input("Age: ") >> born = year-age >> print 'Year of birth:', born > >One thing to be careful of: The input()

Re: How to access Qt components loaded from file?

2014-11-21 Thread alister
On Thu, 20 Nov 2014 22:41:02 +, Juan Christian wrote: > On Thu Nov 20 2014 at 8:20:29 PM alister > > wrote: >> >> Then either do the necessary work (you have just proven you can)or find >> a better way of communicating with this news group(NNTP or the mailing >> list), otherwise you may find

Re: Using Python for date calculations

2014-11-21 Thread Gary Herron
On 11/21/2014 12:35 AM, Steve Hayes wrote: I've finally found a use for Python. When, in the course of my genealogy research, I look at census or burial records, I often want to work out a person's date of birth from their age. It's a simple matter of mental arithmetic, but I sometimes get it wr

Re: Using Python for date calculations

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes wrote: > This Python script does it for me. > > year = input("Year: ") > age = input("Age: ") > born = year-age > print 'Year of birth:', born One thing to be careful of: The input() function in Python 2 should be avoided. Instead, use int(raw_input("Y

Using Python for date calculations

2014-11-21 Thread Steve Hayes
I've finally found a use for Python. When, in the course of my genealogy research, I look at census or burial records, I often want to work out a person's date of birth from their age. It's a simple matter of mental arithmetic, but I sometimes get it wrong, and mislead myself. There are calculato

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Chris Angelico
On Fri, Nov 21, 2014 at 7:16 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> Then you need to read more about Unicode. The *codepoint* for the >> letter 'A' is 65. That is not Unicode, that is one part of the Unicode >> spec. > > I don't think Python users need to know anything more about Unicod

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Marko Rauhamaa
Chris Angelico : > Then you need to read more about Unicode. The *codepoint* for the > letter 'A' is 65. That is not Unicode, that is one part of the Unicode > spec. I don't think Python users need to know anything more about Unicode than they need to know about IEEE-754. How many bits are reser

Re: GUI toolkit(s) status

2014-11-21 Thread Christian Gollwitzer
Am 21.11.14 05:49, schrieb Paul Rubin: Terry Reedy writes: Tcl/Tk currently use UCS-2, which only handles BMP chars. Alternatives to support astral chars: [other encodings] This is not entirely true: Tcl supports "lazy" typing, i.e. values (Tcl_Obj) are cast upon request into various Tcl_Obj