Re: Slicing Arrays in this way

2007-05-02 Thread Tobiah
I'm a retard. Disregard. -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Slicing Arrays in this way

2007-05-03 Thread Tobiah
John Machin wrote: > On May 3, 8:55 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Wed, 02 May 2007 15:03:24 -0700, Tobiah wrote: >> >>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10]) >>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] &

mode parameter in popen2-4

2007-08-20 Thread Tobiah
t to 'append' to a stream is it because binary mode can still be turned on and off this way? Thanks, Tobiah -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

How do I express a backslash in a string?

2007-08-22 Thread Tobiah
sed to. Normally, a double backslash takes away the special meaning of the last backslash, and so you are left with a single backslash. How do I express the single backslash? Thanks, Tobiah -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I express a backslash in a string?

2007-08-22 Thread Tobiah
Tobiah wrote: >>>> "'" > "'" >>>> "\'" > "'" >>>> "\\'" > "\\'" >>>> "\\\'" > "\\'" >>>> > > Th

Re: Using Regular Expresions to change .htm to .php in files

2007-08-25 Thread Tobiah
[EMAIL PROTECTED] wrote: > Hi, > > I have a bunch of files that have changed from standard htm files to > php files but all the links inside the site are now broken because > they point to the .htm files while they are now .php files. > > Does anyone have an idea about how to do a simple script t

Re: interesting puzzle......try this you will be rewarded...

2007-09-06 Thread Tobiah
My adblock extension must be doing a great job. I don't see any ads. The puzzle is fun really, but I'm stuck right now at 'eeiigg'. Renu wrote: > Hi, > > Just click on this link n use ur common sence to navigate. > > It has 23 pages one after the other, starting from this first > > Page. > T

Re: Python Regex Question

2007-09-20 Thread Tobiah
[EMAIL PROTECTED] wrote: > I need to extract the number on each > i.e 49.950 from the following: > >  49.950  > > The actual number between:  49.950  can be any number of > digits before decimal and after decimal. > >  ##.  > > How can I just extract the real/integer number using rege

Re: Who can develop the following Python script into working application ?

