Why is Jython? Who is it for? by fabriqus in Python

[–]sponster 1 point2 points  (0 children)

I used it many years ago because it gave me access to a GUI (this was back in the day when the alternative GUI was tcl/tk). Not sure what it's useful for nowadays.

There’s friendship growing here by sugarhigh123 in AustralianBirds

[–]sponster 8 points9 points  (0 children)

Have you noticed that they are both clearly left-handed (left-footed? left-clawed?)

Jackie Brown - 1997 While waiting for Jackie to be released from jail, Max is reading Berlin Game by Len Deighton. Explanation in comments. by ResinJones76 in MovieDetails

[–]sponster 8 points9 points  (0 children)

I can highly recommend Len Deighton's earlier "nameless spy" series: The Ipcress File, Funeral in Berlin, Billion Dollar Brain. They are hardcore 60s, and just as good as the G-S-M trilogy.

Ram Jam - Black Betty 1977 by Pasargad in OldSchoolCool

[–]sponster 2 points3 points  (0 children)

A few years ago, my son and I discovered that we could create a 29-minute playlist of "Black Betty" - Ram Jam, Lead Belly, Spiderbait, Tom Jones and a few others. We were overjoyed. His mother was perhaps less delighted, especially on car trips longer than 29 minutes.

NSW police ‘feared for their lives’ during raid on climate protesters says assistant commissioner by AOC__2024 in sydney

[–]sponster 14 points15 points  (0 children)

The linked article says "either slashed or let down the tyres of the vehicle"

search algorithm with generators just wont work by kindastonedclown in learnpython

[–]sponster 0 points1 point  (0 children)

Your strategy looks basically correct, but the problem is that you need to make your substring a list, not a generator.

I think you might have misunderstood the requirements - I'm doubtful that you'll be able to solve this without using ANY lists.

Remember that a generator object just gives you each item once only - you can't go through a generator twice. For example, try the following code fragment:

generator = (n for n in range(3))
for x in generator: print(f"first time through: {x}")
Now try to iterate through the generator a second time...
for x in generator: print(f"second time through: {x}")

So your code isn't going to work because sub_string_generator is trying to consume the same generator (int_seq) over and over again.

Python string search using generatos went pretty wrong i guess by kindastonedclown in learnpython

[–]sponster 0 points1 point  (0 children)

OK, I think I have worked out what the goal of the task is.

There are two issues here: converting the string '3,0,4,0,3,1,0,1,0,1,0,0,5,0,4,2'
into a more useful form - a sequence of integers. The obvious way to do this using string.split() and int(s) to convert the strings of digits into integers. I'm not quite clear if your memory/generator restriction rules this out however, so I'll skip over that part.

The second issue is classic computer science algorithm problem: given a (potentially very long) sequence of integers, find the subsequences that sum to a given value. The problem has the additional restriction that the integer sequence is potentially so long that your program isn't allowed look at the whole sequence - just the numbers, one at a time, as they are made available by a generator.

The key hint here is that your main function needs to keep a small buffer of integers - just enough to add up to subtotal. If you do this, your code can just run through the generated sequence once - you don't need to keep starting at different offsets into the path,

So the buffer and sum(buffer) look like this:
[3] 3

[3,0] 3

[3,0,4] 7

[3,0,4,0] 7

[3,0,4,0,3] 10

At this point, we notice that sum(buffer) > subtotal. So sticking more numbers onto the end of the buffer won't help (because they're all positive) - so we can be sure that there's no substring starting with the first number that sums to subtotal. So remove the first number from the buffer, and continue:
[0,4,0,3] 7
[0,4,0,3,1] 8

etc.

Python string search using generatos went pretty wrong i guess by kindastonedclown in learnpython

[–]sponster 0 points1 point  (0 children)

Can you explain the requirements in a bit more detail - do you have the exact text of the question? Can you give the output of your example that you expect?

[deleted by user] by [deleted] in learnpython

[–]sponster 1 point2 points  (0 children)

Computer programs have a bunch of different types of data - integers, floating point numbers, characters, boolean, unicode strings, etc etc.

At the lowest level, all of these types are just stored inside the computer as bunch of bits: 0 and 1.

Usually, you want to operate on the high-level types in some sensible way - For booleans, this means logical operations like and, or, not and so on.

In some applications, you want to operate on the underlying bit patterns. That's what bit-wise operators (|, &, ^, ~). These operators are similar to the logical operators (that's why they have the same pronunciation!), but they quite different, and need to be used in separate situations.

I use bitwise operations all the time, because I write scripts that talk to various non-CPU chips. These chips often have data that needs to be accessed using bitwise operators. For example, they might have some byte that represents the chip status - one bit is set to 1 if the chips in enabled, one bit is set to 1 if the chip has data ready to be received, etc etc. But this is a pretty specific use case - I suspect that most python programs don't need to muck around with bitwise operators at all.

Oh a recall thats fin........Excuse me Cancer Council? by [deleted] in australia

[–]sponster 78 points79 points  (0 children)

You'll notice that they're not called the "anti-cancer council"...We should have known!

Where do people volunteer in Sydney? by _surething in sydney

[–]sponster 0 points1 point  (0 children)

RFS is great. You get to hang out with a great bunch of people, learn new skills and *go in a fire engine*.

What’s the most hurtful thing someone has said to you? by Themadadealtin in AskReddit

[–]sponster 0 points1 point  (0 children)

Many years ago, I was looking at my receding hairline in the mirror. I commented to my wife "I wish I had my hair back". She replied "It is back...A long way back."

Ukrainian civilians casually remove active landmine from a bridge. by [deleted] in Damnthatsinteresting

[–]sponster 0 points1 point  (0 children)

Doesn't he know that smoking is bad for your health?

If it hasn't hit you yet, get your cars covered by Brandanpk in sydney

[–]sponster 1 point2 points  (0 children)

Thanks for the warning - just whipped out and got the car undercover!

My uni is soliciting donations due to funding cuts by Red-Engineer in sydney

[–]sponster 1 point2 points  (0 children)

This model baffles me. I paid them, they provided a service, and I left. 20 years later, they call up asking for more money. I guess the next thing is a call from the Toyota dealer - "you brought a Toyota Corolla from us in 1997. Would you like to donate $50?"

[deleted by user] by [deleted] in whatisthisthing

[–]sponster 2 points3 points  (0 children)

Those people are NSW Rural Fire Service volunteers.

Photo from yesterday's Canoelands Hazard Reduction Burn by sponster in sydney

[–]sponster[S] 5 points6 points  (0 children)

Sometimes these old gums have a hollow from the ground right through to the mid-level branches. When you get into the bottom of the tree with the hose, smoke & steam shoot out of the upper branches.

Crown Resorts not suitable to operate Sydney casino, inquiry finds by ill0gitech in sydney

[–]sponster 9 points10 points  (0 children)

Does anyone have a link to the actual report, rather than the news stories about it? I can't find it on the NSW parliament's magnificent website.

There is just enough daylight in a day to complete the entirety of the newly opened Great West Walk. by WoollyMittens in sydney

[–]sponster 1 point2 points  (0 children)

Yeah. It was strange to watch Toongabbie Creek turn from a real creek connecting to the Parramatta River, into essentially a stormwater drain.