Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-15 07:50: > obvious). It is just like there are language on this planet that reads > from right to left horizontally, as well as top to bottom, then right > to left. And you are trying to tell them that English way is the "right > way" or the obvi

debian and python--any potential pitfalls?

2005-12-18 Thread Brian van den Broek
tles things. I have found out that stable ships with 2.3.5. I imagine it should be straightforward to upgrade to 2.4.2. Am I correct? Any other Debian/Python issues I should know about? If it matters, the laptop is fairly new (6 months) but wasn't screaming when new, either. Thanks bunches

Re: how to remove duplicated elements in a list?

2005-12-19 Thread Brian van den Broek
; new_list = list(set(orig_list)) >>> new_list.sort(cmp= lambda x,y: cmp(orig_list.index(x), orig_list.index(y))) >>> new_list [3, 1, 2] >>> Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove duplicated elements in a list?

2005-12-19 Thread Brian van den Broek
Alex Martelli said unto the world upon 2005-12-19 10:48: > Brian van den Broek <[EMAIL PROTECTED]> wrote: >... > >>>>>orig_list = [3,1,2,3,1,2,3,1,2,1,2,1,3] >>>>>new_list = list(set(orig_list)) >>>>>new_list.sort(cmp=

Re: debian and python--any potential pitfalls?

2005-12-19 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-19 00:36: > Brian van den Broek wrote: >>I've tried solo and failed a few times to install various Linux >>distros on Intel x86 laptops. (The software modem was always the >>sticking point.) A recent acquaintance h

Re: Please i need a hand with writing a simple task.

2005-12-19 Thread Brian van den Broek
e this is pretty clearly a homework type problem, I think you will find that you get much more useful help if you show people the code that you've already tried. Have you got as far as trying file() or open()? Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-22 Thread Brian van den Broek
Graham Fawcett said unto the world upon 2005-12-22 08:18: > Steve Holden wrote: > >>>Nicola Musatti wrote: >>>Of course, I'm going on vacation next week and there was talk >>>about a one-way ticket to Mexico. The real question is will they let me >>>*back* in? :-) >>> >> >>I would be careful comi

Re: Modifying values in a list

2005-12-29 Thread Brian van den Broek
gt; numbers = [x * 2 for x in numbers] >>> print numbers [2, 4, 6] >>> HTH, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
erpreter) is compiled and linked by > the C compiler, global or static objects with constructors cannot be > used. This is not a problem if the main program is linked by the C++ > compiler." > > Thanks, > Jeremy I have a specific answer. Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
Brian van den Broek said unto the world upon 29/12/05 12:03 PM: > jeremito said unto the world upon 29/12/05 11:39 AM: > >>I am learning how to extend Pythong with C++. I have will be writing >>some code in C++ and want/need Python to interact with it. I am not >>havi

Re: Global Variables in OOP and Python

2005-12-30 Thread Brian van den Broek
> and > Parameters.b An other variant seems rarely to come up. import Parameters as P provides almost all the brevity of the * variant and none of the dangers. Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug ??

2006-01-02 Thread Brian van den Broek
{'a': 5} > > See that 'vars' gets the old value of 'variables' passed? How can this be??? > I am using python version 2.3.5 > > Eddy Visit <http://www.python.org/doc/faq/general.html#why-are-default-values-shared-between-objects> and if that doesn't clear it up, ask again. Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Degrees as barriers to entry [was Re: - E04 - Leadership! Google, Guido van Rossum, PSF]

2006-01-03 Thread Brian van den Broek
to agree with the claim that law schools don't have the correct number of seats, but I think we might just differ on which way the adjustment should go :-) (I do realize that US data isn't most pertinent to Steven, Alex or myself -- au, it, ca -- but it is ready to hand. Shamefully, my government wants to charge me for the occupation data, and Steven's didn't yield free data before my patience and resolve wore out.) Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: What's wrong with this code snippet?

2006-01-04 Thread Brian van den Broek
remove GenerateRandomColour from class definition, and put it as a > separate function, everything works fine. I've been staring at this code > for half an hour and can't find what's wrong :(. You left out self in your GenerateRandomColour method definition. It should