2007-09-25 Thread Tobiah
Diez B. Roggisch wrote: > Andrey Khavryuchenko schrieb: >> DBR> And as you said yourself: >> >> DBR> """ >> DBR> Frankly speaking I would prefer to pay for your kind assistance >> DBR> as it may take me to much time to learn some Python and >> understand the >> DBR> following script. >> DBR>

Re: Read CSV file into an array

2007-01-10 Thread Tobiah
oyekomova wrote: > I would like to know how to read a CSV file with a header ( n columns > of float data) into an array without the header row. > import csv l = [] for line in csv.reader(open("my.csv").readlines()[1:]): l.append(line) Which really gets you a list of lists. -- Posted v

AES and Credit card number encryption

2007-01-22 Thread Tobiah
sed as the key: obj=AES.new('abcdefgh', AES.ECB) So my real question is, how do I go about generating the best key. Isn't the length supposed to be a 2^n bits, and soforth? Thanks, Tobiah -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into an integer

2007-01-22 Thread Tobiah
> count = sys.argv[2] > for i in range(count): > #do some stuff for i in range(int(count)): -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: AES and Credit card number encryption

2007-01-22 Thread Tobiah
Paul Rubin wrote: > Tobiah <[EMAIL PROTECTED]> writes: >> I browsed this subject and thought I might use the 'AES' cypher >> scheme to do this. Would this be a good choice? > > There's more to it than that, but yes, AES is a good underlying > alg

Re: Right-Justifying Numeric Output

2007-01-25 Thread Tobiah
> Thank you very much! I didn't see this in any of my Python books or on > the I like to look at the printf docs for any C compiler. On Unix, man 3 printf -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: "do" as a keyword

2007-12-14 Thread Tobiah
> But reading through the warts and reading about a lack of "do while > statements" I also started to ponder about the "'do something' if > 'true' else 'do this'", and pondered if perhaps this statement could > do with the including of the keyword do. I often miss what can be done in other langua

Re: Python; jump to a concrete line

2007-12-20 Thread Tobiah
Horacius ReX wrote: > Hi, sorry but after looking for information, I still did not get how, > when reading a text file in python, can one jump to a concrete line > and then read the different data (separated by spaces). In each line > there is different number of columns so sometimes i get kind of

Re: Open source English dictionary to use programmatically w/ python

2008-01-08 Thread Tobiah
dgoldsmith_89 wrote: > Can anyone point me to a downloadable open source English dictionary > suitable for programmatic use with python: I'm programming a puzzle > generator, and I need to be able to generate more or less complete > lists of English words, alphabetized. Thanks! DG If all you wan

'Borg' and multiple threads.

2008-01-08 Thread Tobiah
each time a browser hits the app? Otherwise, where is the individual data stored for each of two simultaneous hits of the web page? Thanks, Tobiah -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

itertools.groupby

2008-01-15 Thread Tobiah
In the docs and examples that I have seen so far, it is suggested that the groupby() input list may be pre-sorted with the same function that is passed to groupby as a key extractor. I tried doing this with a simple example, but noticed that [].sort(func) passes two arguments to func, whereas the

Re: module naming conventions

2008-01-15 Thread Tobiah
couple of obscure software related hits on Google. I checked sourceforge, and found that the name was available, so I stuck my flag in the dirt. It was a python module, so I suppose I will have to look into the cheeseshop. Is that as open as sourceforge, or is it only for mature, sophisticated modules

Re: import from question

2008-01-15 Thread Tobiah
Duncan Booth wrote: > iu2 <[EMAIL PROTECTED]> wrote: > >> file a3.py: >> >> from a1 import the_number >> import a2 >> > ... >> Why doesn't it work in the first version of a3.py? >> > Think of 'import a2' as being the same as: > > a2 = __import__('a2') > > and 'from a1 import the_number'

Re: itertools.groupby

2008-01-16 Thread Tobiah
Paul Rubin wrote: > Tobiah <[EMAIL PROTECTED]> writes: >> I tried doing this with a simple example, but noticed >> that [].sort(func) passes two arguments to func, whereas >> the function expected by groupby() uses only one argument. > > Use: [].sort(key=func) O

Re: import from question

2008-01-16 Thread Tobiah
Ben Finney wrote: > Tobiah <[EMAIL PROTECTED]> writes: > >> This is a little surprising. So "from mod import *" really copies >> all of the scalars into new variables in the local namespace. > > No. Nothing is copied. All the objects (remembering tha

Re: import from question

2008-01-16 Thread Tobiah
> Again, those aren't copies. There is only one instance of each value, > referenced by multiple names. Ok, I get it. I was locally importing a pointer to an integer which is really the same object as the module name points to, but the assignment changes that. The confusion for me centered aro

Re: import from question

2008-01-18 Thread Tobiah
>> Ok, I get it. I was locally importing a pointer to an integer > > Really? What language were you using? Python doesn't have pointers. What term do you prefer? Reference? Object id holder? -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailma

Re: Removing Pubic Hair Methods

2008-01-30 Thread Tobiah
class genital: def pubic_hair(self): pass def remove(self): del(self.pubic_hair) "Removing pubic hair methods" [EMAIL PROTECTED] wrote: > Shaving is the most common removing pubic hair method. However, it is > not the only one. > > After you ha

Seemingly odd 'is' comparison.

2008-02-18 Thread Tobiah
>>> print float(3.0) is float(3.0) True >>> print float(3.0 * 1.0) is float(3.0) False >>> Thanks, Tobiah -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: linux disc space

2008-02-18 Thread Tobiah
DataSmash wrote: > I simply want to capture the free disc space in a variable so that I > can compare changes. I'm aware of a few commands like "df -h" or "du - > k", but I can't figure out how to capture those values as a variable. > I also looked at os.statvfs(), but that output doesn't seem to

Re: Adobe CS3

2008-02-26 Thread Tobiah
Dotan Cohen wrote: > On 26/02/2008, john_sm3853 <[EMAIL PROTECTED]> wrote: >> Hey guys wondering, if you are using Adobe CS3 and do you think, if there >> are >> other alternatives to CS3. Would you recommend CS3 or wait for something >> else. >> > > For writing python? > > Dotan Cohen > >

Advantage of the array module over lists?

2008-03-13 Thread Tobiah
I checked out the array module today. It claims that arrays are 'efficient'. I figured that this must mean that they are faster than lists, but this doesn't seem to be the case: one.py ## import array a = array.array('i') for x in xrange(1000): a.append

Re: Is this doable

2008-03-24 Thread Tobiah
> I have a little problem. I have a script that is in the scheduler > (win32). But every now and then I update this script and I dont want > to go to every computer and update it. Can't you just put the script on a network share? Tobiah -- Posted via a free Usenet acc

unzip array of arrays?

2009-01-22 Thread Tobiah
Although it's trivial to program, I wondered whether there was a builtin or particularly concise way to express this idea: > a = [(1, 2), (3, 4), (5, 6)] > field[a, 2] [2, 4, 6] where field() is some made up function. Thanks, Toby -- http://mail.python.org/mailman/listinfo/python-list

Re: unzip array of arrays?

2009-01-23 Thread Tobiah
On Thu, 22 Jan 2009 14:13:34 -0800, Chris Rebert wrote: > On Thu, Jan 22, 2009 at 2:04 PM, Tobiah wrote: >> Although it's trivial to program, I wondered whether >> there was a builtin or particularly concise way to >> express this idea: >> >>> a = [(1,

len()

2009-01-27 Thread Tobiah
Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby -- http://mail.python.org/mailman/listinfo/python-list

Re: Flattening lists

2009-02-05 Thread Tobiah
> Hello everybody, > > Any better solution than this? a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]] print str(a).replace('[', '').replace(']', '').split(', ') ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Flattening lists

2009-02-05 Thread Tobiah
On Thu, 05 Feb 2009 11:06:39 -0800, Tobiah wrote: > >> Hello everybody, >> >> Any better solution than this? > > a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]] print str(a).replace('[', > '').replace(']', '').split(', &#x

Re: do you fail at FizzBuzz? simple prog test

2008-10-06 Thread Tobiah
Or to allow the numbers 3 and 5 to be easily changed: for i in range(1, 101): print 'fizz' * (not i % 3) + 'buzz' * (not i % 5) or i Tobiah for i in range(1,100): print ('fizz','','')[i%3] + ('buzz','',''

There may be a much better way to manage artillery.

2009-05-10 Thread Tobiah
I'm writing a video game with armed space ships. I decided to make a class to manage all of the bullets that may be on the screen at a given time: class Bullets(): def __init__(self): self.bullets = [] def update(self): temp = [] fo

Re: There may be a much better way to manage artillery.

2009-05-11 Thread Tobiah
On Mon, 11 May 2009 00:48:25 +0100, Rhodri James wrote: > On Mon, 11 May 2009 00:06:34 +0100, Tobiah wrote: > > [Snippety snip] > >> I wanted the bullets to be responsible for destroying themselves, but a >> little Googling brought me to points about dangling references

Re: Sorting a dictionary

2009-05-15 Thread Tobiah
;s happening here? I read this as the 'sorted' function iterating over the keys in word_count, then passing that sorted list to the 'for' loop, for a second iteration over the sorted pairs. No? Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: make a string a list

2008-05-30 Thread Tobiah
>> or a string iterable ? How can I do that. I have lots of '\r\n' >> characters in the string which I think can be easier if it were made >> into a list and I can easily see if the required value (its a numeral) >> is present in it or not after some position or after some characters' >> position.

Re: Keep a script running in the background

2008-06-03 Thread Tobiah
> I need a script to keep running in the background after it's loaded > some data. It will make this data available to the main program in the > form of a dictionary, but I don't want to reload the calculated data > every time the user needs it via the main program. If it were me, I'd go with a d

Re: Import, site packages, my modules, Windows vs. Linux

2008-06-04 Thread Tobiah
On Tue, 03 Jun 2008 17:57:07 -0700, John Ladasky wrote: > Hi folks, > > Running Python 2.5 on both a Windows XP laptop, and an Ubuntu Linux > 7.04 desktop. > > I've gotten tired of maintaining multiple copies of my personal > modules that I use over and over. I have copies of these files in the

Re: Exit from os.chroot()

2008-06-04 Thread Tobiah
>> So you need some programs in your chroot: Then put a directory >> usr/bin into the chroot directory and bind the system's /usr/bin >> there: > >> mount --bind /usr/bin $chroot/usr/bin > > It is better to make copies of the needed binaries and libraries, > and *only* them. Or symbolic links,

Re: Question regarding re module

2008-06-05 Thread Tobiah
>> > It could be that the result overloads the __getattr__-method to delegate >> > calls to some object. Thus it's not part of the outer instance. >> > > Didn't I read that Py3 will support a __dir__ method so that classes > *could* report such pseudo-attributes in response to dir? > > -- Paul

Re: Getting sorting order

2008-07-01 Thread Tobiah
master,slave1,slave2=zip(*x) What does the asterisk do here? Thanks ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Please check my understanding...

2008-07-01 Thread Tobiah
list.append([1,2]) will add the two element list as the next element of the list. list.extend([1,2]) is equivalent to list = list + [1, 2] and the result is that each element of the added list becomes it's own new element in the original list. Is that the only difference? >From the manual: s.ex

Sorting two dimentional array by column?

2008-07-02 Thread Tobiah
Imagine an excel spreadsheet. I can choose a column and sort the records based on the items in that column. I would like to do the same thing with a large two dimensional array. What would be the fastest way (in computation time) to accomplish this? This seems similar to a recent sorting thread

Re: Sorting two dimentional array by column?

2008-07-02 Thread Tobiah
> Imagine an excel spreadsheet. I can choose > a column and sort the records based on the items > in that column. I would like to do the same > thing with a large two dimensional array. > What would be the fastest way (in computation time) > to accomplish this? Now that I think about the prob

Re: Sorting two dimentional array by column?

2008-07-02 Thread Tobiah
>> Imagine an excel spreadsheet. I can choose >> a column and sort the records based on the items >> in that column. I would like to do the same >> thing with a large two dimensional array. >> What would be the fastest way (in computation time) >> to accomplish this? > > Now that I think about

sort(cmp=func)

2008-07-09 Thread Tobiah
true. If a is not dependent on b, and b is not dependent on c, that doesn't mean that a is not dependent on c. Is there a better way? Thanks Tobiah ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: sort(cmp=func)

2008-07-10 Thread Tobiah
On Wed, 09 Jul 2008 20:58:32 -0700, Daniel Fetchinson wrote: >> I have a list of objects that generate code. Some >> of them depend on others being listed first, to >> satisfy dependencies of others. >> >> I wrote a cmp function something like this: >> >> def dep_cmp(ob1, ob2): >> >> i

Re: Doubt

2008-07-24 Thread Tobiah
>> How to convert the perl notation >> $a = ""; expression in Python ? a = "" >> How to represent the loop >> for ($a = $b; $a<=$c;$a++){ >> >> } in Python for a in range(b, c + 1): do_something() ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/pytho

Re: seemingly simple list indexing problem

2008-07-30 Thread Tobiah
On Mon, 28 Jul 2008 23:41:51 -0700, iu2 wrote: > On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: >> On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: >> > > My programming skills are pretty rusty and I'm

Re: How do I include a shell variable in my script?

2008-07-30 Thread Tobiah
On Tue, 29 Jul 2008 07:53:53 -0700, laredotornado wrote: > Hi, > > I'm running a Python script on a Solaris 9 machine, invoking the > Python script from ksh, if that matters. There is an enviornment > variable, $JAVA_HOME, that I would like to include in my script, > replacing "/path/to/java/hom

Re: Hobbyist - Python vs. other languages

2008-08-01 Thread Tobiah
>> Since I don't have a specific problem to solve, besides >> Pythonchallenge (which I found very cryptic), and Project Euler (which >> I found beyond my mathematics skills), is there a place to go for >> increasingly difficult problems to solve? I have followed a number of >> the recommended onli

Re: Locking around

2008-08-06 Thread Tobiah
On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > Hello, > > I need to synchronize the access to a couple of hundred-thousand > files[1]. It seems to me that creating one lock object for each of the > files is a waste of resources, but I cannot use a global lock for all > of them either

Re: regex question

2008-08-06 Thread Tobiah
On Tue, 05 Aug 2008 15:55:46 +0100, Fred Mangusta wrote: > Chris wrote: > >> Doesn't work for his use case as he wants to keep periods marking the >> end of a sentence. Doesn't it? The period has to be surrounded by digits in the example solution, so wouldn't periods followed by a space (end of

Re: list question... unique values in all possible unique spots

2008-08-11 Thread Tobiah
On Sat, 09 Aug 2008 08:07:26 -0700, Mensanator wrote: > 40329146112660563558400 I think it's only 4 septillion. Perfectly manageable. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: list question... unique values in all possible unique spots

2008-08-11 Thread Tobiah
On Mon, 11 Aug 2008 13:46:10 -0700, Tobiah wrote: > On Sat, 09 Aug 2008 08:07:26 -0700, Mensanator wrote: > >> 40329146112660563558400 > > I think it's only 4 septillion. I meant 403. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: list question... unique values in all possible unique spots

2008-08-11 Thread Tobiah
On Mon, 11 Aug 2008 13:46:10 -0700, Tobiah wrote: > On Sat, 09 Aug 2008 08:07:26 -0700, Mensanator wrote: > >> 40329146112660563558400 > > I think it's only 4 septillion. I meant to say 403. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check if string is an integer?

2008-04-08 Thread Tobiah
> byte twiddling if the need arouse. I'm excited already :) ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Getting subprocess.call() output into a string?

2008-04-15 Thread Tobiah
I am not sure how to capture the output of a command using subprocess without creating a temp file. I was trying this: import StringIO import subprocess file = StringIO.StringIO() subprocess.call("ls", stdout = file) Traceback (most recent call last): File "", line 6, in ? File "/usr/local

Re: Getting subprocess.call() output into a string?

2008-04-15 Thread Tobiah
On Tue, 15 Apr 2008 13:36:11 -0700, Tobiah wrote: > I am not sure how to capture the output of a command > using subprocess without creating a temp file. I was Sorry, I jumped into a secondary level of the docs, and didn't see it all. I guess I can use communicate() to get the out

Re: Calling Python code from inside php

2008-04-23 Thread Tobiah
On Wed, 23 Apr 2008 20:42:44 +0200, Diez B. Roggisch wrote: > vijay schrieb: >> Hi >> I have a python code performing some computation for me.I have a >> html page which passes certain argumnets to a php page.This php page >> needs to pass on the value to the Python class and get the result >>

Re: no string.downer() ?

2008-08-28 Thread Tobiah
> Never ascribe to humour that which can be adequately explained by > increadible stupidity! I love the irony. Don't feel bad. I recently corrected someone's 'grammer' with a similar tone. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: run all scripts in sub-directory as subroutines?

2009-11-13 Thread Tobiah
> This works fine, but in the sub-modules the sys.path appropriately > returns the same as from the parent, I want them to know their own file > names. How?? I can pass it to them, but wondered if there is a more > self-sufficient way for a module to know from where it was invoked. I like the ide

Re: A different take on finding primes

2009-11-17 Thread Tobiah
>> Let me >> be clear, given 2min, how many primes can you find, they need not be in >> order or consecutive. Do they have to go from low to high? :( ) -- http://mail.python.org/mailman/listinfo/python-list

Six Minutes and fourty two seconds

2010-02-26 Thread Tobiah
Now that I use python, this is the amount of time per day that I spend adding forgotten semicolons while debugging other languages. -- http://mail.python.org/mailman/listinfo/python-list

Generating a rainbow?

2010-04-08 Thread Tobiah
I'm having a difficult time with this. I want to display a continuous range of hues using HTML hex representation (#RRGGBB). How would I go about scanning through the hues in order to make a rainbow? Thanks, Toby -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating a rainbow?

2010-04-08 Thread Tobiah
> Look at the colorsys module. > > http://docs.python.org/library/colorsys.html?highlight=colorsys#module- colorsys That so rocks. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating a rainbow?

2010-04-08 Thread Tobiah
> How does that answer your original question? I was able to do this: import colorsys sat = 1 value = 1 length = 1000 for x in range(0, length + 1): hue = x / float(length) color = list(colorsys.hsv_to_rgb(hue, sat, value)) for x in range(3): color[x] = in

Re: Generating a rainbow?

2010-04-09 Thread Tobiah
>>You should use different variables for the two loops. > >Actually it is closing the divs that makes it work in FireFox: > Hah. I new that the rainbow wasn't complete and that it didn't work in Opera. I just fizzled on the closing of the divs. I also don't get why it worked at all

Re: Pythonic list reordering

2010-04-09 Thread Tobiah
> How about a one liner? > > L.sort(key=lambda s: int(s.split('_')[1])) > > (Which is not necessarily elegant, but it is short.) I grant it a measure of elegance as well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Picking a license

2010-05-14 Thread Tobiah
erson B can do activities 2 through 10, while person A can not. Therefore, Person A is indeed free to perform an action that person B is not free to perform, but person a is *not* free to do more than person B. Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Getting the name of the file that imported current module

2010-07-04 Thread Tobiah
foo.py: import bar bar.show_importer() output: 'foo' or 'foo.py' or 'path/to/foo' etc. Possible? Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Sum script

2009-09-04 Thread Tobiah
> in the terminal i get a very strange "permission denied" error that might > not have anything to do with the code. I checked permissions for the file > and they are set to "read and write" so, again, I am really not sure what > going wrong. Try: python myfile Or chmod +x myf

Re: How to print without spaces?

2009-09-18 Thread Tobiah
> I don't want to print the space between 'a' and 'b'. Could somebody let me > know how to do it? print "a","b" > a b Since you are new, you should also be aware of: print "%s%s" % (a, b) -- http://mail.python.org/mailman/listinfo/python-list

That interesting notation used to describe how long a loop will take.

2010-10-04 Thread Tobiah
tems being sorted etc.. I want to google this, but I'm not sure what keywords to use. Is there a wikipedia article about this subject? I imagine that it has a concise name. Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Unicode questions

2010-10-19 Thread Tobiah
e that everyone sticks to. Please enlighten my vague and probably ill-formed conception of this whole thing. Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode questions

2010-10-19 Thread Tobiah
> There is no such thing as "plain Unicode representation". The closest > thing would be an abstract sequence of Unicode codepoints (ala Python's > `unicode` type), but this is way too abstract to be used for > sharing/interchange, because storing anything in a file or sending it > over a network u

Re: Extract items from string in db

2017-03-15 Thread Tobiah
On 03/14/2017 03:26 PM, DFS wrote: > I have a SQLite database with TEXT columns containing strings of the format: > > ['Item1: Value1 has,comma','Item2: has'apostrophe','Item3: Value3'] > > The brackets are part of the string. > > How can I unpack and access each item? > Item1: Value1 has,comma

Re: The ternaery operator

2017-03-16 Thread Tobiah
drugs['choice'] else 'pot' Then I'm tempted to do: chosen = drugs['choice'] chosen if chosen else 'pot' I sometimes feel like doing: drugs['choice'] else 'pot' Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: The ternaery operator

2017-03-16 Thread Tobiah
On 03/16/2017 01:12 AM, Gregory Ewing wrote: > Stefan Ram wrote: > >> a if c else b >> >> Guido has invented something totally new. Why? > > It's arguably closer to the way you would say such a > thing in English. > > Consider the following sentences: > > "I wear my red shirt if it's Tuesday,

Re: Who are the "spacists"?

2017-03-20 Thread Tobiah
> I wonder whether the tabs versus spaces divide is closely aligned to the > Windows versus Unix/Linux divide? > > It seems to me that Unix users are typically going to be using Unix tools > which often assume spaces are used for indentation, and consequently cope > badly with tabs. I can't thin

Find out which module a class came from

2017-04-07 Thread Tobiah
I was viewing the python source for a program at work and came across a class name that I knew my company had written: import mycmp1 import mycmp2 import mycmp3 import mycmp4 import mycmp5 foo = FooClass() So I knew that FooClass was defined in on

Re: API Help

2017-06-16 Thread Tobiah
> I still think it _could_ be the output of a Python repr() or similar > (something that is expected to be evaluated as a Python expression). It may be valid fodder for python eval(), but if it came from repr() It would have used single quotes, yes? -- https://mail.python.org/mailman/listinfo/

Using pydal for standalone scripts

2023-06-07 Thread Tobiah via Python-list
I am looking into creating a database abstraction library using pydal and mysql as the engine. I noticed that I have to specify a 'folder' with the connection string to tell pydal where to save "table files". So I'll have hundreds of different databases and install this library on many machines.

Re: Configuring an object via a dictionary

2024-03-18 Thread Tobiah via Python-list
On 3/15/24 02:30, Loris Bennett wrote: Hi, I am initialising an object via the following: def __init__(self, config): self.connection = None self.source_name = config['source_name'] self.server_host = config['server_host'] However, with a view to asking forg

Re: Configuring an object via a dictionary

2024-03-18 Thread Tobiah via Python-list
I should mention that I wanted to answer your question, but I wouldn't actually do this. I'd rather opt for your self.config = config solution. The config options should have their own namespace. I don't mind at all referencing foo.config['option'], or you could make foo.config an object by its

python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list
Kubuntu 24.04. sinewave:toby ~(1)> cat .inputrc set editing-mode vi set keymap vi sinewave:toby ~(1)> cat .editrc bind -v bind \\t rl_complete sinewave:toby ~(1)> python Python 2.7.18 (default, Jul 8 2024, 12:49:12) [GCC 13.2.0] on linux2 Type "help", "copyright", "credits" or "license" for mor

Problem using mysql library

2024-07-11 Thread Tobiah via Python-list
sinewave:toby ~(1)> python Python 2.7.18 (default, Jul 8 2024, 12:49:12) [GCC 13.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. import MySQLdb Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/site-packages/MySQLdb/

Re: python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list
For this to work, the Python implementation should use the same readline library as your shell, I guess. It works in python3, so I guess my problem is that I'm compiling python (I think kubuntu dropped python2), but I don't see any relevant options in the configure help. -- https://m

Re: python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list
I see the literal 'escape' character + 'k', when it should let me edit previous commands. I did have to compile my own python because I'm using 2.7 on this machine. I figured it out. I needed to apt install libreadline-dev. -- https://mail.python.org/mailman/listinfo/python-list

python3 package import difference?

2024-08-07 Thread Tobiah via Python-list
I have an old library from 20 some years ago for use with python2, that is structured like this: rcs ├── dbi │   ├── __init__.py │   ├── dbi.py │   └── regos.py └── __init__.py -- *empty* the __init__.py file under 'rcs' is empty. The one under rcs.dbi contains:

<    1   2   3