On 16 March 2016 at 13:21, Steven D'Aprano wrote:
> On Wed, Mar 16, 2016 at 08:36:59AM +, Matt Williams wrote:
>> Dear Tutors,
>>
>> I am looking for some advice. I have some data that has three dimensions to
>> it. I would like to store it such that one could manipulate (query/ update/
>> etc
On Wed, Mar 16, 2016 at 08:36:59AM +, Matt Williams wrote:
> Dear Tutors,
>
> I am looking for some advice. I have some data that has three dimensions to
> it. I would like to store it such that one could manipulate (query/ update/
> etc.) by dimension - so it would be feasible to ask for all
On Mar 16, 2016 5:59 AM, "Matt Williams"
wrote:
>
> Dear Tutors,
>
> I am looking for some advice. I have some data that has three dimensions
to
> it. I would like to store it such that one could manipulate (query/
update/
> etc.) by dimension - so it would be feasible to ask for all of the data
>
Hi thereI would like to make 2 apps I wonder if somebody has a similar codes.
They said it is easier to use Django and MySQL.Thanks
1) XML parsing into database. 2) Do the same thing but this time, get ALL the
quotes and save them as separate database entries (you will have to do a for
loop for
On 16/03/16 08:36, Matt Williams wrote:
> Dear Tutors,
>
> I am looking for some advice. I have some data that has three dimensions to
> it. I would like to store it such that one could manipulate (query/ update/
> etc.) by dimension - so it would be feasible to ask for all of the data
> that shar
Dear Tutors,
I am looking for some advice. I have some data that has three dimensions to
it. I would like to store it such that one could manipulate (query/ update/
etc.) by dimension - so it would be feasible to ask for all of the data
that shares a value in d1, or iterate over all of the values
Greetings,
Here is what I am trying have my program do:
• Monitor a folder for files that are dropped throughout the day
• When a file is dropped in the folder the program should scan the file
o IF all the contents in the file have the same length
o THEN the file should be moved to a "succe
Hello:
Here is what I am trying have my program do:
• Monitor a folder for files that are dropped throughout the day
• When a file is dropped in the folder the program should scan the file
o IF all the contents in the file have the same length
o THEN the file should be moved to a "success" fo
On Sat, May 3, 2014 at 1:51 AM, Muhammed Salman wrote:
> Hi,
>
> I have to develop a simple web app. In which i have to create, update, read
> and delete people. I also should be able to make people friends and best
> friends with each other. Now, (obviously) I do not want you guys to do this
> pr
On 03/05/14 00:51, Muhammed Salman wrote:
I have to develop a simple web app. ... I do not want you guys to
do this project for me ;). But what I want is that maybe you guys can
give me some hints about where to start and make my journey easy by
giving me some good pointers on what to look for a
Hi,
I have to develop a simple web app. In which i have to create, update, read
and delete people. I also should be able to make people friends and best
friends with each other. Now, (obviously) I do not want you guys to do this
project for me ;). But what I want is that maybe you guys can give me
On 02/05/2014 04:30 PM, Alan Ho wrote:
Hi,
I am a novice in Python, having attended a course few weeks ago and I'm working
on my assignment now, and I encounter this issue when I was trying to print the
entire Windows Registry (WR) sub-keys directories (trying that first with the
below codes
On 05/02/2014 15:30, Alan Ho wrote:
Hi,
I am a novice in Python, having attended a course few weeks ago and I'm
working on my assignment now, and I encounter this issue when I was
trying to print the entire Windows Registry (WR) sub-keys directories
(trying that first with the below codes with a
Hi,
I am a novice in Python, having attended a course few weeks ago and I'm working
on my assignment now, and I encounter this issue when I was trying to print the
entire Windows Registry (WR) sub-keys directories (trying that first with the
below codes with adaptations from on-line research) a
Hi Chris,
James has already given a response but I can't resist also chiming in,
see below:
On 11 July 2012 15:30, Chris Hare wrote:
> I like where this is going Walter. I guess where I am confused is this:
>
> the globals are not static - they are set once and then won't change during
> the l
On Wed, Jul 11, 2012 at 10:30 AM, Chris Hare wrote:
>
> On Jul 11, 2012, at 8:05 AM, Walter Prins wrote:
>
> > [snip]
>
> > Your original example modified as demonstration:
> >
> > a.py:
> >
> > import shared
> > import b
> >
> > def func1():
> >print "global var in func1 = %s" % sha
On Jul 11, 2012, at 8:05 AM, Walter Prins wrote:
> [snip]
> Your original example modified as demonstration:
>
> a.py:
>
> import shared
> import b
>
> def func1():
>print "global var in func1 = %s" % shared.global_var
>
> class intclass:
>def func2(self):
>
Hi,
On 11 July 2012 01:31, Chris Hare wrote:
> Thanks Alan -- I am thinking I am just gonna go with the RAM based SQLite
> database ….
That seems an awfully large hammer for a little global variable
problem. Why can you not (as a start) just move the global(s) into
their own namespace/location
On Jul 11, 2012, at 4:48 AM, tutor-requ...@python.org wrote:
> Message: 1
> Date: Tue, 10 Jul 2012 19:31:09 -0500
> From: Chris Hare
> To: tutor@python.org
> Subject: Re: [Tutor] advice on global variables
> Message-ID: <38ebadce-c2b1-4f15-b6e1-cb725f800...@labr.net>
&g
On Jul 10, 2012, at 6:24 PM, Alan Gauld wrote:
> On 11/07/12 00:16, Alan Gauld wrote:
>
>>> One thought was a RAM based SQLite database, but that seems
>> > like a lot of work. I dunno, maybe that is the option.
>>
>> is definitely the best option where the "global" needs to be shared
>> acros
On 11/07/12 00:16, Alan Gauld wrote:
One thought was a RAM based SQLite database, but that seems
> like a lot of work. I dunno, maybe that is the option.
is definitely the best option where the "global" needs to be shared
across different programs as well as different modules in a single
I
On 10/07/12 20:11, Chris Hare wrote:
I know they are bad.
They are not totally bad and most real programs wind up
having one or two globals, although usually those globals
are top level container classes, perhaps even an Application
class or similar.
I am not sure how else to handle this pro
Sent from my iPad
On Jul 10, 2012, at 3:11 PM, Chris Hare wrote:
>
> I know they are bad. That is why I would prefer not to use it, but I am not
> sure how else to handle this problem.
>
> In this app, the user must log in. Once authenticated, they have a userid
> stored in the SQLite da
> > Just as a note, this would not really work if the variable needs to be
> > changed and read from several places when the value is an immutable
> > type such as numbers / strings. In that case, then you could use
> > the same logic but instead place the value in a list and pass that
> > and alwa
On Tue, Jul 10, 2012 at 1:32 PM, Prasad, Ramit
wrote:
>> You should avoid using the global statement.
>>
>> In your case, I would think you could just add an argument to the method:
>>
>> class MyObj(object):
>> def __init__(self, arg):
>> self.arg = arg
>> def my_func(self, new_ar
On Tue, Jul 10, 2012 at 4:32 PM, Prasad, Ramit wrote:
> > You should avoid using the global statement.
> >
> > In your case, I would think you could just add an argument to the method:
> >
> > class MyObj(object):
> > def __init__(self, arg):
> > self.arg = arg
> > def my_func(self
> You should avoid using the global statement.
>
> In your case, I would think you could just add an argument to the method:
>
> class MyObj(object):
> def __init__(self, arg):
> self.arg = arg
> def my_func(self, new_arg):
> self.arg = new_arg
>
> to call it:
>
> arg =
> >
> > file: a.py
> >
> > import b
> > global_var = "global"
> >
> To answer your most basic question:
[file b.py]
> import a
> a.global_var
This would be a cyclical import and is bad even if it does not fail.
Remove the common dependencies (in this case the global variables)
and place it in a
On Tue, Jul 10, 2012 at 3:11 PM, Chris Hare wrote:
>
> I know they are bad. That is why I would prefer not to use it, but I am
> not sure how else to handle this problem.
>
> In this app, the user must log in. Once authenticated, they have a userid
> stored in the SQLite database. Before split
On Tue, Jul 10, 2012 at 12:11 PM, Chris Hare wrote:
>
> I know they are bad. That is why I would prefer not to use it, but I am not
> sure how else to handle this problem.
>
> In this app, the user must log in. Once authenticated, they have a userid
> stored in the SQLite database. Before spl
I know they are bad. That is why I would prefer not to use it, but I am not
sure how else to handle this problem.
In this app, the user must log in. Once authenticated, they have a userid
stored in the SQLite database. Before splitting my app into multiple files, I
used a global variable.
On Tue, May 1, 2012 at 5:19 AM, Khalid Al-Ghamdi wrote:
> hi all,
>
> I'm trying to create an app that schedules 3000 to 5000 trainees'
> practical exams.
>
> All the trainees basic info (name, badge, major, etc.) is in excel and i've
> managed to convert it into a HUGE list via a csv.reader objec
hi all,
I'm trying to create an app that schedules 3000 to 5000 trainees'
practical exams.
All the trainees basic info (name, badge, major, etc.) is in excel and i've
managed to convert it into a *HUGE *list via a csv.reader object.
My question is: is this the right way to go or should i use sql
On 28/11/11 22:05, Chris Hare wrote:
Is there some way of displaying rich text files, such as RTF or HTML
from within a python Tkinter widget?
Not so much RTF but you can set different fonts and colours etc within
the standard text widget. You could either use HTML or a subset to save
your s
I have been searching around a bit, but not really finding anything which is
meaningful.
I want to embed a set of help files in my application, and display them from
within the application. I could use plain text files, which would be easy to
suck into a Text field, but it would be nice to in
>> Hello, I've enjoying learning python for the first few years, and
>> appreciate all the help I have received from this list. I had some
>> interest in programming and am very glad to have made python my choice
>> of programming language. Since I didn't go to college for computer
>> studies, I fe
"Eduardo Vieira" wrote
Right now I think I need a better understanding of logarithm, arrays
(matrixes), and even probability. What links would you all recommend
that would be useful for me to learn these things in a
newbie-friendly
way?
Wikipedia?
Pretty good on most things math and scienc
On Sun, Jun 27, 2010 at 2:50 AM, Eduardo Vieira wrote:
> Hello, I've enjoying learning python for the first few years, and
> appreciate all the help I have received from this list. I had some
> interest in programming and am very glad to have made python my choice
> of programming language. Since
Hello, I've enjoying learning python for the first few years, and
appreciate all the help I have received from this list. I had some
interest in programming and am very glad to have made python my choice
of programming language. Since I didn't go to college for computer
studies, I feel my math is k
On Tue, Oct 6, 2009 at 2:26 PM, Serdar Tumgoren wrote:
> I have a set of classes that I've named models.py (following the
> Django convention, though it's not technically a Django project or
> app).
>
> Inside that file, I had initially grouped together a number of
> classes, subclasses and mixin
> I don't think there is a "right" answer to this question. It depends
> on how the classes are used and related to each other. If the Auto
> classes are related or if they are useful to more than one client,
> perhaps you should make an auto_models.py to hold them. If they are
> only useful to ind
Hi everyone,
I was wondering if anyone could offer advice as I try to simplify a
project I've been working on.
I have a set of classes that I've named models.py (following the
Django convention, though it's not technically a Django project or
app).
Inside that file, I had initially grouped toget
>>
>> I do not think any of these meet the criteria for inheritance. None of
>> them "is a" kind of any of the others.
>>
I refreshed on my OO terminology and I see your point -- that
composition is a more appropriate fit here than inheritance.
>> I don;t like the use of Filing for a class name,
On Mon, Jul 20, 2009 at 6:05 PM, Alan Gauld wrote:
> "Serdar Tumgoren" wrote
>
>> Aha, okay, the multiple classes approach makes sense. But would these
>> be nested classes,
>>
>
> No although they would probably have attributes containing
> the related lists. Thus Race might have a list of Cand
"Serdar Tumgoren" wrote
Aha, okay, the multiple classes approach makes sense. But would these
be nested classes,
No although they would probably have attributes containing
the related lists. Thus Race might have a list of Candidates.
And Candidate would have a list of Committees etc.
perh
Serdar Tumgoren wrote:
Hi everyone,
I'm working with a database of campaign finance filings, and I'm
trying to create a data structure that captures the fact that:
- there can be multiple races
- races can have multiple candidates
- candidates can have multiple campaign committees
- campa
> Have you considered using classes? This looks like a fairly natural fit for
> race, candidate, committee and maybe report casses
Aha, okay, the multiple classes approach makes sense. But would these
be nested classes, perhaps inheriting attributes from their parent
classes? E.g.:
class Race
"Serdar Tumgoren" wrote
I'm working with a database of campaign finance filings, and I'm
trying to create a data structure that captures the fact that:
- there can be multiple races
- races can have multiple candidates
- candidates can have multiple campaign committees
- campaign committe
Serdar Tumgoren wrote:
And of course, please let me know if there's a simpler approach I'm
overlooking that would meet my requirements.
As always, the advice is appreciated.
You could just create some classes with methods to handle the insertion
and deletion of those data.
You could also keep
Hi everyone,
I'm working with a database of campaign finance filings, and I'm
trying to create a data structure that captures the fact that:
- there can be multiple races
- races can have multiple candidates
- candidates can have multiple campaign committees
- campaign committees can file m
On Thu, 11 Dec 2008 23:38:52 +0100, spir wrote:
> Serdar Tumgoren a écrit :
>> Hey everyone,
>>
>> I was wondering if there is a way to use the datetime module to check
>> for variations on a month name when performing a regex match?
>>
>> In the script below, I created a regex pattern that chec
Thanks to all for the replies!
The FeedParser example is mind-bending (at least for this noob), but of
course looks very powerful. And thanks for the tips on cleaning up the
appearance of the code with sup-patterns. Those regex's can get hairy pretty
fast.
On 12/12/2008, spir wrote:
> I just found a simple, but nice, trick to make regexes less unlegible.
> Using substrings to represent sub-patterns. E.g. instead of:
[...]
Another option is to use the re.VERBOSE flag. This allows you to put
comments in your regular expression and use whitespace fo
Serdar Tumgoren a écrit :
Hey everyone,
I was wondering if there is a way to use the datetime module to check for
variations on a month name when performing a regex match?
In the script below, I created a regex pattern that checks for dates in the
following pattern: "August 31, 2007". If there
On Thu, Dec 11, 2008 at 2:31 PM, Serdar Tumgoren wrote:
> Hey everyone,
>
> I was wondering if there is a way to use the datetime module to check for
> variations on a month name when performing a regex match?
Parsing arbitrary dates is hard, in fact the most general case is not
solvable since 7/
Hey everyone,
I was wondering if there is a way to use the datetime module to check for
variations on a month name when performing a regex match?
In the script below, I created a regex pattern that checks for dates in the
following pattern: "August 31, 2007". If there's a match, I can then print
At 01:42 PM 7/21/2008, Terry Carroll wrote:
On Mon, 21 Jul 2008, Daniel Sarmiento wrote:
> What about the following function?
>
> if x == 0:
> return False
> return True
I don't like it, myself. You have multiple points of exit, and, yes, you
can see that the fallthough is only executed if
On Mon, 21 Jul 2008, Daniel Sarmiento wrote:
> What about the following function?
>
> if x == 0:
> return False
> return True
I don't like it, myself. You have multiple points of exit, and, yes, you
can see that the fallthough is only executed if the condition is not met,
but it makes you
On Mon, Jul 21, 2008 at 10:20 AM, Daniel Sarmiento <[EMAIL PROTECTED]>
wrote:
> What about the following function?
>
> if x == 0:
>return False
> return True
>
>
> I am a beginner, but I think it is more clear (at least to me) what
> the function does. And it is only one line longer than
>
> v
On Mon, Jul 21, 2008 at 10:29 AM, Marc Tompkins <[EMAIL PROTECTED]>
wrote:
>
> How about
>
>> return (x!=0)
>>
> ?
>
> Short and cryptic!
>
Sorry - I had deleted all the old messages in the thread, and only responded
to the latest. My bad - I see now that I've joined in beating a dead horse.
-
What about the following function?
if x == 0:
return False
return True
I am a beginner, but I think it is more clear (at least to me) what
the function does. And it is only one line longer than
value = (x != 0)
return value
___
Tutor maillist -
>From the virtual desk of Lowell Tackett
--- On Sat, 7/19/08, Dick Moores <[EMAIL PROTECTED]> wrote:
> From: Dick Moores <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Advice for my function, isPrime(n), please
> To: "Python Tutor List"
> Date: Saturday, J
At 04:44 AM 7/19/2008, Kent Johnson wrote:
On Sat, Jul 19, 2008 at 5:03 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> > Readability counts. <--
>>
>> Personally I think my way is more readable. It says what it means
>> without any fluff. IMO it is explicit, readable, concise and to the
>> point
On Sat, Jul 19, 2008 at 5:03 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> > Readability counts. <--
>>
>> Personally I think my way is more readable. It says what it means
>> without any fluff. IMO it is explicit, readable, concise and to the
>> point.
>
> Well, readability is in the eye of the
At 08:40 PM 7/18/2008, Kent Johnson wrote:
On Fri, Jul 18, 2008 at 4:45 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 12:38 PM 7/18/2008, Kent Johnson wrote:
>>
>> On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> > At 10:03 AM 7/18/2008, Kent Johnson wrote:
>> >>
>> >>
On Fri, Jul 18, 2008 at 4:45 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 12:38 PM 7/18/2008, Kent Johnson wrote:
>>
>> On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> > At 10:03 AM 7/18/2008, Kent Johnson wrote:
>> >>
>> >> On Fri, Jul 18, 2008 at 11:32 AM, Dick Moore
At 12:38 PM 7/18/2008, Kent Johnson wrote:
On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 10:03 AM 7/18/2008, Kent Johnson wrote:
>>
>> On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> >if x == 0:
>> >return False
>> >else:
On Fri, Jul 18, 2008 at 2:25 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 10:03 AM 7/18/2008, Kent Johnson wrote:
>>
>> On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> >if x == 0:
>> >return False
>> >else:
>> >return True
>>
>> Could be just
>
At 10:03 AM 7/18/2008, Kent Johnson wrote:
On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>if x == 0:
>return False
>else:
>return True
Could be just
return x!=0
I see this works, but it's Greek to me. HOW does it work? And why is
it better
On Fri, Jul 18, 2008 at 11:32 AM, Dick Moores <[EMAIL PROTECTED]> wrote:
>if x == 0:
>return False
>else:
>return True
Could be just
return x!=0
or
return not x
> My question is about whether to test for integerhood. Without that test,
> isPrime(3.7) returns true, and
I'm rather please with the speed of isPrime(). Any credit, of course,
goes to Alex Martelli, who wrote gmpy.
from gmpy import is_prime
def isPrime(n):
"""
Return True if n is prime, False if not prime.
If n not an int or a long, return None.
"""
if not isinstance(n, (int, long
Daniel Kavic wrote:
> Ok I have been a multimedia major for a few years now. I have tried
> javascript and that was bad, Java is just too difficult, so I joined
> this mailing list a while back. I have been frustrated because I just
> don't get entirely how OOProgramming works and how to actu
Danny Yoo said unto the world upon 2005-12-11 22:13:
>
> On Sun, 11 Dec 2005, Brian van den Broek wrote:
>
>
>>I have a case like this toy code:
>>
>>import random
>>list1 = [1,2,3]
>>list2 = ['a', 'b', 'c']
>>item = random.choice(list1 +list2)
>>if item in list1:
>> others = list2
>>else:
>
On Sun, 11 Dec 2005, Brian van den Broek wrote:
> I have a case like this toy code:
>
> import random
> list1 = [1,2,3]
> list2 = ['a', 'b', 'c']
> item = random.choice(list1 +list2)
> if item in list1:
> others = list2
> else:
> others = list1
Hi Brian,
This code works, and as long
At 04:15 PM 12/11/2005, Brian van den Broek wrote:
>Hi all,
>
>I have a case like this toy code:
>
>import random
>list1 = [1,2,3]
>list2 = ['a', 'b', 'c']
>item = random.choice(list1 +list2)
>if item in list1:
> others = list2
>else:
> others = list1
>
>
>Another way occurred to me, but
Hi all,
I have a case like this toy code:
import random
list1 = [1,2,3]
list2 = ['a', 'b', 'c']
item = random.choice(list1 +list2)
if item in list1:
others = list2
else:
others = list1
Another way occurred to me, but I wonder if I'm being too cute:
item = random.choice(list1 +list2)
Thanks a lot, this stuff is pretty easy.
i got a couple of things working here.
thanks for your help
sk
On Sun, 2005-10-23 at 13:46 +0100, Christopher Arndt wrote:
> nephish schrieb:
> > hey there gents,
> > i am looking for a good place to start learning how to read a web page
> > with pytho
nephish schrieb:
> hey there gents,
> i am looking for a good place to start learning how to read a web page
> with python and pull out bits of information for an app i am doing for
> work. i have googled and looked at the docs. i looked at urllib and
> httplib so i think this a place to kind
nephish wrote:
> hey there gents,
> i am looking for a good place to start learning how to read a web page
> with python and pull out bits of information for an app i am doing for
> work. i have googled and looked at the docs. i looked at urllib and
> httplib so i think this a place to kinda
hey there gents,
i am looking for a good place to start learning how to read a web page
with python and pull out bits of information for an app i am doing for
work. i have googled and looked at the docs. i looked at urllib and
httplib so i think this a place to kinda start. Does anyone know
80 matches
Mail list logo