Re: What is the slickest way to transpose a square list of lists (tuple of tuples)?

2006-01-08 Thread Brian van den Broek
the approach you already have, I'm unlikely to put the effort in. I suspect I'm not alone. You might do well to show the approach you are unhappy with. Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
>>> md.modified True >>> It's broken in at least one way: >>> newmd = ModFlagDict(3=4, 1=5) SyntaxError: keyword can't be an expression >>> So, as it stands, no integers, floats, tuples, etc can be keys on initialization. I think that can

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
Brian van den Broek said unto the world upon 12/01/06 03:42 AM: > [EMAIL PROTECTED] said unto the world upon 12/01/06 03:15 AM: > >>I can think of several messy ways of making a dict that sets a flag if >>it's been altered, but I have a hunch that experienced python >&

Re: New Python.org website ?

2006-01-19 Thread Brian van den Broek
omewhere such as the community or documentation navigation submenus. Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Sarcasm and irony

2006-10-10 Thread Brian van den Broek
he opposite of that expressed by the words used; usually taking the form of sarcasm or ridicule in which laudatory expressions are used to imply condemnation or contempt. The first provided use squarely in this sense is from Sir Thomas More in 1533. So, the language has been decli

Re: Python 411.

2006-06-13 Thread Brian van den Broek
asic and introductory information. Where I did my undergrad studies, a few Departments had 001 classes. Somehow that felt more honest ;-) Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian van den Broek
Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # somet

Re: question about scope

2006-02-17 Thread Brian van den Broek
osing >>> def test2(): scope = "enclosing" def nested_test(): scope = "nested" print scope nested_test() >>> test2() nested >>> Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic coin flipper program - logical error help

2006-02-22 Thread Brian van den Broek
hile (counter < 100): counter += 1 # No point in putting this in each branch coin = random.randrange(2) if (coin == 0): heads += 1 else: tails += 1 For roughly the same style, I'd go with: heads = 0 count = 100 for i in range(count): if rand

Re: Launch file in Notepad

2005-05-12 Thread Brian van den Broek
th the slash. (Other choice include using raw strings: r"c:\test.txt", and explicitly escaping the backslash: "c:\\test.txt".) Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Launch file in Notepad

2005-05-12 Thread Brian van den Broek
Fredrik Lundh said unto the world upon 2005-05-12 13:52: > Brian van den Broek wrote: > > >>>I'm trying to lauch Notepad from Python to open a textfile: >>> >>>import os >>>b1="c:\test.txt" >>>os.system('notepad.exe '

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Brian van den Broek
y rate, since the sequence of characters 'somename' and 'SomeName' are different sequences, treating them as different names strikes me as the obviously right thing to do. Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: prime number

2005-05-30 Thread Brian van den Broek
particularly good at answering neophytes' questions at the level. Since you've got some code together, even though it isn't doing what you want, you've already got a decent start for getting help. Post the question and the code to the tutor list and I'd not be surprised

Re: OO approach to decision sequence?

2005-06-18 Thread Brian van den Broek
kind of thing. Two big benefits in the context are that if you need to exhibit the same behaviour in multiple places, you don't have multiple "if type" chains, and, if you want to add a type, with its own specific behaviour, you just add a class, and there is no worry about hunting down the "if type" chains to update them. There was a thread on the tutor list around mid-Feb. which really helped me come to understand the idea. Actually, from Dec. to Feb. or so, there are several long tutor threads where people gave me much useful help coming to see how to employ OOP. Might be worth a trip through the archive. HTH, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation problem

2005-06-18 Thread Brian van den Broek
nting out and clearing up a potential cause of confusion, and a reference. All are clear, and score quite well on the content:words measure to boot. (Certainly it is clearer and more informative than the words either you or I have here added.) What's your complaint? Not enough cursing? Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation problem

2005-06-18 Thread Brian van den Broek
[EMAIL PROTECTED] > ∑ http://xahlee.org/ > <http://www.python.org/doc/current/lib/built-in-funcs.html#l2h-23> which I got to from <http://starship.python.net/crew/theller/pyhelp.cgi?keyword=eval&version=current> in less time that in took to type this. Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: example: 40286 -> 68204

