util? Isn't that the higher level file operation module?
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
e quoted blocks.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
and mailing list users get
angry if you top post (i.e. quote below the reply)
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
red by every programmer is to define what can be
defined as the exceptional condition and what is a condition that merits
merely different treatment without causing disruption of the normal flow
of the program.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
is likely to
incur. I did not start this as a criticism of Python's exceptions as
such. I just expressed my personal aversion to using them in my own code.
However, in my next project I have started using exceptions and will keep
an open mind on how it turns out. So far it doesn'
higher level. While an error flag can simply
set an alarm and allow other code to continue and allow the calling
higher-level code to handle the alarm/flag as it sees fit.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
reason why I think I used
simple error codes to handle certain recoverable conditions and avoided
exceptions.
I quite enjoyed your post. Thank you for explaining a lot of issues which
I probably could not have figured out on my own.
--
Harishankar (http://harishankar.org http://lawstudentsc
on and litter my
top-level code with too many exception handlers.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
erfaces.
This is probably what I should try to do. Of course my function returns
only a list in most circumstances. Only in error does it return False. I
mis-represented the None type for the empty list in my previous post, my
apologies.
--
Harishankar (http://harishankar.org http://lawstud
has two different statements that
raised the same exception but for different reasons? With error handling
I could probably handle it right below the statement which was called and
thus reduce the problem???
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
preciate them :)
Finding it hard to appreciate exceptions myself. But I am used to
thinking linearly. A piece of code which does not explain itself in the
most obvious way even if I wrote it always worries me.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
tand both sides of the issue. Exceptions seem to be
generally more reliable but I feel they add a lot of complexity
particular when a lot of code is placed in a try block.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 02 Dec 2010 10:19:35 -0500, Steve Holden wrote:
> On 12/2/2010 9:13 AM, Harishankar wrote:
>> On Thu, 02 Dec 2010 22:19:25 +1100, Ben Finney wrote:
>>
>>> More details of the problem you're trying to solve would help with
>>> giving specific adv
On Thu, 02 Dec 2010 08:44:11 -0600, Tim Chase wrote:
> On 12/02/2010 08:18 AM, Harishankar wrote:
>> Here I'm using it to compare the result of a function where I
>> specifically return False on error condition,
>
> This sounds exactly like the reason to us
al False rather than the fuzzy False produced
by the boolean operation.
I wouldn't do this in most situations though, but I did need to
distinguish between the the empty list and False and using the broader
form as in "if not a" did not work as expected.
--
Harishankar (h
e "is"
if result is False:
# error condition
That is how my problem arose.
-
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
answer. I guess "is" is what I am
looking for. :-)
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
>
> When ever I need to test for None, I always use the "is" comparator.
> It's also more English-like. (None, evaluating to False when using
> '==', is useful when all you care about is having a blank default value,
> for example.)
Yes, but i
aise exceptions instead? I feel it's
unnecessary clutter to use exceptions unless absolutely no other solution
is available and yet I have doubts about the "False" value.
--
Harishankar (http://harishankar.org http://lawstudentscommunity.com)
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 02 Apr 2010 10:17:55 +, Harishankar wrote:
> I am writing a small app which requires input using stdin to the
> subprocess.
>
> I use the following technique:
>
> proc = subprocess.Popen (cmdargs, stdin=subprocess.PIPE)
>
> proc.stdin.write ("S
ose the process when done.
--
Harishankar (http://harishankar.org http://literaryforums.org)
--
http://mail.python.org/mailman/listinfo/python-list
but in your case I would probably use
a database, because it is the easiest and most standardized way to access
such types of data. If you don't want something heavyweight, use sqlite
with in-memory databases/persistent file.
Look at sqlite3 module in python.
--
Harishankar (http://hari
f the text mode console libraries? :-(
--
Harishankar (http://harishankar.org http://literaryforums.org)
--
http://mail.python.org/mailman/listinfo/python-list
t modules) in the
Python built-in library.
In Python 3.x there is one called html.parser
You can use this to parse out specific tags from HTML documents. If you
want something more advanced, consider using XML.
--
Harishankar (http://harishankar.org http://literaryforums.org)
--
http://mail.python.org/mailman/listinfo/python-list
1638/how-do-i-protect-python-code
Read it and judge whether the benefits of not obfuscating code outweighs
the advantages of obfuscating it.
--
Harishankar (http://harishankar.org http://literaryforums.org)
--
http://mail.python.org/mailman/listinfo/python-list
e: it just seems there is so much extra stuff which shouldn't be
> needed that's being saved out.
This might not be of much use to you, but I've found by experience that
PNGs are almost always bigger or equal to GIFs of the same resolution,
colour depth and so on. I've
On Sat, 27 Mar 2010 14:56:30 +, Grant Edwards wrote:
> On 2010-03-27, Harishankar wrote:
>
>>> I've used it for some trivial stuff, but not for anything very
>>> sophisticated. Redhat's text-mode installer program (anaconda) was
>>> written in
On Sat, 27 Mar 2010 14:44:23 +, Grant Edwards wrote:
> On 2010-03-27, Harishankar wrote:
>> I am writing a fairly featureful TUI in python and I figured newt is
>> the best lightweight TUI which actually offers widgets. curses is low
>> level and its text editing capabi
of OK and Cancel buttons in standard forms would be of help.
So anybody uses newt? Or have people stopped using text based UIs
completely?
--
-- Harishankar (http://harishankar.org http://literaryforums.org)
--
-- Harishankar (http://harishankar.org http://literaryforums.org)
--
On Fri, 26 Mar 2010 14:49:02 +, kj wrote:
> What's the word on using "classes as namespaces"? E.g.
>
> class _cfg(object):
> spam = 1
> jambon = 3
> huevos = 2
>
> breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)
>
>
> Granted, this is not the "intended use" for classes, and
Have you people embraced Python 3.x or still with 2.5 or 2.6?
I personally want to switch over but not too sure how many people are
using 3.x as opposed to 2 so I want to keep my programs compatible for
the majority.
-- Hari
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 26 Mar 2010 02:49:53 -0700 (PDT)
James Harris wrote:
> On 25 Mar, 22:56, Jon Clements wrote:
> > On 25 Mar, 22:40, James Harris
> > wrote:
> >
> > > I am looking to store named pieces of text in a form that can be
> > > edited by a standard editor such as notepad (under Windows) or vi
>
I am trying to use Python curses.textpad to get (preferably UTF-8 but
not needed) input from the user in a python curses application, but I
realize that it is extremely limited and doesn't allow me to specify an
existing text to edit. Also it doesn't seem to provide scrolling
abilities on the windo
nal is installed, but
> you should probably look at a couple of other popular distros first to make
> sure that the key is there.
This is set on Debian too. Thanks. I should be able to use this environment
variable on most Linux distributions, I suspect.
--
Regards,
V. Harishan
On Wednesday 23 Apr 2008 14:46:20 Christian Heimes wrote:
> Harishankar schrieb:
> > Is there any platform independent way to launch a terminal window from a
> > desktop (Windows, Linux, etc.)?
>
> No, there isn't. It usually not possible to create a graphical terminal
&
wanted to be absolutely sure that it
worked because you had mentioned that it has some drawbacks.
--
Regards,
V. Harishankar
http://hari.literaryforums.org
http://harishankar.org
--
http://mail.python.org/mailman/listinfo/python-list
Thanks a lot to everybody who's been following this discussion. Very
interesting indeed.
I'm currently thinking of working around this problem by actually opening a
new terminal window and running the command from there, thus allowing the
user full control over the process.
discerning Python programmer who doesn't feel in some way
> bound to whatever comes bundled with the standard library.
>
> TJG
I wouldn't feel "bound" if I restricted the program to myself. But if I want
to distribute it (as I intend to) I have to think of othe
ks a lot for the link.
--
Regards,
V. Harishankar
http://hari.literaryforums.org
http://harishankar.org
--
http://mail.python.org/mailman/listinfo/python-list
except OSError:
> return
> sleep(1.0)
> try:
> if killpg:
> os.killpg(pgid, signal.SIGKILL)
> else:
> os.kill(pid, signal.SIGKILL)
> except OSError:
>
On Tuesday 22 Apr 2008 17:06:26 Paul Boddie wrote:
> On 22 Apr, 12:52, Harishankar <[EMAIL PROTECTED]> wrote:
> > Is there any way to use non-blocking Popen objects using subprocess? and
> > 2 - is there a way to kill the subprocess in a platform independent
> > manner
ately none of the solutions seem to fit my needs.
My only solution seems to be to offer the end user the mencoder command line
and make them execute it manually and be done with it but that seems a rather
weak solution.
--
Regards,
V. Harishankar
http://hari.literaryforums.org
http://haris
42 matches
Mail list logo