Is it possible to tell whether import statement is importing a module
or package? I am going through some example code with some import
statements - like 'import os, sys, time', 'import packed'. I know os,
sys and time are (built-in) modules and 'packed' is a package here .
But can I determine whe
On Mon, Oct 31, 2011 at 4:38 AM, Steven D'Aprano wrote:
> neubyr wrote:
>>
>> Is it possible to tell whether import statement is importing a module
>> or package? I am going through some example code with some import
>> statements - like 'import os, sys, time
I am learning Python 2.7 classes and objects. It seems like attributes
(data attributes and methods) can be added to a class/object even after
it's first declaration. For example,
class A(object):
def __init__(self,arg):
self.val1 = arg
a = A(1)
print a.val1
Now another data attribute v
On Sat, Feb 9, 2013 at 3:24 AM, Alan Gauld wrote:
> On 09/02/13 07:01, neubyr wrote:
>
>>
>> I am learning Python 2.7 classes and objects. It seems like attributes
>> (data attributes and methods) can be added to a class/object even after
>> it's first declarat
I have a text file with each line in following format:
Book Name, Author Name, Genre, Publication Date
I would like to perform following queries on this file:
* Get all books written by an author
* Remove all books of an author
* Get information about a book (pretty print matching line!)
* Ge
Thank you for your inputs Dave. That's really helpful. Reply in-line below:
On Sun, Feb 10, 2013 at 11:56 PM, Dave Angel wrote:
> On 02/11/2013 12:14 AM, neubyr wrote:
>
>> I have a text file with each line in following format:
>>
>> Book Name, Author Name, Ge
On Mon, Feb 11, 2013 at 12:36 PM, Dave Angel wrote:
> On 02/11/2013 01:19 PM, Alan Gauld wrote:
>
>> On 11/02/13 05:14, neubyr wrote:
>>
>>>
>>>
>>>
>>>
>> * How do I associate/relate Book and Author classes so that it will help
>
On Mon, Feb 11, 2013 at 5:16 PM, Alan Gauld wrote:
> On 11/02/13 22:49, neubyr wrote:
>
> is right approach to implement 'list_by_author' function as a class
>> method is typically used as an alternative constructor.
>>
>
> Not at all that is only one use cas
On Mon, Feb 11, 2013 at 6:58 PM, Steven D'Aprano wrote:
> On 11/02/13 16:14, neubyr wrote:
>
>> I have a text file with each line in following format:
>>
>> Book Name, Author Name, Genre, Publication Date
>>
>> I would like to perform following queries o
On Mon, Feb 11, 2013 at 7:34 PM, Steven D'Aprano wrote:
> On 12/02/13 10:16, Alan Gauld wrote:
>
>> On 11/02/13 22:49, neubyr wrote:
>>
>> is right approach to implement 'list_by_author' function as a class
>>> method is typically used as an alter
On Tue, Feb 12, 2013 at 4:56 PM, Steven D'Aprano wrote:
> On 13/02/13 04:32, neubyr wrote:
>
> I am not following your comment on opening books file twice in
>> list_by_author method. I have opened it only once and then reading each
>> line while checking for a
On Wed, Feb 13, 2013 at 1:55 PM, Alan Gauld wrote:
> On 13/02/13 19:14, neubyr wrote:
>
> I am not sure how to save an object in memory to a file
>> before exiting the program. Any examples or related documentation links
>> would be really helpful. I am guessing it would
On Thu, Feb 14, 2013 at 4:05 PM, Dave Angel wrote:
> On 02/14/2013 04:33 PM, Prasad, Ramit wrote:
>
>> Dave Angel wrote:
>>
>>> On 02/14/2013 12:35 PM, Prasad, Ramit wrote:
>>>
>>>> neubyr wrote:
>>>>
>>>>> I am not sure
7;,'Six')
Is this a good approach? Any suggestions for improving the code or
alternative approaches would be helpful.
-- thanks,
neubyr
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Fri, Feb 22, 2013 at 10:31 PM, Steven D'Aprano wrote:
> On 23/02/13 10:50, neubyr wrote:
>
>> I would like to validate data attributes before the object is instantiated
>> or any changes thereafter. For example, following is a simple Person class
>> with name and
15 matches
Mail list logo