2007-06-03 Thread Brian van den Broek
str(i > ... >>>> reversed_int(12345) > 54321 >>>> > Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: running a random function

2007-06-07 Thread Brian van den Broek
see a > way of actually running the function. > > Any pointers? > Unless I've missed your meaning: >>> import random >>> def f(): print 42 ... >>> def g(): print 24 ... >>> funcs = [f,g] >>> random.choice(funcs)() 24 Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: PChess 0.9

2007-05-07 Thread Brian van den Broek
majeed rana said unto the world upon 05/07/2007 01:13 AM: > I want pchess 0.9 > I want a mansion and a yacht. Unlike you, google can't help me. <http://www.google.ca/search?q=PCHess> Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: TIFF to PDF

2007-05-21 Thread Brian van den Broek
C:\test.pdf > C:\test.TIF') > > (This should be added to the Python FAQ - the most related entry is about > raw strings ending in \) Better still, use / as the path separator. That works fine on both windows and *nixes. Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: TIFF to PDF

2007-05-21 Thread Brian van den Broek
Gabriel Genellina said unto the world upon 05/21/2007 10:12 AM: > En Mon, 21 May 2007 10:53:08 -0300, Brian van den Broek > <[EMAIL PROTECTED]> escribió: > >> Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM: >>> En Mon, 21 May 2007 07:42:21 -030

Re: Inheritance

2007-05-22 Thread Brian van den Broek
'some string returned by getValidatorPkgName()' >>>> 'from '+validatorPkg+' import Validator' > 'from some string returned by getValidatorPkgName() import Validator' >>>> > HTH, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I reference 1 instance of an object by more names ?

2007-05-22 Thread Brian van den Broek
lt;__main__.Example object at 0x826daac>, <__main__.Example object at 0x826daac>) >>> del(c2) >>> c1, c2 Traceback (most recent call last): File "", line 1, in NameError: name 'c2' is not defined >>> c1 <__main__.Example object at 0x826daac> >>> HTH, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Brian van den Broek
the interactive prompt. That produced a help text that started: Help on built-in function apply in module __builtin__: But: >>> [x for x in dir('__builtin__') if 'apply' in x] [] ? If apply is in the __builtin__ module, why doesn't dir('__builtin__') know about it? Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Brian van den Broek
Peter Otten said unto the world upon 05/23/2007 01:32 PM: > Brian van den Broek wrote: >> Help on built-in function apply in module __builtin__: >> >> But: >> >> >>> [x for x in dir('__builtin__') if 'apply' in x] >> [

Re: webbrowser module bug?

2007-05-25 Thread Brian van den Broek
gt; Ron Works fine for me on ubuntu 7.04 (fiesty) with Python 2.5.1c1, which appear to be your set-up, too. Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open('http://www.python.org') True >>> Best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: c[:]()

2007-05-30 Thread Brian van den Broek
: > > bidders = [local_members] + [callin_members] > bidders[:].sign_in(roster) > ... for bidder in [local_members] + [callin_members]: bidder.sign_in(roster) Best, Brian vdB > \~/ > >> -Original Message- >> From: [EMAIL PROTEC

Re: tuples, index method, Python's design

2007-04-13 Thread Brian van den Broek
. > > Yes it is a little thing. But if it is such a little thing why do > the developers don't simply add it? It's wafer thin! -- Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

doctests for interactive functions

2007-02-08 Thread Brian van den Broek
oes not matter.) Please try again. Yes or no? >>> yn.data False That works fine as a unit test. But, it doesn't score too well on the `executable documentation' metric, as there is the inputs.pop() in the way, and the user input doesn't make it on to the screen. Is there any way to make the doctests look more like actual interactive sessions, while preserving their automatic runability? Thanks and best, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Ben Finney said unto the world upon 02/08/2007 03:03 PM: > Brian van den Broek <[EMAIL PROTECTED]> writes: > >> Since the classes are for getting input interactively, a >> straightforward use of doctest is not going to work. (The tests >> won't run automaticall

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/08/2007 02:25 PM: > On 2007-02-08, Brian van den Broek <[EMAIL PROTECTED]> wrote: >> All classes take an optional argument input_function that >> determines how the class instance gets its input. If this is >> not provided, it def

Re: Python Newbie

2007-02-08 Thread Brian van den Broek
evious line contains an unfinished statement. For instance: not_yet_a_list = [1,2,3 def foo(): pass when saved and run as foo.py produces: [EMAIL PROTECTED]:~/scratch$ python foo.py File "foo.py", line 3 def foo(): ^ SyntaxError: invalid syntax HTH, Brian vdB

Re: doctests for interactive functions

2007-02-09 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/09/2007 08:52 AM: > On 2007-02-08, Brian van den Broek <[EMAIL PROTECTED]> wrote: >> Can I run the rough structure of my code past you to see if it >> is in the vicinity of what you mean? (I have removed some >> details for s

Re: PYTHONPATH

2006-04-23 Thread Brian van den Broek
e issue. I'm a fairly recently convert to ubuntu from Windows and I'm still at the stage where I am most comfortable with things right there for the clicking, but I'm learning ;-) The suggestions above appear not to work for me: [EMAIL PROTECTED]:~/PythonFiles$ pwd /home/bri

Re: PYTHONPATH

2006-04-23 Thread Brian van den Broek
Edward Elliott said unto the world upon 23/04/06 04:28 PM: > Brian van den Broek wrote: > >>The suggestions above appear not to work for me: >> >>[EMAIL PROTECTED]:~$ cat /etc/profile | grep 'export PYTHONPATH' >>export PYTHONPATH="~/PythonFiles&quo

Re: PYTHONPATH

2006-04-24 Thread Brian van den Broek
Edward Elliott said unto the world upon 23/04/06 07:56 PM: > Brian van den Broek wrote: >>Only somewhat, as if I open a brand new shell: >> >>[EMAIL PROTECTED]:~$ python >> >>> from sys import path >> >>> path[0:3] >>['', 

RESOLVED Re: PYTHONPATH

2006-04-24 Thread Brian van den Broek
> either in /etc/profile (will be system-wide default) or ~/.bash_profile > (will be user-specific). and Edward Elliott said unto the world upon 23/04/06 07:56 PM: > Brian van den Broek wrote: >>So, it seems that I currently have to invoke '. .bash_profile' >>ma

Re: OOP / language design question

2006-04-26 Thread Brian van den Broek
eed, this is not a very good example. This hobbyist isn't seeing Duncan's point. Wouldn't deleting the dothis method from both classes lead to an AttributeError as Base.__init__ calls self.dothis()? Is the point that one could refactor out the self.dothis() from the __init__? Or something else altogether? (I assume it can't be that dothis isn't doing real work as it is in the context of a toy example.) Enlightenment gratefully received. Best to all, Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Python threading

2009-01-13 Thread Brian Allen Vanderburg II
I'm doing some multi-threaded programming and before diving into the C/C++ code I though I'd do some in Python first. I decided to read through the threading module and I understand some of it, but I don't understand this, though I'm sure it is easy: The condition object has a method _is_owne

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Brian Allen Vanderburg II
der-to-read code IMHO. I think the Allman style is the most readable followed by perhaps Whitesmiths style. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: USB in python

2009-01-22 Thread Brian Allen Vanderburg II
he FTDI chips might be the way to go. I think the FTDI chip is basically a USB-to-RS232 converter and there is a libftdi that is built on top of libusb I think. Anyway for my design (if I ever get around to it) I'm going to create a library in C that uses the hardware and then I can create a

Re: pep 8 constants

2009-01-22 Thread Brian Allen Vanderburg II
lass level: @property def pi(): return 3.14159. print(pi) # prints 3.14159 pi=32 # Raise an error Cannot set attribute ... Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Idea to support public/private.

2009-01-22 Thread Brian Allen Vanderburg II
Okay so I don't really care about public/private but I was watching the lists (Does python follow its idea of readability or something like that) and I thought of a 'possible' way to add this support to the language. I have implemented a class which allows creating both a private as well as a

Re: Idea to support public/private.

2009-01-22 Thread Brian Allen Vanderburg II
There was a small error in setprivate/getprivate: import sys import inspect def get_private_codes(class_): codes = [] for i in class_.__dict__: value = class_.__dict__[i] if inspect.isfunction(value): codes.append(value.func_code) return codes def get_protect

Re: USB in python

2009-01-22 Thread Brian Allen Vanderburg II
s also a python wrapper for it on the pyserial web site (pyparallel maybe?) If you don't have a built-in parallel port then there are those USB to serial/parallel converters. Brian A. Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic methods and lambda functions

2009-01-23 Thread Brian Allen Vanderburg II
unine...@gmail.com wrote: class Person: def __init__(self): for prop in props: setattr(self, "__" + prop[0], prop[1]) setattr(Person, "Get" + prop[0], lambda self: getattr (self, "__" + prop[0])) I've had a similar problem here and here is best how I can ex

Re: How do I get my python program to get the root password ?

2009-01-23 Thread Brian Allen Vanderburg II
ad in /etc/sudoers. I don't really know, I just have mine set up for my main user account to be able to execute any command. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: understanding nested lists?

2009-01-24 Thread Brian Allen Vanderburg II
int id(l[0]) # -1210893364 print id(l[1]) # -1210893364 l = [list([None]*4) for x in range(6)] print id(l[0]) # -1210893612 print id(l[1]) # -1210893580 Works better Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: USB in python

2009-01-26 Thread Brian Allen Vanderburg II
could also create a simple switch box out of it to control external devices, maybe connecting each of the data lines to relays to turn on/off eight devices, etc. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Understanding descriptors

2009-01-29 Thread Brian Allen Vanderburg II
same thing? c.f3 = f1 c.f3 # function, not bound method So it is not calling the __get__ method for c.f3 After it finds c.f3 in c.__dict__, and since it has a getter, shouldn't it call the __get__ to return the bound method. It is good that it doesn't I know, but I just want to k

Re: new.instancemethod questions

2009-01-29 Thread Brian Allen Vanderburg II
(f1, a) a.f2() # prints object a These may work for most uses, but both have a problem that happens if you need to make a copy of the instance. When you copy it, the copies 'f1' will still call the function but using the old object a.f1() # prints object a b = copy.copy(a)

Re: libsudo ?

2009-01-29 Thread Brian Allen Vanderburg II
* password, char* user, int invalidate ); Thanks -- http://mail.python.org/mailman/listinfo/python-list Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Why such different HTTP response results between 2.5 and 3.0

2009-02-01 Thread Brian Allen Vanderburg II
: 191d\r\n at the start \r\n0\r\n\r\n at the end In 2.5, newlines are automatically decoded In 3.0, the \r\n pairs are kept I hope their is an easy way to decode it as it was in 2.x Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding descriptors

2009-02-05 Thread Brian Allen Vanderburg II
nce?) For writing: 1. If instance a. lookup in the class/bases for a binding descriptor and if found use its __set__ b. write to instance __dict__ 2. If class, write in class __dict__ I think I understand it now. Thanks. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Flattening lists

2009-02-05 Thread Brian Allen Vanderburg II
uple, list)): flatten(el, res) else: res.append(el) return res Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Flattening lists

2009-02-05 Thread Brian Allen Vanderburg II
each level, and 3.2 for the one not creating the list at each level. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting numbers to words

2009-02-05 Thread Brian Allen Vanderburg II
lue for it calls the first function, and appends the correct word. This only works for the English language though Brian Vanderburg II num_words1 = ("zero", # not used "one", "two", "three", &

Python idea/proposal to assist in single-archive python applications

2008-12-07 Thread Brian Allen Vanderburg II
le in such a way only allows binary opens, it can't take advantage of pythons 'rU' open mode if the application so needs. Also, it still requires an external startup script to set the path and import the internal module. If this function was provided in Python, then and application coul

Re: Python idea/proposal to assist in single-archive python applications

2008-12-07 Thread Brian Allen Vanderburg II
I'll look into using pkgutil for for loading data from the archive. Thanks. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: How to initialize a class variable once

2008-12-09 Thread Brian Allen Vanderburg II
The reason is the first time main.py gets loaded, it is known as '__main__' but when app imports main, it is not in sys.modules so it loads 'main.py' again but this time as 'main' Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Bidirectional Networking

2008-12-13 Thread Brian Allen Vanderburg II
eans is that during the listen for an incoming connection on the listening socket, if multiple connection attempts are coming in at one time it can keep a backlog of up to 5 of these connection attempts for that individual socket. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Limit traceback from most recent call

2008-12-14 Thread Brian Allen Vanderburg II
ecent call last):\n' items = traceback.format_list(items) for i in items: result += i # Newline already included result += type.__name__ + ': ' + str(value) return result Is this possible currently from traceback or other python module? Brian A. Vanderburg II -- h

Re: Limit traceback from most recent call

2008-12-15 Thread Brian Allen Vanderburg II
yinon...@gmail.com wrote: On Dec 14, 8:07 pm, Brian Allen Vanderburg II wrote: Hi, The interface of extract_tb is: traceback.extract_tb(tb, limit=None) try to play with the 'limit' argument Good luck, Yinon -- http://mail.python.org/mailman/listinfo/python-list I hav

Re: Relative imports in Python 3.0

2008-12-17 Thread Brian Allen Vanderburg II
or possible module imported from the top that is not in a package, such as a.py doing an 'import b', b would be a module but not a package so still probably need absolute imports, my guess anyway. But I also think that 'from . import a' would be nice if it would wor

Re: If programming languages were religions...

2008-12-19 Thread Brian Allen Vanderburg II
martin.lal...@gmail.com wrote: very interesting http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html "Python would be Humanism: It's simple, unrestrictive, and all you need to follow it is common sense. Many of the followers claim to feel relieved from all the burden impos

Copying objects and multiple inheritance

2009-06-02 Thread Brian Allen Vanderburg II
make sure all the information is copied as it is supposed to be even for the base classes that have special requirements. Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Copying objects and multiple inheritance

2009-06-03 Thread Brian Allen Vanderburg II
Gabriel Genellina wrote: En Tue, 02 Jun 2009 19:02:47 -0300, Brian Allen Vanderburg II escribió: What is the best way to copy an object that has multiple inheritance with the copy module. Particularly, some of the instances in the hierarchy ("...some of the classes in...",

How to do relpath implementation on 2.5

2009-08-08 Thread Brian Allen Vanderburg II
in(relative_list) Currently I just return the target if it can not be made relative. Brian A. Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Brian Allen Vanderburg II
= [n for n in evens(15)] L: [0, 2, 4, 6, 8, 10, 12, 14] Brian Vanderburg II -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Templating Language

2017-12-18 Thread Brian Oney via Python-list
you may consider checking out a more general approach. Noweb was the first to my knowledge and lead the way for Sweave (R or S), and pyweave, as mentioned. https://en.wikipedia.org/wiki/Noweb Cheers -- https://mail.python.org/mailman/listinfo/python-list

Re: New Python curses book

2021-03-30 Thread Brian Oney via Python-list
Congratulations! Indeed, I was wondering for a moment if this was a guide to al dente spaghetti code. With each curse being a funny way to mess with the colleagues performing the code review ;) Or a list of funny Monty Python curses? Or a set of programming problems that are cursed? On Marc

Making a Python program into an executable file

2022-04-11 Thread Brian Wagstaff via Python-list
Python and click the Add Python to Path option. I tried to do this, but was given the option to Upgrade Python, and once I did this the Add Python to Path option seemed not to be available. Can you advise me what to do? Best wishes, Brian -- https://mail.python.org/mailman/listinfo/python-list

Re: Python gotcha of the day

2018-03-14 Thread Brian Oney via Python-list
explicit is better than implicit. That gives me an idea for a module with the following debugging command line functionality. import sass >>> "" ":p" Traceback: Are you telling me that ' ' is supposed to an operator? (Rock thrown) On March 14, 2018 10:40:38 AM GMT+01:00, Thomas Jollans wr

Re: stock quotes off the web, py style

2018-05-16 Thread Brian Oney via Python-list
thank you for that tip. I missed that somehow... На 16 май 2018 г. 16:31:37 GMT+02:00, Peter Otten <__pete...@web.de> написа: >Friedrich Rentsch wrote: > >> >>> ibm = urllib2.urlopen >> ("https://api.iextrading.com/1.0/stock/IBM/quote";).read() >> >>> ibm = eval (ibm) > >Dont do this. You are al

Re: text mining

2018-06-16 Thread Brian Oney via Python-list
На 15 юни 2018 г. 14:57:46 GMT+02:00, Steven D'Aprano написа: >Seriously, you are asking strangers to help you out of the goodness of >their heart. If your intention was to send the message that you're >lazy, >drunk, or just don't give a damn about the question, you were >successful. Answers

command line utility for cups

2018-06-20 Thread Brian Oney via Python-list
INTER -l') parser.parse_known_args(['-o', 'sides=one-sided', '-o', 'test=crap']) Namespace(options='test=crap', printer=None)) How should I deal with multiple options being fed into my script? Thanks! Cheers, Brian -- https://mail.python.org/mailman/listinfo/python-list

Re: command line utility for cups

2018-06-20 Thread Brian Oney via Python-list
Thanks Peter! That's pretty slick. I will get it working for sure now. Regards, Brian -- https://mail.python.org/mailman/listinfo/python-list

Re: command line utility for cups

2018-06-20 Thread Brian Oney via Python-list
On Wed, 2018-06-20 at 12:36 +0200, George Fischhof wrote: > Hi, > You can also try click library from pypi, that is a very good command line > stuff. > > George Thank you for the tip. I am away of click and it's awesomeness, but am hesitant because it's not apart of stdlib. I have gotten bitten

[OT] Bit twiddling homework

2018-07-19 Thread Brian Oney via Python-list
what book or learning course do you recommend? I imagine something that tours or skims the fundamentals of Boolean algebra and digital logic, and then goes to C and some fun homework problems. It may seem to you that the emphasis there is wrongly placed. Thank you for the tips. Cheers, Brian

Re: [OT] Bit twiddling homework

2018-07-20 Thread Brian Oney via Python-list
On Fri, 2018-07-20 at 06:37 +, Steven D'Aprano wrote: > On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote: > > > PS: Can I twiddle bits in Python? > > Yes. > > These operators work on ints: > > bitwise AND: & > bitwise OR:

Re: [OT] Bit twiddling homework

2018-07-20 Thread Brian Oney via Python-list
On Fri, 2018-07-20 at 18:07 +0900, xffox wrote: > On Fri, Jul 20, 2018 at 08:25:04AM +0200, Brian Oney via Python-list wrote: > > Therefore, what book or learning course do you recommend? I imagine > > something that tours or skims > > the fundamentals of Boolean algebra a

Re: [OT] Bit twiddling homework

2018-07-20 Thread Brian Oney via Python-list
On Fri, 2018-07-20 at 10:38 -0400, Dennis Lee Bieber wrote: > On Fri, 20 Jul 2018 11:00:09 +0200, Brian Oney via Python-list > declaimed the following: > > > Are 16|1 and 16+1 internally the same operation (for integers)? > > For those integers the EFFECT/RESULT

Re: For next loops

2018-07-23 Thread Brian Oney via Python-list
What if ply != com in the first (0th) iteration?  It's better to have an 'else:'-statement in your case, I suppose. -- https://mail.python.org/mailman/listinfo/python-list

Re: Want to be a rockstar programmer?

2018-07-23 Thread Brian Oney via Python-list
meh, I'm more into 90s and 00s metal rock and punk rock. Oh well, I knew it wasn't meant to be. ;) -- https://mail.python.org/mailman/listinfo/python-list

Re: >< swap operator

2018-08-14 Thread Brian Oney via Python-list
On Tue, 2018-08-14 at 10:55 -0400, Dennis Lee Bieber wrote: > On Tue, 14 Aug 2018 06:18:41 -0700 (PDT), skybuck2...@hotmail.com declaimed > the following: > > > On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote: > > > On 13/08/2018 21:54, skybuck2...@hotmail.com wrote: > > > > I j

Re: I need help to put the output from terminal in a csv file

2018-09-07 Thread Brian Oney via Python-list
Please study the following to get you started. It looks like JSON output that you are dealing, which is good. I added a ", to the "body"-line, because I assume that you botched that when giving an example. ```python #!/usr/bin/env python import json output = ''' {    "error" : {   "body"

<    6   7   8   9   10   11   12   >